Merge "fix bug 992008, we should config public interface on compute"

This commit is contained in:
Jenkins 2012-05-11 22:04:13 +00:00 committed by Gerrit Code Review
commit cd04e9e284
2 changed files with 17 additions and 4 deletions

View File

@ -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)

View File

@ -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',