Display the vip name in the floating IP association dialog
When LBaaS vips are defined, the floating IP association dialog used to display them with their IP and the name "None". Now, the name of the vip is used. Closes-bug: 1401954 Change-Id: I3e26dc84d0af9f226f1e1fc915c04c4089cf7c93
This commit is contained in:
parent
926fa00073
commit
1e2570f208
|
@ -423,6 +423,14 @@ class FloatingIpManager(network_base.FloatingIpManager):
|
|||
servers, has_more = nova.server_list(self.request)
|
||||
server_dict = SortedDict([(s.id, s.name) for s in servers])
|
||||
reachable_subnets = self._get_reachable_subnets(ports)
|
||||
if is_service_enabled(self.request,
|
||||
config_name='enable_lb',
|
||||
ext_name='lbaas'):
|
||||
# Also get the loadbalancer VIPs
|
||||
vip_dict = {v['port_id']: v['name']
|
||||
for v in self.client.list_vips().get('vips', [])}
|
||||
else:
|
||||
vip_dict = {}
|
||||
|
||||
targets = []
|
||||
for p in ports:
|
||||
|
@ -430,7 +438,8 @@ class FloatingIpManager(network_base.FloatingIpManager):
|
|||
if p.device_owner.startswith('network:'):
|
||||
continue
|
||||
port_id = p.id
|
||||
server_name = server_dict.get(p.device_id)
|
||||
server_name = server_dict.get(p.device_id) or vip_dict.get(port_id)
|
||||
|
||||
for ip in p.fixed_ips:
|
||||
if ip['subnet_id'] not in reachable_subnets:
|
||||
continue
|
||||
|
|
|
@ -688,6 +688,7 @@ class NetworkApiNeutronFloatingIpTests(NetworkApiNeutronTestBase):
|
|||
'addr': port['fixed_ips'][0]['ip_address']}
|
||||
return 'server_%(svrid)s: %(addr)s' % param
|
||||
|
||||
@override_settings(OPENSTACK_NEUTRON_NETWORK={'enable_lb': True})
|
||||
def test_floating_ip_target_list(self):
|
||||
ports = self.api_ports.list()
|
||||
# Port on the first subnet is connected to a router
|
||||
|
@ -714,6 +715,8 @@ class NetworkApiNeutronFloatingIpTests(NetworkApiNeutronTestBase):
|
|||
self.qclient.list_routers().AndReturn({'routers':
|
||||
self.api_routers.list()})
|
||||
|
||||
self.qclient.list_vips().AndReturn({'vips': self.vips.list()})
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
rets = api.network.floating_ip_target_list(self.request)
|
||||
|
|
|
@ -658,11 +658,15 @@ def data(TEST):
|
|||
extension_5 = {"name": "HA Router extension",
|
||||
"alias": "l3-ha",
|
||||
"description": "Add HA capability to routers."}
|
||||
extension_6 = {"name": "LoadBalancing service",
|
||||
"alias": "lbaas",
|
||||
"description": "Extension for LoadBalancing service"}
|
||||
TEST.api_extensions.add(extension_1)
|
||||
TEST.api_extensions.add(extension_2)
|
||||
TEST.api_extensions.add(extension_3)
|
||||
TEST.api_extensions.add(extension_4)
|
||||
TEST.api_extensions.add(extension_5)
|
||||
TEST.api_extensions.add(extension_6)
|
||||
|
||||
# 1st agent.
|
||||
agent_dict = {"binary": "neutron-openvswitch-agent",
|
||||
|
|
Loading…
Reference in New Issue