Browse Source

Merge "Wait couple of seconds for dns servers to be set in the guest"

changes/88/802388/5
Zuul 2 months ago
committed by Gerrit Code Review
parent
commit
027a27c65d
  1. 15
      tempest/common/utils/linux/remote_client.py

15
tempest/common/utils/linux/remote_client.py

@ -108,7 +108,7 @@ class RemoteClient(remote_client.RemoteClient):
LOG.debug('(get_nic_name_by_ip) Command result: %s', nic)
return nic.strip().strip(":").split('@')[0].lower()
def get_dns_servers(self):
def _get_dns_servers(self):
cmd = 'cat /etc/resolv.conf'
resolve_file = self.exec_command(cmd).strip().split('\n')
entries = (l.split() for l in resolve_file)
@ -116,6 +116,19 @@ class RemoteClient(remote_client.RemoteClient):
if len(l) and l[0] == 'nameserver']
return dns_servers
def get_dns_servers(self, timeout=5):
start_time = int(time.time())
dns_servers = []
while True:
dns_servers = self._get_dns_servers()
if dns_servers:
break
LOG.debug("DNS Servers list empty.")
if int(time.time()) - start_time >= timeout:
LOG.debug("DNS Servers list empty after %s.", timeout)
break
return dns_servers
def _renew_lease_udhcpc(self, fixed_ip=None):
"""Renews DHCP lease via udhcpc client. """
file_path = '/var/run/udhcpc.'

Loading…
Cancel
Save