[pve-devel] [PATCH qemu-server v2] fix #4358: destroy_vm: Ignore 'suspended' lock when destroying VM

Stefan Hanreich s.hanreich at proxmox.com
Thu Jan 5 15:51:56 CET 2023


Since we can now differentiate between 'suspended' and 'suspending',
it is possible to ignore the 'suspended' lock when destroying a VM.
It shouldn't matter whether the VM is locked because of hibernation
when you want to remove it. Therefore we can safely ignore the lock.
---

Changes v1 -> v2:
* Improved commit message

After thinking about it for awhile, I'm not sure whether showing a
hint in the UI, when removing a hibernated VM, is that useful. Not sure
why one would have a reason to reconsider removal suddenly in that
case. Maybe someone else has some input/ideas on this?

 PVE/QemuServer.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 39fc6b0..5dae168 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2341,7 +2341,9 @@ sub destroy_vm {
 
     my $conf = PVE::QemuConfig->load_config($vmid);
 
-    PVE::QemuConfig->check_lock($conf) if !$skiplock;
+    if (!$skiplock && !PVE::QemuConfig->has_lock($conf, 'suspended')) {
+	PVE::QemuConfig->check_lock($conf);
+    }
 
     if ($conf->{template}) {
 	# check if any base image is still used by a linked clone
-- 
2.30.2





More information about the pve-devel mailing list