summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/network/manager.py8
-rw-r--r--nova/tests/network/test_manager.py13
2 files changed, 17 insertions, 4 deletions
diff --git a/nova/network/manager.py b/nova/network/manager.py
index 0e652c610..621744f6c 100644
--- a/nova/network/manager.py
+++ b/nova/network/manager.py
@@ -293,10 +293,10 @@ class FloatingIP(object):
LOG.debug(msg)
continue
fixed_address = fixed_ip_ref['address']
- interface = floating_ip['interface']
+ interface = FLAGS.public_interface or floating_ip['interface']
try:
self.l3driver.add_floating_ip(floating_ip['address'],
- fixed_address, floating_ip['interface'])
+ fixed_address, interface)
except exception.ProcessExecutionError:
LOG.debug(_('Interface %(interface)s not found'), locals())
raise exception.NoFloatingIpInterface(interface=interface)
@@ -476,7 +476,7 @@ class FloatingIP(object):
else:
host = network['host']
- interface = floating_ip['interface']
+ interface = FLAGS.public_interface or floating_ip['interface']
if host == self.host:
# i'm the correct host
self._associate_floating_ip(context, floating_address,
@@ -547,7 +547,7 @@ class FloatingIP(object):
else:
host = network['host']
- interface = floating_ip['interface']
+ interface = FLAGS.public_interface or floating_ip['interface']
if host == self.host:
# i'm the correct host
self._disassociate_floating_ip(context, address, interface)
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py
index de8779be1..da892eddd 100644
--- a/nova/tests/network/test_manager.py
+++ b/nova/tests/network/test_manager.py
@@ -716,11 +716,24 @@ class VlanNetworkTestCase(test.TestCase):
self.stubs.Set(self.network.db, 'fixed_ip_get', fixed_ip_get)
self.mox.StubOutWithMock(self.network.l3driver, 'add_floating_ip')
+ self.flags(public_interface=False)
self.network.l3driver.add_floating_ip('fakefloat',
'fakefixed',
'fakeiface')
self.mox.ReplayAll()
self.network.init_host_floating_ips()
+ self.mox.UnsetStubs()
+ self.mox.VerifyAll()
+
+ self.mox.StubOutWithMock(self.network.l3driver, 'add_floating_ip')
+ self.flags(public_interface='fooiface')
+ self.network.l3driver.add_floating_ip('fakefloat',
+ 'fakefixed',
+ 'fooiface')
+ self.mox.ReplayAll()
+ self.network.init_host_floating_ips()
+ self.mox.UnsetStubs()
+ self.mox.VerifyAll()
def test_disassociate_floating_ip(self):
ctxt = context.RequestContext('testuser', 'testproject',