diff options
| author | Matt Dietz <matt.dietz@rackspace.com> | 2011-08-05 14:07:48 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-08-05 14:07:48 +0000 |
| commit | 56ec8f040ba65e3b5ec1da768afaf0671fdb79f6 (patch) | |
| tree | f2b3b4d6142d4ec5850deee959b852938ea65f7e | |
| parent | 502801bfff0015ed3aa93b9d65a87cb6b80fd11d (diff) | |
| parent | 5fe92058d0ee11a7e9ea1c8f56b7e9350cf703e4 (diff) | |
| download | nova-56ec8f040ba65e3b5ec1da768afaf0671fdb79f6.tar.gz nova-56ec8f040ba65e3b5ec1da768afaf0671fdb79f6.tar.xz nova-56ec8f040ba65e3b5ec1da768afaf0671fdb79f6.zip | |
Fixes lp821144
Revert resize broken because an incorrect number of parameters and a bad call at the virt layer
| -rw-r--r-- | nova/compute/manager.py | 3 | ||||
| -rw-r--r-- | nova/tests/test_xenapi.py | 47 | ||||
| -rw-r--r-- | nova/virt/xenapi_conn.py | 2 |
3 files changed, 50 insertions, 2 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 9f566dea7..69acf6e95 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -748,7 +748,8 @@ class ComputeManager(manager.SchedulerDependentManager): instance_ref['host']) rpc.cast(context, topic, {'method': 'finish_revert_resize', - 'args': {'migration_id': migration_ref['id']}, + 'args': {'instance_id': instance_ref['uuid'], + 'migration_id': migration_ref['id']}, }) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 39ab23d9b..8048e5341 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -767,6 +767,53 @@ class XenAPIMigrateInstance(test.TestCase): conn = xenapi_conn.get_connection(False) conn.migrate_disk_and_power_off(instance, '127.0.0.1') + + def test_revert_migrate(self): + instance = db.instance_create(self.context, self.values) + self.called = False + self.fake_vm_start_called = False + self.fake_revert_migration_called = False + + def fake_vm_start(*args, **kwargs): + self.fake_vm_start_called = True + + def fake_vdi_resize(*args, **kwargs): + self.called = True + + def fake_revert_migration(*args, **kwargs): + self.fake_revert_migration_called = True + + self.stubs.Set(stubs.FakeSessionForMigrationTests, + "VDI_resize_online", fake_vdi_resize) + self.stubs.Set(vmops.VMOps, '_start', fake_vm_start) + self.stubs.Set(vmops.VMOps, 'revert_migration', fake_revert_migration) + + stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests) + stubs.stubout_loopingcall_start(self.stubs) + conn = xenapi_conn.get_connection(False) + network_info = [({'bridge': 'fa0', 'id': 0, 'injected': False}, + {'broadcast': '192.168.0.255', + 'dns': ['192.168.0.1'], + 'gateway': '192.168.0.1', + 'gateway6': 'dead:beef::1', + 'ip6s': [{'enabled': '1', + 'ip': 'dead:beef::dcad:beff:feef:0', + 'netmask': '64'}], + 'ips': [{'enabled': '1', + 'ip': '192.168.0.100', + 'netmask': '255.255.255.0'}], + 'label': 'fake', + 'mac': 'DE:AD:BE:EF:00:00', + 'rxtx_cap': 3})] + conn.finish_migration(self.context, instance, + dict(base_copy='hurr', cow='durr'), + network_info, resize_instance=True) + self.assertEqual(self.called, True) + self.assertEqual(self.fake_vm_start_called, True) + + conn.revert_migration(instance) + self.assertEqual(self.fake_revert_migration_called, True) + def test_finish_migrate(self): instance = db.instance_create(self.context, self.values) self.called = False diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py index f63f9707e..49ae2623e 100644 --- a/nova/virt/xenapi_conn.py +++ b/nova/virt/xenapi_conn.py @@ -191,7 +191,7 @@ class XenAPIConnection(driver.ComputeDriver): def revert_migration(self, instance): """Reverts a resize, powering back on the instance""" - self._vmops.revert_resize(instance) + self._vmops.revert_migration(instance) def finish_migration(self, context, instance, disk_info, network_info, resize_instance=False): |
