Emit warning when instances have ports not ACTIVE

This changes the tempest logic to request all ports rather than
just ACTIVE ports for a server and then filters them locally so
we can log an warning message when a server has ports not in the
ACTIVE state. This will help debug cases in the future where the
Neutron port status is in an unstable state due to agent wiring
errors.

Change-Id: I979a06688a5dfecaaef5e7e4a85cb8494095c754
Closes-Bug: #1523638
This commit is contained in:
Kevin Benton 2016-02-04 14:30:08 -08:00
parent 6ce9ef6d8a
commit 1d0c1dca74
1 changed files with 6 additions and 3 deletions

View File

@ -816,15 +816,18 @@ class NetworkScenarioTest(ScenarioTest):
return port
def _get_server_port_id_and_ip4(self, server, ip_addr=None):
ports = self._list_ports(device_id=server['id'], status='ACTIVE',
fixed_ip=ip_addr)
ports = self._list_ports(device_id=server['id'], fixed_ip=ip_addr)
# A port can have more then one IP address in some cases.
# If the network is dual-stack (IPv4 + IPv6), this port is associated
# with 2 subnets
port_map = [(p["id"], fxip["ip_address"])
for p in ports
for fxip in p["fixed_ips"]
if netaddr.valid_ipv4(fxip["ip_address"])]
if netaddr.valid_ipv4(fxip["ip_address"])
and p['status'] == 'ACTIVE']
inactive = [p for p in ports if p['status'] != 'ACTIVE']
if inactive:
LOG.warning("Instance has ports that are not ACTIVE: %s", inactive)
self.assertNotEqual(0, len(port_map),
"No IPv4 addresses found in: %s" % ports)