From ea5512e3d80c23e11d0f8670e404fae35269563b Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 9 Oct 2024 01:10:42 -0400 Subject: [PATCH] Only shut down VM if it is running --- daemon-common/vm.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/daemon-common/vm.py b/daemon-common/vm.py index d5a31f44..c3159dc3 100644 --- a/daemon-common/vm.py +++ b/daemon-common/vm.py @@ -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