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
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index cd36f38..3dd8fdc 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -816,15 +816,18 @@
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)