Add is_migrated check function

This commit is contained in:
Joshua Boniface 2019-07-25 14:33:50 -04:00
parent 19ae10e582
commit bcd48648b2
1 changed files with 14 additions and 0 deletions

View File

@ -106,6 +106,20 @@ def getDomainName(zk_conn, domain):
#
# Direct functions
#
def is_migrated(zk_conn, domain):
# Validate that VM exists in cluster
dom_uuid = getDomainUUID(zk_conn, domain)
if not dom_uuid:
common.stopZKConnection(zk_conn)
return False, 'ERROR: Could not find VM "{}" in the cluster!'.format(domain)
last_node = zkhandler.readdata(zk_conn, '/domains/{}/lastnode'.format(dom_uuid))
common.stopZKConnection(zk_conn)
if last_node:
return True
else
return False
def define_vm(zk_conn, config_data, target_node, selector):
# Parse the XML data
try: