diff options
author | Frederic Lepied <frederic.lepied@enovance.com> | 2013-01-28 22:16:54 +0100 |
---|---|---|
committer | Frederic Lepied <frederic.lepied@enovance.com> | 2013-02-13 16:56:02 +0100 |
commit | 5640dab952b13a4ff7864a74d103e3d14b736b9e (patch) | |
tree | 44bb77d3924194f39833d9eeedbb1dcacf3da442 | |
parent | 635faddd3744179b0b87666c08e50b97366bfe3e (diff) | |
download | nova-5640dab952b13a4ff7864a74d103e3d14b736b9e.tar.gz nova-5640dab952b13a4ff7864a74d103e3d14b736b9e.tar.xz nova-5640dab952b13a4ff7864a74d103e3d14b736b9e.zip |
Stub additional FloatingIP methods in FlatManager
Fixes bug #989746.
Added some stub methods for floating ip allocation in FlatManager in
order to prevent exceptions from being raised when they are called.
Changed get_floating_ip_by_address() in FlatManager to return a dict
with expected keys for a floating ip, rather than None.
Updated patch from Andrew Laski and added unit tests.
Change-Id: I4ee1f5cf986b6f3411605aae5c1bc4e8cc2377b1
-rw-r--r-- | nova/network/manager.py | 31 | ||||
-rw-r--r-- | nova/tests/network/test_manager.py | 17 |
2 files changed, 48 insertions, 0 deletions
diff --git a/nova/network/manager.py b/nova/network/manager.py index 92d016717..50e03c5e2 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -1465,6 +1465,37 @@ class FlatManager(NetworkManager): # we major version the network_rpcapi to 2.0. return [] + @network_api.wrap_check_policy + def allocate_floating_ip(self, context, project_id, pool): + """Gets a floating ip from the pool.""" + return None + + @network_api.wrap_check_policy + def deallocate_floating_ip(self, context, address, + affect_auto_assigned): + """Returns a floating ip to the pool.""" + return None + + @network_api.wrap_check_policy + def associate_floating_ip(self, context, floating_address, fixed_address, + affect_auto_assigned=False): + """Associates a floating ip with a fixed ip. + + Makes sure everything makes sense then calls _associate_floating_ip, + rpc'ing to correct host if i'm not it. + """ + return None + + @network_api.wrap_check_policy + def disassociate_floating_ip(self, context, address, + affect_auto_assigned=False): + """Disassociates a floating ip from its fixed ip. + + Makes sure everything makes sense then calls _disassociate_floating_ip, + rpc'ing to correct host if i'm not it. + """ + return None + def migrate_instance_start(self, context, instance_uuid, floating_addresses, rxtx_factor=None, project_id=None, diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py index 3728dd2e0..2068f9c00 100644 --- a/nova/tests/network/test_manager.py +++ b/nova/tests/network/test_manager.py @@ -442,6 +442,23 @@ class FlatNetworkTestCase(test.TestCase): self.assertEqual(len(addresses), 1) self.assertEqual(addresses[0], fixedip) + def test_allocate_floating_ip(self): + self.assertEqual(self.network.allocate_floating_ip(self.context, + 1, None), None) + + def test_deallocate_floating_ip(self): + self.assertEqual(self.network.deallocate_floating_ip(self.context, + 1, None), None) + + def test_associate_floating_ip(self): + self.assertEqual(self.network.associate_floating_ip(self.context, + None, None), None) + + def test_disassociate_floating_ip(self): + self.assertEqual(self.network.disassociate_floating_ip(self.context, + None, None), + None) + class VlanNetworkTestCase(test.TestCase): def setUp(self): |