From 1293e8ae7ea4cbdf3ce661445574c422ffef1107 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 15 Oct 2024 10:36:50 -0400 Subject: [PATCH] Fix bugs in lock freeing function 1. The destination state on an error was invalid; should be "stop". 2. If a lock was listed but removing it fails (because it was already cleared somehow, this would error. In turn this would cause the VM to not migrate and be left in an undefined state. Fix that when unlocking is forced. --- daemon-common/vm.py | 13 ++++++++----- node-daemon/pvcnoded/util/fencing.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/daemon-common/vm.py b/daemon-common/vm.py index 77b88ccf..b69de08c 100644 --- a/daemon-common/vm.py +++ b/daemon-common/vm.py @@ -1997,11 +1997,14 @@ def vm_worker_flush_locks(zkhandler, celery, domain, force_unlock=False): ) if lock_remove_retcode != 0: - fail( - celery, - f"Failed to free RBD lock {lock['id']} on volume {rbd}: {lock_remove_stderr}", - ) - return False + if force_unlock and "No such file or directory" in lock_remove_stderr: + continue + else: + fail( + celery, + f"Failed to free RBD lock {lock['id']} on volume {rbd}: {lock_remove_stderr}", + ) + return False current_stage += 1 return finish( diff --git a/node-daemon/pvcnoded/util/fencing.py b/node-daemon/pvcnoded/util/fencing.py index a538bb28..3fc4a83c 100644 --- a/node-daemon/pvcnoded/util/fencing.py +++ b/node-daemon/pvcnoded/util/fencing.py @@ -247,7 +247,7 @@ def migrateFromFencedNode(zkhandler, node_name, config, logger): ) zkhandler.write( { - (("domain.state", dom_uuid), "stopped"), + (("domain.state", dom_uuid), "stop"), (("domain.meta.autostart", dom_uuid), "True"), } )