Merge pull request #69 from openstack-charmers/fix_mac_keyerror

add tenacity with backoff to configure ext dataport method
This commit is contained in:
Liam Young
2019-09-30 12:09:39 +01:00
committed by GitHub
+14 -1
View File
@@ -610,7 +610,7 @@ def configure_gateway_ext_port(novaclient, neutronclient,
net_id=None, fixed_ip=None)
if add_dataport_to_netplan:
add_interface_to_netplan(server.name,
mac_address=port['mac_address'],
mac_address=get_mac_from_port(port),
dvr_mode=dvr_mode)
ext_br_macs = []
for port in neutronclient.list_ports(network_id=net_id)['ports']:
@@ -640,6 +640,19 @@ def configure_gateway_ext_port(novaclient, neutronclient,
juju_wait.wait(wait_for_workload=True)
@tenacity.retry(wait=tenacity.wait_exponential(multiplier=1, max=60),
reraise=True, retry=tenacity.retry_if_exception_type(KeyError))
def get_mac_from_port(port):
"""Get mac address from port, with tenacity due to openstack async.
:param port: neutron port
:type port: neutron port
:returns: mac address
:rtype: string
"""
return port['mac_address']
def create_project_network(neutron_client, project_id, net_name='private',
shared=False, network_type='gre', domain=None):
"""Create the project network.