Skip to content

Commit

Permalink
Merge "Fixes bug 871877"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Nov 10, 2011
2 parents 41b4af1 + 6e7b038 commit 9334893
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions Authors
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions nova/network/manager.py
Expand Up @@ -1217,6 +1217,7 @@ def allocate_fixed_ip(self, context, instance_id, network, **kwargs):
self.db.fixed_ip_associate(context,
address,
instance_id,
network['id'],
reserved=True)
else:
address = kwargs.get('address', None)
Expand Down
14 changes: 14 additions & 0 deletions nova/tests/test_network.py
Expand Up @@ -298,6 +298,7 @@ def test_vpn_allocate_fixed_ip(self):
'virtual_interface_get_by_instance_and_network')

db.fixed_ip_associate(mox.IgnoreArg(),
mox.IgnoreArg(),
mox.IgnoreArg(),
mox.IgnoreArg(),
reserved=True).AndReturn('192.168.0.1')
Expand All @@ -312,6 +313,19 @@ def test_vpn_allocate_fixed_ip(self):
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')
Expand Down

0 comments on commit 9334893

Please sign in to comment.