From bcd48648b2d4c036427fe923f320cb7ad02295fd Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 25 Jul 2019 14:33:50 -0400 Subject: [PATCH] Add is_migrated check function --- client-common/vm.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client-common/vm.py b/client-common/vm.py index 9a899745..3a2ecbcb 100644 --- a/client-common/vm.py +++ b/client-common/vm.py @@ -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: