diff options
author | Rick Harris <rconradharris@gmail.com> | 2013-01-29 07:26:48 +0000 |
---|---|---|
committer | Rick Harris <rconradharris@gmail.com> | 2013-01-30 18:13:26 +0000 |
commit | 8705f49a4ad9c6f3a93f33e333475285a8f70a30 (patch) | |
tree | 3ecac6d6b41b9e7d33c270efe885a0f3b2067aeb /nova/block_device.py | |
parent | 045e1190f23616e266e5b054b7b192e61e37d659 (diff) | |
download | nova-8705f49a4ad9c6f3a93f33e333475285a8f70a30.tar.gz nova-8705f49a4ad9c6f3a93f33e333475285a8f70a30.tar.xz nova-8705f49a4ad9c6f3a93f33e333475285a8f70a30.zip |
Fix rebuild with volumes attached
This patch assumes that the correct behavior for instance rebuild is to
maintain attached volumes across a rebuild operation.
Two important changes are:
1) Detaching all volumes during a rebuild so that they won't be 'in-use'
when prep_block_devices is called to reattach them.
2) xenapi: Allowing additional volumes, not just root volumes, to be
attached before boot. To handle this, we cycle through all
block-device-mappings, not just the root-device, create the VDI, and
later, create the VBD.
Small changes include:
* Using `connection_data` instead of `dev_params` (to match other parts of
the code base)
* Renaming `get_vdis_for_boot_from_vol` to `get_vdi_uuid_for_volume` to
reflect its more general and simpler semantics.
Fixes bug 1071547
Change-Id: Ie54a16be4bae2a718ed7d506f32777d0847b9089
Diffstat (limited to 'nova/block_device.py')
-rw-r--r-- | nova/block_device.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/nova/block_device.py b/nova/block_device.py index 1805ff15f..7d43d15cb 100644 --- a/nova/block_device.py +++ b/nova/block_device.py @@ -149,23 +149,20 @@ def match_device(device): return match.groups() -def volume_in_mapping(mount_device, block_device_info, strip=strip_dev): - # FIXME(sirp): xen uses strip_prefix to be mountpoint agnostic. There is - # probably a better way to handle this so that strip_dev can be used - # exclusively. - block_device_list = [strip(vol['mount_device']) +def volume_in_mapping(mount_device, block_device_info): + block_device_list = [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(strip(swap['device_name'])) + block_device_list.append(strip_dev(swap['device_name'])) - block_device_list += [strip(ephemeral['device_name']) + block_device_list += [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 strip(mount_device) in block_device_list + return strip_dev(mount_device) in block_device_list |