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

Signed-off-by: Dominik Csapak <[email protected]>
---
 src/PVE/CLI/qm.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm
index b7bc4d9f..6aff5b7a 100755
--- a/src/PVE/CLI/qm.pm
+++ b/src/PVE/CLI/qm.pm
@@ -1102,6 +1102,13 @@ __PACKAGE__->register_method({
             sub {
                 my $conf = PVE::QemuConfig->load_config($vmid);
                 my $pid = PVE::QemuServer::check_running($vmid);
+
+                # 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 $pid && $clean && $conf->{lock} && $conf->{lock} eq 
'backup';
+
                 die "vm still running\n" if $pid;
 
                 # Rollback already does cleanup when preparing and afterwards 
temporarily drops the
-- 
2.47.3




Reply via email to