summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorRafi Khardalian <rafi@metacloud.com>2012-09-16 16:28:58 +0000
committerRafi Khardalian <rafi@metacloud.com>2012-09-04 12:13:45 +0000
commitb01ec8012a2a2568feb5fa05a56909a6bdf14ef8 (patch)
tree643d053b51b5cfae51c8293fdd50c1401a0c5a22 /nova/compute
parent0ffff7c490d54f9b932df4b2dcd62158242dae2a (diff)
Re-attach volumes after instance resize
Fixes bug 1051600. Update the compute manager to pass block_device_info to three additional driver entry points and update all virtualization drivers to accept it as an optional argument. Within libvirt, migrate_disk_and_power_off() will now iterate and disconnect any existing connections. finish_migration() simply updates its use of to_xml(), passing block_device_info, which returns a libvirt XML fully populated with volumes. Finally, finish_revert_migration() no longer uses the on-disk XML file, instead generating it via to_xml; as the former lacks volume configuration. Change-Id: I7dccd03ef9cc7d2848f07764d4def3787e41e202
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index a836a8f17..cd756af65 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -1445,8 +1445,12 @@ class ComputeManager(manager.SchedulerDependentManager):
old_instance_type = migration_ref['old_instance_type_id']
instance_type = instance_types.get_instance_type(old_instance_type)
+ block_device_info = self._get_instance_volume_block_device_info(
+ context, instance['uuid'])
+
self.driver.finish_revert_migration(instance,
- self._legacy_nw_info(network_info))
+ self._legacy_nw_info(network_info),
+ block_device_info)
# Just roll back the record. There's no need to resize down since
# the 'old' VM already has the preferred attributes
@@ -1558,9 +1562,13 @@ class ComputeManager(manager.SchedulerDependentManager):
self._notify_about_instance_usage(
context, instance, "resize.start", network_info=network_info)
+ block_device_info = self._get_instance_volume_block_device_info(
+ context, instance['uuid'])
+
disk_info = self.driver.migrate_disk_and_power_off(
context, instance, migration_ref['dest_host'],
- instance_type_ref, self._legacy_nw_info(network_info))
+ instance_type_ref, self._legacy_nw_info(network_info),
+ block_device_info)
self.db.migration_update(context,
migration_id,
@@ -1609,10 +1617,14 @@ class ComputeManager(manager.SchedulerDependentManager):
context, instance, "finish_resize.start",
network_info=network_info)
+ block_device_info = self._get_instance_volume_block_device_info(
+ context, instance['uuid'])
+
self.driver.finish_migration(context, migration_ref, instance,
disk_info,
self._legacy_nw_info(network_info),
- image, resize_instance)
+ image, resize_instance,
+ block_device_info)
instance = self._instance_update(context,
instance['uuid'],