This commit is contained in:
zhongyehong 2019-04-24 22:03:36 +08:00
parent 8323cb62d4
commit 8e98be274c
2 changed files with 5 additions and 7 deletions

View File

@ -442,11 +442,7 @@ def migrate_host(user, beans, form):
if src_host is None or dst_host_list is None:
return json.dumps({'success':'false', 'message': 'src host or dst host list is null'})
logger.info(str(src_host))
logger.info(type(dst_host_list))
logger.info(str(dst_host_list))
#[status, msg] = G_vclustermgr.migrate_host(src_host, dst_host_list)
status = True
[status, msg] = G_vclustermgr.migrate_host(src_host, dst_host_list)
if status:
return json.dumps({'success': 'true', 'action': 'migrate_host'})
else:

View File

@ -796,7 +796,7 @@ class VclusterMgr(object):
prestatus = info['status']
self.stop_cluster(clustername, username)
for container in info['containers']:
if container['host'] == src_host:
if not container['host'] == src_host:
continue
random.shuffle(new_host_list)
for new_host in new_host_list:
@ -817,7 +817,9 @@ class VclusterMgr(object):
return [True, ""]
def migrate_host(self, src_host, new_host_list):
vcluster_list = self.get_all_clusterinfo()
[status, vcluster_list] = self.get_all_clusterinfo()
if not status:
return [False, vcluster_list]
auth_key = env.getenv('AUTH_KEY')
res = post_to_user("/master/user/groupinfo/", {'auth_key':auth_key})
groups = json.loads(res['groups'])