Use db when start and stop clusters
This commit is contained in:
parent
06dfd80363
commit
05970254a0
|
@ -611,9 +611,10 @@ class VclusterMgr(object):
|
||||||
namesplit = container['containername'].split('-')
|
namesplit = container['containername'].split('-')
|
||||||
portname = namesplit[1] + '-' + namesplit[2]
|
portname = namesplit[1] + '-' + namesplit[2]
|
||||||
worker.recover_usernet(portname, uid, info['proxy_server_ip'], container['host']==info['proxy_server_ip'])
|
worker.recover_usernet(portname, uid, info['proxy_server_ip'], container['host']==info['proxy_server_ip'])
|
||||||
info['status']='running'
|
[status,vcluster] = self.get_vcluster(clustername,username)
|
||||||
info['start_time']=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
vcluster.status ='running'
|
||||||
self.write_clusterinfo(info,clustername,username)
|
vcluster.start_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
db.session.commit()
|
||||||
return [True, "start cluster"]
|
return [True, "start cluster"]
|
||||||
|
|
||||||
def mount_cluster(self, clustername, username):
|
def mount_cluster(self, clustername, username):
|
||||||
|
@ -692,12 +693,10 @@ class VclusterMgr(object):
|
||||||
if worker is None:
|
if worker is None:
|
||||||
return [False, "The worker can't be found or has been stopped."]
|
return [False, "The worker can't be found or has been stopped."]
|
||||||
worker.stop_container(container['containername'])
|
worker.stop_container(container['containername'])
|
||||||
[status, info] = self.get_clusterinfo(clustername, username)
|
[status, vcluster] = self.get_vcluster(clustername, username)
|
||||||
info['status']='stopped'
|
vcluster.status = 'stopped'
|
||||||
info['start_time']="------"
|
vcluster.start_time ="------"
|
||||||
infofile = open(self.fspath+"/global/users/"+username+"/clusters/"+clustername, 'w')
|
db.session.commit()
|
||||||
infofile.write(json.dumps(info))
|
|
||||||
infofile.close()
|
|
||||||
return [True, "stop cluster"]
|
return [True, "stop cluster"]
|
||||||
|
|
||||||
def detach_cluster(self, clustername, username):
|
def detach_cluster(self, clustername, username):
|
||||||
|
|
Loading…
Reference in New Issue