Disable neutron inventory src if no ctlplane ports
ctlplane ports created by THT Heat Server resources, or nova less without --network-ports/--network-config enabled, does not have the 'tripleo_stack_name' tag. We shouldn't use neutron as a source if no ctlplane ports are tagged with the 'tripleo_stack_name'. This patch add's a check for to ensure atleast 1 port is in the ctlplane network. If no such port is found _get_neutron_data returns None, and the inventory generation will continue to use the heat stack as the source. Also filter "tripleo_service_vip" and "tripleo_vip_net" ports when getting the ports so that the test doesn't match on a control plane virtual IP. Closes-Bug: #1928926 Change-Id: Ida1cc17ae6b9adf4275e0616706158bfc3b93204
This commit is contained in:
parent
86ba5af3a7
commit
5d6649fc9d
|
@ -129,7 +129,6 @@ class NeutronData(object):
|
|||
|
||||
def _ports_by_role_and_host(self):
|
||||
mandatory_tags = {'tripleo_role'}
|
||||
ignore_tags = {'tripleo_vip_net', 'tripleo_service_vip'}
|
||||
|
||||
ports_by_role_and_host = {}
|
||||
for port in self.ports:
|
||||
|
@ -138,9 +137,6 @@ class NeutronData(object):
|
|||
continue
|
||||
|
||||
tags = self._tags_to_dict(port.tags)
|
||||
# Ignore non host ports by looking for the tags
|
||||
if ignore_tags.intersection(tags):
|
||||
continue
|
||||
|
||||
# In case of missing required tags, raise an error.
|
||||
# neutron is useless as a inventory source in this case.
|
||||
|
@ -488,6 +484,26 @@ class TripleoInventory(object):
|
|||
if not ports:
|
||||
return None
|
||||
|
||||
# Filter tripleo_service_vip and tripleo_vip_net ports
|
||||
ports = [p for p in ports
|
||||
if not any("tripleo_service_vip" in tag for tag in p.tags)
|
||||
and not any("tripleo_vip_net" in tag for tag in p.tags)]
|
||||
|
||||
# NOTE(hjensas): ctlplane ports created by THT Heat Server
|
||||
# resources, or nova less without --network-ports/--network-config
|
||||
# enabled, does not have the 'tripleo_stack_name' tag. We
|
||||
# shouldn't use neutron as a source if no ctlplane ports are
|
||||
# tagged with the 'tripleo_stack_name'.
|
||||
# See bug: https://bugs.launchpad.net/tripleo/+bug/1928926
|
||||
found_ctlplane_port = False
|
||||
ctlplane_net = conn.network.find_network(self.host_network)
|
||||
for p in ports:
|
||||
if p.network_id == ctlplane_net.id:
|
||||
found_ctlplane_port = True
|
||||
break
|
||||
if not found_ctlplane_port:
|
||||
return None
|
||||
|
||||
networks = [conn.network.find_network(p.network_id)
|
||||
for p in ports]
|
||||
subnets = []
|
||||
|
|
Loading…
Reference in New Issue