|
|
|
@ -145,10 +145,18 @@ def create_endpoint():
|
|
|
|
|
.set('state', 'up')
|
|
|
|
|
.commit())
|
|
|
|
|
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
try:
|
|
|
|
|
start = time.time()
|
|
|
|
|
while isinstance(if_container, str) and time.time() - start < 10:
|
|
|
|
|
try:
|
|
|
|
|
if_container = (ndb.interfaces[if_container]
|
|
|
|
|
.set('state', 'up')
|
|
|
|
|
.commit())
|
|
|
|
|
except KeyError:
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
if isinstance(if_container, str):
|
|
|
|
|
raise NetDhcpError(f'timed out waiting for {if_container} to appear in host')
|
|
|
|
|
|
|
|
|
|
(bridge
|
|
|
|
|
.add_port(if_host)
|
|
|
|
|
.commit())
|
|
|
|
@ -159,7 +167,6 @@ def create_endpoint():
|
|
|
|
|
'AddressIPv6': ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
if 'MacAddress' in req_iface and req_iface['MacAddress']:
|
|
|
|
|
(if_container
|
|
|
|
|
.set('address', req_iface['MacAddress'])
|
|
|
|
@ -199,6 +206,7 @@ def create_endpoint():
|
|
|
|
|
except Exception as e:
|
|
|
|
|
logger.exception(e)
|
|
|
|
|
|
|
|
|
|
if not isinstance(if_container, str):
|
|
|
|
|
(bridge
|
|
|
|
|
.del_port(if_host)
|
|
|
|
|
.commit())
|
|
|
|
|