Add iptables and listening sockets to debug info
The method "_log_local_network_status", used to print the system information in case of error, is improved with new information: - The local namespace iptables - The local namespace listening sockets This information could provide the needed info to investigate the problem, related in the referred bug, when a VM cannot retrieve the metadata information. Change-Id: Id56743a07267b4b6c03e7b9b295f919668ac07ab Related-Bug: #1923633
This commit is contained in:
parent
d4988c4f32
commit
c134ea944e
@ -383,6 +383,23 @@ def arp_table(namespace=None):
|
||||
return arp_table
|
||||
|
||||
|
||||
def list_iptables(version=constants.IP_VERSION_4, namespace=None):
|
||||
cmd = ''
|
||||
if namespace:
|
||||
cmd = 'sudo ip netns exec %s ' % namespace
|
||||
cmd += ('iptables-save' if version == constants.IP_VERSION_4 else
|
||||
'ip6tables-save')
|
||||
return shell.execute(cmd).stdout
|
||||
|
||||
|
||||
def list_listening_sockets(namespace=None):
|
||||
cmd = ''
|
||||
if namespace:
|
||||
cmd = 'sudo ip netns exec %s ' % namespace
|
||||
cmd += 'netstat -nlp'
|
||||
return shell.execute(cmd).stdout
|
||||
|
||||
|
||||
class Route(HasProperties,
|
||||
collections.namedtuple('Route',
|
||||
['dest', 'properties'])):
|
||||
|
@ -325,7 +325,9 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
try:
|
||||
local_ips = ip_utils.IPCommand(namespace=ns_name).list_addresses()
|
||||
local_routes = ip_utils.IPCommand(namespace=ns_name).list_routes()
|
||||
arp_table = ip_utils.arp_table()
|
||||
arp_table = ip_utils.arp_table(namespace=ns_name)
|
||||
iptables = ip_utils.list_iptables(namespace=ns_name)
|
||||
lsockets = ip_utils.list_listening_sockets(namespace=ns_name)
|
||||
except exceptions.ShellCommandFailed:
|
||||
LOG.debug('Namespace %s has been deleted synchronously during the '
|
||||
'host network collection process', ns_name)
|
||||
@ -337,6 +339,8 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
ns_name, '\n'.join(str(r) for r in local_routes))
|
||||
LOG.debug('Namespace %s; Local ARP table:\n%s',
|
||||
ns_name, '\n'.join(str(r) for r in arp_table))
|
||||
LOG.debug('Namespace %s; Local iptables:\n%s', ns_name, iptables)
|
||||
LOG.debug('Namespace %s; Listening sockets:\n%s', ns_name, lsockets)
|
||||
|
||||
def _check_remote_connectivity(self, source, dest, count,
|
||||
should_succeed=True,
|
||||
|
Loading…
x
Reference in New Issue
Block a user