Merge "Prevent raising exception if IP address is set in _hotplug_server"
This commit is contained in:
commit
f9ba3e6625
@ -297,9 +297,19 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||||||
ip_mask = CONF.network.project_network_mask_bits
|
ip_mask = CONF.network.project_network_mask_bits
|
||||||
# check if the address is not already in use, if not, set it
|
# check if the address is not already in use, if not, set it
|
||||||
if ' ' + ip_address + '/' + str(ip_mask) not in ip_output:
|
if ' ' + ip_address + '/' + str(ip_mask) not in ip_output:
|
||||||
ssh_client.exec_command("sudo ip addr add %s/%s dev %s" % (
|
try:
|
||||||
ip_address, ip_mask, new_nic))
|
ssh_client.exec_command("sudo ip addr add %s/%s dev %s" % (
|
||||||
ssh_client.exec_command("sudo ip link set %s up" % new_nic)
|
ip_address, ip_mask, new_nic))
|
||||||
|
ssh_client.exec_command("sudo ip link set %s up" % new_nic)
|
||||||
|
except exceptions.SSHExecCommandFailed as exc:
|
||||||
|
if 'RTNETLINK answers: File exists' in str(exc):
|
||||||
|
LOG.debug(
|
||||||
|
'IP address %(ip_address)s is already set in device '
|
||||||
|
'%(device)s\nPrevious "ip a" output: %(ip_output)s',
|
||||||
|
{'ip_address': ip_address, 'device': new_nic,
|
||||||
|
'ip_output': ip_output})
|
||||||
|
else:
|
||||||
|
raise exc
|
||||||
|
|
||||||
def _get_server_nics(self, ssh_client):
|
def _get_server_nics(self, ssh_client):
|
||||||
reg = re.compile(r'(?P<num>\d+): (?P<nic_name>\w+)[@]?.*:')
|
reg = re.compile(r'(?P<num>\d+): (?P<nic_name>\w+)[@]?.*:')
|
||||||
|
Loading…
Reference in New Issue
Block a user