Merge pull request #241 from FirmlyReality/master

add usrgws when user has been existed
This commit is contained in:
Yujian Zhu 2017-05-16 15:32:15 +08:00 committed by GitHub
commit 27df72e59e
2 changed files with 3 additions and 5 deletions

View File

@ -544,11 +544,6 @@ class NetworkMgr(object):
def has_user(self, username):
[status, _value] = self.etcd.getkey("network/users/"+username)
if status:
self.load_usrgw(username)
if username not in self.usrgws.keys():
self.usrgws[username] = self.masterip
self.dump_usrgw(username)
return status
def acquire_userips(self, username, num=1):

View File

@ -99,6 +99,9 @@ class VclusterMgr(object):
[success,message] = self.networkmgr.setup_usrgw(username, self.nodemgr)
if not success:
return [False, message]
elif not self.networkmgr.has_usrgw(username):
self.networkmgr.usrgws[username] = self.networkmgr.masterip
self.networkmgr.dump_usrgw(username)
[status, result] = self.networkmgr.acquire_userips_cidr(username, clustersize)
gateway = self.networkmgr.get_usergw(username)
vlanid = self.networkmgr.get_uservlanid(username)