From 8d758f3e5348fbfdb1f8c0c5634d9e01baea826b Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 5 Jan 2020 14:38:14 -0500 Subject: [PATCH] Add missing disable function --- client-api/api_lib/pvcapi_helper.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/client-api/api_lib/pvcapi_helper.py b/client-api/api_lib/pvcapi_helper.py index dee45d6a..4ad58df8 100755 --- a/client-api/api_lib/pvcapi_helper.py +++ b/client-api/api_lib/pvcapi_helper.py @@ -577,6 +577,24 @@ def vm_stop(name): } return output, retcode +def vm_disable(name): + """ + Disable a (stopped) VM in the PVC cluster. + """ + zk_conn = pvc_common.startZKConnection(config['coordinators']) + retflag, retdata = pvc_vm.disable_vm(zk_conn, name) + pvc_common.stopZKConnection(zk_conn) + + if retflag: + retcode = 200 + else: + retcode = 400 + + output = { + 'message': retdata.replace('\"', '\'') + } + return output, retcode + def vm_move(name, node): """ Move a VM to another node.