public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] Fix ACPI-suspended VMs resuming after migration
@ 2023-08-23 10:58 Filip Schauer
  2023-08-24 12:45 ` Fiona Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Filip Schauer @ 2023-08-23 10:58 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH qemu-server] Fix ACPI-suspended VMs resuming after migration
  2023-08-23 10:58 [pve-devel] [PATCH qemu-server] Fix ACPI-suspended VMs resuming after migration Filip Schauer
@ 2023-08-24 12:45 ` Fiona Ebner
  0 siblings, 0 replies; 2+ messages in thread
From: Fiona Ebner @ 2023-08-24 12:45 UTC (permalink / raw)
  To: Proxmox VE development discussion, Filip Schauer

Am 23.08.23 um 12:58 schrieb Filip Schauer:
> 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>

At a first glance, it seems like the other callers of vm_is_paused()
could also benefit from treating the 'suspended' runstate the same way
as 'paused'. Can you please check that and instead add the check for
'suspended' directly to the vm_is_paused() function? If you can come up
with a good name it might make sense to rename the function too, or at
least add a comment saying that the "paused" does not mean only the
runstate 'paused' but includes other runstates where the VM is paused ;)

And we might want to treat the runstate 'prelaunch' as paused too.

There's also runstates for being paused during certain phases of
migration, but maybe we can ignore them for now. Shouldn't be strictly
required, because of our config locking.

Full list would be here:
https://qemu.readthedocs.io/en/v8.0.0/interop/qemu-qmp-ref.html#qapidoc-85




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-24 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23 10:58 [pve-devel] [PATCH qemu-server] Fix ACPI-suspended VMs resuming after migration Filip Schauer
2023-08-24 12:45 ` Fiona Ebner

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