Only shut down VM if it is running

This commit is contained in:
Joshua Boniface 2024-10-09 01:10:42 -04:00
parent ac00f7c4c8
commit ea5512e3d8
1 changed files with 8 additions and 7 deletions

View File

@ -4476,13 +4476,14 @@ def vm_worker_promote_mirror(
total=total_stages,
)
retcode, retmsg = shutdown_vm(zkhandler, domain, wait=True)
if not retcode:
fail(
celery,
"Failed to shut down VM",
)
return False
if vm_detail["state"] in ["start"]:
retcode, retmsg = shutdown_vm(zkhandler, domain, wait=True)
if not retcode:
fail(
celery,
"Failed to shut down VM",
)
return False
#
# 2. Create snapshot