remove vlanid in usergw
This commit is contained in:
parent
9839097b5c
commit
e8269cc756
|
@ -250,8 +250,8 @@ class netcontrol(object):
|
|||
return ovscontrol.port_exists(gwport)
|
||||
|
||||
@staticmethod
|
||||
def setup_gw(bridge, gwport, addr, tag):
|
||||
[status, result] = ovscontrol.add_port_internal_withtag(bridge, gwport, tag)
|
||||
def setup_gw(bridge, gwport, addr):
|
||||
[status, result] = ovscontrol.add_port_internal(bridge, gwport)
|
||||
if not status:
|
||||
return [status, result]
|
||||
[status, result] = ipcontrol.add_addr(gwport, addr)
|
||||
|
@ -264,10 +264,10 @@ class netcontrol(object):
|
|||
return ovscontrol.del_port(bridge, gwport)
|
||||
|
||||
@staticmethod
|
||||
def check_gw(bridge, gwport, uid, addr, tag):
|
||||
def check_gw(bridge, gwport, uid, addr):
|
||||
ovscontrol.add_bridge(bridge)
|
||||
if not netcontrol.gw_exists(bridge, gwport):
|
||||
return netcontrol.setup_gw(bridge, gwport, addr, tag)
|
||||
return netcontrol.setup_gw(bridge, gwport, addr)
|
||||
[status, info] = ipcontrol.link_info(gwport)
|
||||
if not status:
|
||||
return [False, "get gateway info failed"]
|
||||
|
|
|
@ -450,7 +450,7 @@ class NetworkMgr(object):
|
|||
self.load_usrgw(username)
|
||||
return username in self.usrgws.keys()
|
||||
|
||||
def setup_usrgw(self, username, nodemgr, workerip=None):
|
||||
def setup_usrgw(self, username, uid, nodemgr, workerip=None):
|
||||
if not self.has_user(username):
|
||||
return [False,"user doesn't exist."]
|
||||
self.load_usrgw(username)
|
||||
|
@ -464,12 +464,12 @@ class NetworkMgr(object):
|
|||
logger.info("setup gateway for %s with %s and vlan=%s on %s" % (username, usrpools.get_gateway_cidr(), str(usrpools.vlanid), ip))
|
||||
self.usrgws[username] = ip
|
||||
self.dump_usrgw(username)
|
||||
worker.setup_gw('docklet-br', username, usrpools.get_gateway_cidr(), str(usrpools.vlanid))
|
||||
worker.setup_gw('docklet-br-'+str(uid), username, usrpools.get_gateway_cidr())
|
||||
else:
|
||||
logger.info("setup gateway for %s with %s and vlan=%s on master" % (username, usrpools.get_gateway_cidr(), str(usrpools.vlanid)))
|
||||
self.usrgws[username] = self.masterip
|
||||
self.dump_usrgw(username)
|
||||
netcontrol.setup_gw('docklet-br', username, usrpools.get_gateway_cidr(), str(usrpools.vlanid))
|
||||
netcontrol.setup_gw('docklet-br-'+str(uid), username, usrpools.get_gateway_cidr())
|
||||
self.dump_user(username)
|
||||
del self.users[username]
|
||||
return [True, "set up gateway success"]
|
||||
|
@ -535,10 +535,10 @@ class NetworkMgr(object):
|
|||
self.del_usrgw(username,nodemgr)
|
||||
self.usrgws[username] = self.masterip
|
||||
self.dump_usrgw(username)
|
||||
netcontrol.check_gw('docklet-br-'+str(uid), username, uid, self.users[username].get_gateway_cidr(), str(self.users[username].vlanid))
|
||||
netcontrol.check_gw('docklet-br-'+str(uid), username, uid, self.users[username].get_gateway_cidr())
|
||||
else:
|
||||
worker = nodemgr.ip_to_rpc(ip)
|
||||
worker.check_gw('docklet-br-'+str(uid), username, uid, self.users[username].get_gateway_cidr(), str(self.users[username].vlanid))
|
||||
worker.check_gw('docklet-br-'+str(uid), username, uid, self.users[username].get_gateway_cidr())
|
||||
del self.users[username]
|
||||
return [True, 'check gw ok']
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class VclusterMgr(object):
|
|||
if not self.networkmgr.has_user(username):
|
||||
self.networkmgr.add_user(username, cidr=29, isshared = True if str(groupname) == "fundation" else False)
|
||||
if self.distributedgw == "False":
|
||||
[success,message] = self.networkmgr.setup_usrgw(username, self.nodemgr)
|
||||
[success,message] = self.networkmgr.setup_usrgw(username, uid, self.nodemgr)
|
||||
if not success:
|
||||
return [False, message]
|
||||
[status, result] = self.networkmgr.acquire_userips_cidr(username, clustersize)
|
||||
|
@ -125,7 +125,7 @@ class VclusterMgr(object):
|
|||
workerip = workers[random.randint(0, len(workers)-1)]
|
||||
oneworker = xmlrpc.client.ServerProxy("http://%s:%s" % (workerip, env.getenv("WORKER_PORT")))
|
||||
if self.distributedgw == "True" and i == 0 and not self.networkmgr.has_usrgw(username):
|
||||
[success,message] = self.networkmgr.setup_usrgw(username, self.nodemgr, workerip)
|
||||
[success,message] = self.networkmgr.setup_usrgw(username, uid, self.nodemgr, workerip)
|
||||
if not success:
|
||||
return [False, message]
|
||||
if i == 0:
|
||||
|
|
Loading…
Reference in New Issue