diff options
| -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 dbd82a6b2..78f2296ba 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -665,11 +665,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" @@ -698,11 +700,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 698ce8f59..82168b00e 100644 --- a/nova/tests/network/test_manager.py +++ b/nova/tests/network/test_manager.py @@ -1666,11 +1666,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) @@ -1704,11 +1707,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) |
