Merge lp:~cerberus/nova/lp821144 into lp:~hudson-openstack/nova/trunk

Proposed by Matt Dietz
Status: Merged
Approved by: Ed Leafe
Approved revision: 1378
Merged at revision: 1381
Proposed branch: lp:~cerberus/nova/lp821144
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 84 lines (+50/-2)
3 files modified
nova/compute/manager.py (+2/-1)
nova/tests/test_xenapi.py (+47/-0)
nova/virt/xenapi_conn.py (+1/-1)
To merge this branch: bzr merge lp:~cerberus/nova/lp821144
Reviewer Review Type Date Requested Status
Ed Leafe (community) Approve
Dan Prince (community) Approve
Johannes Erdfelt (community) Approve
Review via email: mp+70501@code.launchpad.net

Description of the change

Fixes lp821144

Revert resize broken because an incorrect number of parameters and a bad call at the virt layer

To post a comment you must log in.
Revision history for this message
Johannes Erdfelt (johannes.erdfelt) wrote :

Tested and fixes the problems I was having

review: Approve
Revision history for this message
Dan Prince (dan-prince) wrote :

Looks good.

review: Approve
Revision history for this message
Ed Leafe (ed-leafe) wrote :

Still very uncomfortable with the conflation of UUID and integer ID values into the name 'instance_id', but that's a battle for another day. Fixing bugs is more important!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/compute/manager.py'
2--- nova/compute/manager.py 2011-08-04 21:32:56 +0000
3+++ nova/compute/manager.py 2011-08-04 22:21:17 +0000
4@@ -748,7 +748,8 @@
5 instance_ref['host'])
6 rpc.cast(context, topic,
7 {'method': 'finish_revert_resize',
8- 'args': {'migration_id': migration_ref['id']},
9+ 'args': {'instance_id': instance_ref['uuid'],
10+ 'migration_id': migration_ref['id']},
11 })
12
13 @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
14
15=== modified file 'nova/tests/test_xenapi.py'
16--- nova/tests/test_xenapi.py 2011-08-04 21:32:56 +0000
17+++ nova/tests/test_xenapi.py 2011-08-04 22:21:17 +0000
18@@ -767,6 +767,53 @@
19 conn = xenapi_conn.get_connection(False)
20 conn.migrate_disk_and_power_off(instance, '127.0.0.1')
21
22+
23+ def test_revert_migrate(self):
24+ instance = db.instance_create(self.context, self.values)
25+ self.called = False
26+ self.fake_vm_start_called = False
27+ self.fake_revert_migration_called = False
28+
29+ def fake_vm_start(*args, **kwargs):
30+ self.fake_vm_start_called = True
31+
32+ def fake_vdi_resize(*args, **kwargs):
33+ self.called = True
34+
35+ def fake_revert_migration(*args, **kwargs):
36+ self.fake_revert_migration_called = True
37+
38+ self.stubs.Set(stubs.FakeSessionForMigrationTests,
39+ "VDI_resize_online", fake_vdi_resize)
40+ self.stubs.Set(vmops.VMOps, '_start', fake_vm_start)
41+ self.stubs.Set(vmops.VMOps, 'revert_migration', fake_revert_migration)
42+
43+ stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests)
44+ stubs.stubout_loopingcall_start(self.stubs)
45+ conn = xenapi_conn.get_connection(False)
46+ network_info = [({'bridge': 'fa0', 'id': 0, 'injected': False},
47+ {'broadcast': '192.168.0.255',
48+ 'dns': ['192.168.0.1'],
49+ 'gateway': '192.168.0.1',
50+ 'gateway6': 'dead:beef::1',
51+ 'ip6s': [{'enabled': '1',
52+ 'ip': 'dead:beef::dcad:beff:feef:0',
53+ 'netmask': '64'}],
54+ 'ips': [{'enabled': '1',
55+ 'ip': '192.168.0.100',
56+ 'netmask': '255.255.255.0'}],
57+ 'label': 'fake',
58+ 'mac': 'DE:AD:BE:EF:00:00',
59+ 'rxtx_cap': 3})]
60+ conn.finish_migration(self.context, instance,
61+ dict(base_copy='hurr', cow='durr'),
62+ network_info, resize_instance=True)
63+ self.assertEqual(self.called, True)
64+ self.assertEqual(self.fake_vm_start_called, True)
65+
66+ conn.revert_migration(instance)
67+ self.assertEqual(self.fake_revert_migration_called, True)
68+
69 def test_finish_migrate(self):
70 instance = db.instance_create(self.context, self.values)
71 self.called = False
72
73=== modified file 'nova/virt/xenapi_conn.py'
74--- nova/virt/xenapi_conn.py 2011-08-04 21:04:21 +0000
75+++ nova/virt/xenapi_conn.py 2011-08-04 22:21:17 +0000
76@@ -191,7 +191,7 @@
77
78 def revert_migration(self, instance):
79 """Reverts a resize, powering back on the instance"""
80- self._vmops.revert_resize(instance)
81+ self._vmops.revert_migration(instance)
82
83 def finish_migration(self, context, instance, disk_info, network_info,
84 resize_instance=False):