From fd3faee093d157ca3751b13daf4657eba3fc5fba Mon Sep 17 00:00:00 2001 From: zhuyj17 Date: Mon, 22 May 2017 17:21:06 +0800 Subject: [PATCH] Fix a bug that remove gre when recovering usernet --- src/nettools.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nettools.py b/src/nettools.py index c43ba21..b6c8b35 100755 --- a/src/nettools.py +++ b/src/nettools.py @@ -292,11 +292,11 @@ class netcontrol(object): @staticmethod def recover_usernet(portname, uid, GatewayHost, isGatewayHost): ovscontrol.add_bridge("docklet-br-"+str(uid)) - [success, ports] = ovscontrol.list_ports("docklet-br-"+str(uid)) - if success: - for port in ports: - if port.startswith("gre"): - ovscontrol.del_port("docklet-br-"+str(uid),port) if not isGatewayHost: + [success, ports] = ovscontrol.list_ports("docklet-br-"+str(uid)) + if success: + for port in ports: + if port.startswith("gre") and (not port == ("gre-"+str(uid)+"-"+GatewayHost) ) : + ovscontrol.del_port("docklet-br-"+str(uid),port) ovscontrol.add_port_gre_withkey("docklet-br-"+str(uid), "gre-"+str(uid)+"-"+GatewayHost, GatewayHost, str(uid)) ovscontrol.add_port("docklet-br-"+str(uid), portname)