From a4f4a7a74f7280e6b95ee310f7c55fb68a476f23 Mon Sep 17 00:00:00 2001 From: Rafi Khardalian Date: Sun, 16 Sep 2012 16:28:58 +0000 Subject: [PATCH] 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 --- nova/tests/test_libvirt.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index 19839c56..14a1ec95 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -3736,7 +3736,8 @@ class LibvirtDriverTestCase(test.TestCase): def fake_extend(path, size): pass - def fake_to_xml(instance, network_info): + def fake_to_xml(instance, network_info, image_meta=None, rescue=None, + block_device_info=None): return "" def fake_plug_vifs(instance, network_info): @@ -3802,6 +3803,11 @@ class LibvirtDriverTestCase(test.TestCase): def fake_get_info(instance): return {'state': power_state.RUNNING} + def fake_to_xml(instance, network_info, image_meta=None, rescue=None, + block_device_info=None): + return "" + + self.stubs.Set(self.libvirtconnection, 'to_xml', fake_to_xml) self.stubs.Set(self.libvirtconnection, 'plug_vifs', fake_plug_vifs) self.stubs.Set(utils, 'execute', fake_execute) fw = base_firewall.NoopFirewallDriver()