Fix a bug that remove gre when recovering usernet

This commit is contained in:
zhuyj17 2017-05-22 17:21:06 +08:00
parent 221db0c1b0
commit fd3faee093
1 changed files with 5 additions and 5 deletions

View File

@ -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)