Use positive check rather than negative

Ensure the VM is start before doing shutdown/stop, rather than being
stopped. Prevents overwrite of existing disable state and other
weirdness.
This commit is contained in:
Joshua Boniface 2021-11-06 04:08:33 -04:00
parent 006f40f195
commit 0d857d5ab8
1 changed files with 1 additions and 1 deletions

View File

@ -845,7 +845,7 @@ def disable_vm(zkhandler, domain, force=False):
# Get state and perform a shutdown/stop if VM is online # Get state and perform a shutdown/stop if VM is online
current_state = zkhandler.read(("domain.state", dom_uuid)) current_state = zkhandler.read(("domain.state", dom_uuid))
if current_state != "stop": if current_state in ["start"]:
if force: if force:
change_state(zkhandler, dom_uuid, "stop") change_state(zkhandler, dom_uuid, "stop")
# Wait for the command to be registered by the node # Wait for the command to be registered by the node