diff options
author | Alvaro Lopez <aloga@ifca.unican.es> | 2011-11-09 16:18:39 +0100 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2011-12-08 12:08:26 +0000 |
commit | 60cb0496c25f71d748bc8634cc13c8614d970df1 (patch) | |
tree | 0d5a9a782e71f7aacc30f9c8db366ac1267870bb | |
parent | 1e3b88ba20b9f9ab925ecd1238845adbc0157cb1 (diff) | |
download | nova-60cb0496c25f71d748bc8634cc13c8614d970df1.tar.gz |
Fixes bug 871877
Added an aditional testunit to the VlanNetworkTestCase to check
if the FixedIpNotFoundForNetwork exception is raised properly.
(cherry picked from commit 6e7b0387e417e4ef36b8ce1e0b7a7db32732838d)
Change-Id: I92a0ca22aadcfa9a7fd434375e239be8ccf4f387
-rw-r--r-- | Authors | 1 | ||||
-rw-r--r-- | nova/network/manager.py | 1 | ||||
-rw-r--r-- | nova/tests/test_network.py | 14 |
3 files changed, 16 insertions, 0 deletions
@@ -4,6 +4,7 @@ Adam Johnson <adjohn@gmail.com> Ahmad Hassan <ahmad.hassan@hp.com> Alex Meade <alex.meade@rackspace.com> Alexander Sakhnov <asakhnov@mirantis.com> +Alvaro Lopez Garcia <aloga@ifca.unican.es> Andrey Brindeyev <abrindeyev@griddynamics.com> Andy Smith <code@term.ie> Andy Southgate <andy.southgate@citrix.com> diff --git a/nova/network/manager.py b/nova/network/manager.py index 4fa4d475df..b0befabab4 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -1025,6 +1025,7 @@ class VlanManager(RPCAllocateFixedIP, FloatingIP, NetworkManager): self.db.fixed_ip_associate(context, address, instance_id, + network['id'], reserved=True) else: address = kwargs.get('address', None) diff --git a/nova/tests/test_network.py b/nova/tests/test_network.py index 32502eafa9..f7aa684a0e 100644 --- a/nova/tests/test_network.py +++ b/nova/tests/test_network.py @@ -309,6 +309,7 @@ class VlanNetworkTestCase(test.TestCase): db.fixed_ip_associate(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(), + mox.IgnoreArg(), reserved=True).AndReturn('192.168.0.1') db.fixed_ip_update(mox.IgnoreArg(), mox.IgnoreArg(), @@ -321,6 +322,19 @@ class VlanNetworkTestCase(test.TestCase): network['vpn_private_address'] = '192.168.0.2' self.network.allocate_fixed_ip(None, 0, network, vpn=True) + def test_vpn_allocate_fixed_ip_no_network_id(self): + network = dict(networks[0]) + network['vpn_private_address'] = '192.168.0.2' + network['id'] = None + context_admin = context.RequestContext('testuser', 'testproject', + is_admin=True) + self.assertRaises(exception.FixedIpNotFoundForNetwork, + self.network.allocate_fixed_ip, + context_admin, + 0, + network, + vpn=True) + def test_allocate_fixed_ip(self): self.mox.StubOutWithMock(db, 'fixed_ip_associate_pool') self.mox.StubOutWithMock(db, 'fixed_ip_update') |