Skip to content

Commit

Permalink
Fix double veth create (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
phudtran authored Mar 4, 2022
1 parent 397924e commit 9772e47
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions mizar/daemon/interface_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,18 @@ def _CreateVethInterface(self, interface):
veth_index = get_iface_index(veth_name, self.iproute)

if veth_index == -1:
logger.info("Creating interface {}".format(veth_name))
self.iproute.link('add', ifname=veth_name,
peer=veth_peer, kind='veth')
try:
logger.info("Creating interface {}".format(veth_name))
self.iproute.link('add', ifname=veth_name,
peer=veth_peer, kind='veth')
except Exception as e:
if e.code == CONSTANTS.NETLINK_FILE_EXISTS_ERROR:
logger.info("Veth already exists! Continuing")
pass

else:
logger.info(
"Unknown exception occured when creating veth {}".format(e))
veth_index = get_iface_index(veth_name, self.iproute)
else:
logger.info("Interface {} already exists!".format(veth_name))
Expand Down Expand Up @@ -179,7 +188,8 @@ def _ConfigureTransitAgent(self, interface):
Load the Transit Agent XDP program, program all the bouncer substrate,
update the agent metadata and endpoint.
"""
logger.info("Loading transit agent.")
pod_name = get_pod_name(interface.interface_id.pod_id)
logger.info("Loading transit agent and configuring for pod {}".format(pod_name))
self.rpc.load_transit_agent_xdp(interface)

for bouncer in interface.bouncers:
Expand Down

0 comments on commit 9772e47

Please sign in to comment.