diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2012-11-02 06:52:36 +0000 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2012-11-15 05:26:28 -0500 |
| commit | 543d22ebe9105f391bb90c8da23e814bc8f3369f (patch) | |
| tree | d4999a3517b6cc7c8e95e5f08ca0c2e3d5d13a15 /nova | |
| parent | 41e87bbfc5ecaf1731d0741c3b235adc215f476c (diff) | |
| download | nova-543d22ebe9105f391bb90c8da23e814bc8f3369f.tar.gz nova-543d22ebe9105f391bb90c8da23e814bc8f3369f.tar.xz nova-543d22ebe9105f391bb90c8da23e814bc8f3369f.zip | |
Fix network RPC API backwards compat
Commit d96102b6 bumped the RPC API version, but didn't handle backwards
compatibility correctly.
We need to retain support for the old 1.1 clients passing the original
set of kwargs - we can't rename kwargs, nor can we make new kwargs
required.
Change-Id: I083e0fa156e9d30fa51a500ed3d5a8ebb7c8eac8
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/network/manager.py | 30 | ||||
| -rw-r--r-- | nova/tests/network/test_manager.py | 26 |
2 files changed, 36 insertions, 20 deletions
diff --git a/nova/network/manager.py b/nova/network/manager.py index a944ebd40..9fbdec6ee 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -663,11 +663,13 @@ class FloatingIP(object): return False if floating_ip.get('fixed_ip_id') else True @wrap_check_policy - def migrate_instance_start(self, context, instance_uuid, rxtx_factor, - project_id, source, dest, floating_addresses): + def migrate_instance_start(self, context, instance_uuid, + floating_addresses, + rxtx_factor=None, project_id=None, + source=None, dest=None): # We only care if floating_addresses are provided and we're # switching hosts - if not floating_addresses or source == dest: + if not floating_addresses or (source and source == dest): return LOG.info(_("Starting migration network for instance" @@ -696,11 +698,15 @@ class FloatingIP(object): {'host': None}) @wrap_check_policy - def migrate_instance_finish(self, context, instance_uuid, rxtx_factor, - project_id, source, dest, floating_addresses): + def migrate_instance_finish(self, context, instance_uuid, + floating_addresses, host=None, + rxtx_factor=None, project_id=None, + source=None, dest=None): # We only care if floating_addresses are provided and we're # switching hosts - if not floating_addresses or source == dest: + if host and not dest: + dest = host + if not floating_addresses or (source and source == dest): return LOG.info(_("Finishing migration network for instance" @@ -1954,12 +1960,16 @@ class FlatManager(NetworkManager): """Returns the floating IPs associated with a fixed_address""" return [] - def migrate_instance_start(self, context, instance_uuid, rxtx_factor, - project_id, source, dest, floating_addresses): + def migrate_instance_start(self, context, instance_uuid, + floating_addresses, + rxtx_factor=None, project_id=None, + source=None, dest=None): pass - def migrate_instance_finish(self, context, instance_uuid, rxtx_factor, - project_id, source, dest, floating_addresses): + def migrate_instance_finish(self, context, instance_uuid, + floating_addresses, host=None, + rxtx_factor=None, project_id=None, + source=None, dest=None): pass diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py index 77fccd904..cc67eb08a 100644 --- a/nova/tests/network/test_manager.py +++ b/nova/tests/network/test_manager.py @@ -1665,11 +1665,14 @@ class FloatingIPTestCase(test.TestCase): self.stubs.Set(self.network.l3driver, 'remove_floating_ip', fake_remove_floating_ip) self.mox.ReplayAll() - floating_ip_addresses = ['172.24.4.23', '172.24.4.24', '172.24.4.25'] - self.network.migrate_instance_start(self.context, FAKEUUID, - 3, self.project_id, - 'fake_source', 'fake_dest', - floating_ip_addresses) + addresses = ['172.24.4.23', '172.24.4.24', '172.24.4.25'] + self.network.migrate_instance_start(self.context, + instance_uuid=FAKEUUID, + floating_addresses=addresses, + rxtx_factor=3, + project_id=self.project_id, + source='fake_source', + dest='fake_dest') self.assertEqual(called['count'], 2) @@ -1703,11 +1706,14 @@ class FloatingIPTestCase(test.TestCase): self.stubs.Set(self.network.l3driver, 'add_floating_ip', fake_add_floating_ip) self.mox.ReplayAll() - floating_ip_addresses = ['172.24.4.23', '172.24.4.24', '172.24.4.25'] - self.network.migrate_instance_finish(self.context, FAKEUUID, - 3, self.project_id, - 'fake_source', 'fake_dest', - floating_ip_addresses) + addresses = ['172.24.4.23', '172.24.4.24', '172.24.4.25'] + self.network.migrate_instance_finish(self.context, + instance_uuid=FAKEUUID, + floating_addresses=addresses, + host='fake_dest', + rxtx_factor=3, + project_id=self.project_id, + source='fake_source') self.assertEqual(called['count'], 2) |
