Perform automatic shutdown/stop on VM disable

Instead of requiring the VM to already be stopped, instead allow disable
state changes to perform a shutdown first. Also add a force option which
will do a hard stop instead of a shutdown.

References #148
This commit is contained in:
2021-11-06 03:53:44 -04:00
parent 16544227eb
commit 739b60b91e
4 changed files with 30 additions and 10 deletions

View File

@ -719,11 +719,11 @@ def vm_start(zkhandler, name):
@ZKConnection(config)
def vm_restart(zkhandler, name, wait):
def vm_restart(zkhandler, name, wait=False):
"""
Restart a VM in the PVC cluster.
"""
retflag, retdata = pvc_vm.restart_vm(zkhandler, name, wait)
retflag, retdata = pvc_vm.restart_vm(zkhandler, name, wait=wait)
if retflag:
retcode = 200
@ -767,11 +767,11 @@ def vm_stop(zkhandler, name):
@ZKConnection(config)
def vm_disable(zkhandler, name):
def vm_disable(zkhandler, name, force=False):
"""
Disable a (stopped) VM in the PVC cluster.
Disable (shutdown or force stop if required)a VM in the PVC cluster.
"""
retflag, retdata = pvc_vm.disable_vm(zkhandler, name)
retflag, retdata = pvc_vm.disable_vm(zkhandler, name, force=force)
if retflag:
retcode = 200