Correct root_device of instances to be the real one

We used to set /dev/sda as root device even if the instance is
boot from an ECKD/FBA disk, that's a wrong. This fix will corret
this mistake and set the root device to be the real one.

Change-Id: I221073f014c32e1ee741599ea8099951618d95a6
This commit is contained in:
Yi Chun Huang 2016-08-22 16:20:17 +08:00 committed by jichenjc
parent 7ddff6184e
commit 62decfc11c
2 changed files with 6 additions and 15 deletions

View File

@ -349,9 +349,9 @@ class ZVMDriver(driver.ComputeDriver):
zvm_inst.power_on()
# Update the root device name in instance table
root_device_name = '/dev/' + const.ZVM_DEFAULT_ROOT_VOLUME
root_device_name = '/dev/' + const.ZVM_DEFAULT_ROOT_DISK
if boot_from_volume:
root_device_name = self._format_mountpoint(root_device_name)
root_device_name = root_mount_device
instance.root_device_name = root_device_name
instance.save()

View File

@ -463,20 +463,11 @@ def _is_warning(err_str):
return False
def volume_in_mapping(mount_device, block_device_info):
def _volume_in_mapping(mount_device, block_device_info):
block_device_list = [block_device.strip_dev(vol['mount_device'])
for vol in
driver.block_device_info_get_mapping(
block_device_info)]
swap = driver.block_device_info_get_swap(block_device_info)
if driver.swap_is_usable(swap):
block_device_list.append(
block_device.strip_dev(swap['device_name']))
block_device_list += [block_device.strip_dev(ephemeral['device_name'])
for ephemeral in
driver.block_device_info_get_ephemerals(
block_device_info)]
LOG.debug("block_device_list %s", block_device_list)
return block_device.strip_dev(mount_device) in block_device_list
@ -488,9 +479,9 @@ def is_volume_root(root_device, mountpoint):
def is_boot_from_volume(block_device_info):
root_mount_device = '/dev/' + const.ZVM_DEFAULT_ROOT_VOLUME
root_mount_device = root_mount_device.replace('/dev/s', '/dev/v')
boot_from_volume = volume_in_mapping(root_mount_device, block_device_info)
root_mount_device = driver.block_device_info_get_root(block_device_info)
boot_from_volume = _volume_in_mapping(root_mount_device,
block_device_info)
return root_mount_device, boot_from_volume