all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Filip Schauer <f.schauer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] Fix ACPI-suspended VMs resuming after migration
Date: Wed, 23 Aug 2023 12:58:39 +0200	[thread overview]
Message-ID: <20230823105839.36751-1-f.schauer@proxmox.com> (raw)

When migrating a VM that suspended itself via ACPI, it will no longer be
resumed automatically.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
 PVE/QemuMigrate.pm |  2 +-
 PVE/QemuServer.pm  | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 506911e..d9aeca8 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -223,7 +223,7 @@ sub prepare {
 	    }
 	}
 
-	$self->{vm_was_paused} = 1 if PVE::QemuServer::vm_is_paused($vmid);
+	$self->{vm_was_paused} = 1 if (PVE::QemuServer::vm_is_paused($vmid) or PVE::QemuServer::vm_is_suspended($vmid));
     }
 
     my ($loc_res, $mapped_res, $missing_mappings_by_node) = PVE::QemuServer::check_local_resources($conf, 1);
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index bf1de17..866b585 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -8599,6 +8599,16 @@ sub vm_is_paused {
     return $qmpstatus && $qmpstatus->{status} eq "paused";
 }
 
+sub vm_is_suspended {
+    my ($vmid) = @_;
+    my $qmpstatus = eval {
+       PVE::QemuConfig::assert_config_exists_on_node($vmid);
+       mon_cmd($vmid, "query-status");
+    };
+    warn "$@\n" if $@;
+    return $qmpstatus && $qmpstatus->{status} eq "suspended";
+}
+
 sub check_volume_storage_type {
     my ($storecfg, $vol) = @_;
 
-- 
2.39.2





             reply	other threads:[~2023-08-23 10:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 10:58 Filip Schauer [this message]
2023-08-24 12:45 ` Fiona Ebner

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=20230823105839.36751-1-f.schauer@proxmox.com \
    --to=f.schauer@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal