mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Handle review comments
This commit is contained in:
parent
b728e23e53
commit
cca25055fa
@ -337,20 +337,27 @@ class ConfigDriveUtils:
|
|||||||
"""
|
"""
|
||||||
This method is to verify whether configdrive iso
|
This method is to verify whether configdrive iso
|
||||||
is attached to vm or not
|
is attached to vm or not
|
||||||
Returns mount path if config drive is attached else False
|
Returns mount path if config drive is attached else None
|
||||||
"""
|
"""
|
||||||
mountdir = "/root/iso"
|
mountdir = "/root/iso"
|
||||||
cmd = "blkid -t LABEL='config-2' " \
|
cmd = "blkid -t LABEL='config-2' " \
|
||||||
"/dev/sr? /dev/hd? /dev/sd? /dev/xvd? -o device"
|
"/dev/sr? /dev/hd? /dev/sd? /dev/xvd? -o device"
|
||||||
tmp_cmd = [
|
tmp_cmd = [
|
||||||
'bash -c "if [ ! -d /root/iso ] ; then mkdir /root/iso ; fi"',
|
'bash -c "if [ ! -d {0} ]; then mkdir {0}; fi"'.format(mountdir),
|
||||||
"umount /root/iso"]
|
"umount %s" % mountdir]
|
||||||
|
self.debug("Unmounting drive from %s" % mountdir)
|
||||||
for tcmd in tmp_cmd:
|
for tcmd in tmp_cmd:
|
||||||
ssh.execute(tcmd)
|
ssh.execute(tcmd)
|
||||||
|
|
||||||
|
self.debug("Trying to find ConfigDrive device")
|
||||||
configDrive = ssh.execute(cmd)
|
configDrive = ssh.execute(cmd)
|
||||||
|
if not configDrive:
|
||||||
|
self.warn("ConfigDrive is not attached")
|
||||||
|
return None
|
||||||
|
|
||||||
res = ssh.execute("mount {} {}".format(str(configDrive[0]), mountdir))
|
res = ssh.execute("mount {} {}".format(str(configDrive[0]), mountdir))
|
||||||
if str(res).lower().find("mounting read-only") > -1:
|
if str(res).lower().find("mounting read-only") > -1:
|
||||||
self.debug("configDrive iso is mounted at location %s" % mountdir)
|
self.debug("ConfigDrive iso is mounted at location %s" % mountdir)
|
||||||
return mountdir
|
return mountdir
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user