public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v4 2/3] qm cleanup: die early when encountering a running stop mode backup
Date: Fri, 15 May 2026 12:04:53 +0200	[thread overview]
Message-ID: <20260515100842.1980636-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260515100842.1980636-1-d.csapak@proxmox.com>

this is an expected situation, so abort here early with a better message
than 'vm still running'

Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v3:
* style improvement

 src/PVE/CLI/qm.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm
index 81ccc564..3c9e8812 100755
--- a/src/PVE/CLI/qm.pm
+++ b/src/PVE/CLI/qm.pm
@@ -1102,7 +1102,16 @@ __PACKAGE__->register_method({
             sub {
                 my $conf = PVE::QemuConfig->load_config($vmid);
                 my $pid = PVE::QemuServer::check_running($vmid);
-                die "vm still running\n" if $pid;
+
+                if ($pid) {
+                    # With a stop mode backup, we might run here into a running vm with a backup
+                    # lock, but this already did the cleanup and is an expected state, so abort
+                    # here with a good message
+                    die "skipping cleanup - 'backup' lock is present and vm is running again\n"
+                        if $clean && $conf->{lock} && $conf->{lock} eq 'backup';
+
+                    die "vm still running\n";
+                }
 
                 # Rollback already does cleanup when preparing and afterwards temporarily drops the
                 # lock on the configuration file to rollback the volumes. Deactivating volumes here
-- 
2.47.3





  parent reply	other threads:[~2026-05-15 10:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 10:04 [PATCH qemu-server v4 0/3] improve guest cleanup handling Dominik Csapak
2026-05-15 10:04 ` [PATCH qemu-server v4 1/3] cleanup: refactor to make cleanup flow consistent Dominik Csapak
2026-05-15 10:04 ` Dominik Csapak [this message]
2026-05-15 10:04 ` [PATCH qemu-server v4 3/3] fix #7119: qm cleanup: wait for process exiting for up to 30 seconds Dominik Csapak
2026-05-15 10:14   ` Fiona Ebner
2026-05-15 12:35 ` superseded: [PATCH qemu-server v4 0/3] improve guest cleanup handling Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515100842.1980636-3-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal