public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+)
@ 2025-07-28 14:30 Fiona Ebner
  2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 1/3] migration: status check: order states in regex alphabetically Fiona Ebner
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Fiona Ebner @ 2025-07-28 14:30 UTC (permalink / raw)
  To: pve-devel

There are some states that 'query-migrate' can return [0] which are
not properly handled by Proxmox VE yet.

In particular, as reported in the community forum [1], with QEMU 10.0,
the 'device' status can be present with migration parameters used by
Proxmox VE.

Two other states 'cancelling' and 'wait-unplug' are also explicitly
handled now.

[0]: https://qemu.readthedocs.io/en/master/interop/qemu-qmp-ref.html#enum-QMP-migration.MigrationStatus
[1]: https://forum.proxmox.com/threads/proxmox-ve-9-0-beta-released.168619/post-786535

Fiona Ebner (3):
  migration: status check: order states in regex alphabetically
  migration: handle 'device' migration status newly present in QEMU
    10.0+
  migration: handle 'cancelling' and 'wait-unplug' status

 src/PVE/QemuMigrate.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] [PATCH qemu-server 1/3] migration: status check: order states in regex alphabetically
  2025-07-28 14:30 [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+) Fiona Ebner
@ 2025-07-28 14:30 ` Fiona Ebner
  2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 2/3] migration: handle 'device' migration status newly present in QEMU 10.0+ Fiona Ebner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2025-07-28 14:30 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuMigrate.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
index 251fcc79..edaf2f25 100644
--- a/src/PVE/QemuMigrate.pm
+++ b/src/PVE/QemuMigrate.pm
@@ -1354,7 +1354,7 @@ sub phase2 {
             next;
         }
 
-        if (!defined($status) || $status !~ m/^(active|completed|failed|cancelled)$/im) {
+        if (!defined($status) || $status !~ m/^(active|cancelled|completed|failed)$/im) {
             die $merr if $merr;
             die "unable to parse migration status '$status' - aborting\n";
         }
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] [PATCH qemu-server 2/3] migration: handle 'device' migration status newly present in QEMU 10.0+
  2025-07-28 14:30 [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+) Fiona Ebner
  2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 1/3] migration: status check: order states in regex alphabetically Fiona Ebner
@ 2025-07-28 14:30 ` Fiona Ebner
  2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 3/3] migration: handle 'cancelling' and 'wait-unplug' status Fiona Ebner
  2025-07-29  6:05 ` [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+) Thomas Lamprecht
  3 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2025-07-28 14:30 UTC (permalink / raw)
  To: pve-devel

The QMP reference docs describe the 'device' status as:

> During device serialisation (also known as switchover phase). Before
> 9.2, this is only used when (1) in precopy, and (2) when
> pre-switchover capability is enabled. After 10.0, this state will
> always be present for every migration procedure as the switchover
> phase.

Since Proxmox VE did not use the pre-switchover capability, it has not
been observed before QEMU 10.0. The state is still only reached during
block device inactivation, but it will be reached.

Reported in the community forum:
https://forum.proxmox.com/threads/168619/post-786535

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuMigrate.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
index edaf2f25..5b854292 100644
--- a/src/PVE/QemuMigrate.pm
+++ b/src/PVE/QemuMigrate.pm
@@ -1354,7 +1354,7 @@ sub phase2 {
             next;
         }
 
-        if (!defined($status) || $status !~ m/^(active|cancelled|completed|failed)$/im) {
+        if (!defined($status) || $status !~ m/^(active|cancelled|completed|device|failed)$/im) {
             die $merr if $merr;
             die "unable to parse migration status '$status' - aborting\n";
         }
@@ -1394,7 +1394,7 @@ sub phase2 {
             die "aborting\n";
         }
 
-        if ($status ne 'active') {
+        if ($status ne 'active' && $status ne 'device') {
             $self->log('info', "migration status: $status");
             last;
         }
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] [PATCH qemu-server 3/3] migration: handle 'cancelling' and 'wait-unplug' status
  2025-07-28 14:30 [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+) Fiona Ebner
  2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 1/3] migration: status check: order states in regex alphabetically Fiona Ebner
  2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 2/3] migration: handle 'device' migration status newly present in QEMU 10.0+ Fiona Ebner
@ 2025-07-28 14:30 ` Fiona Ebner
  2025-07-29  6:05 ` [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+) Thomas Lamprecht
  3 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2025-07-28 14:30 UTC (permalink / raw)
  To: pve-devel

When in 'cancelling' status, wait until the transition to 'cancelled'
happens. Similarly, when in 'wait-unplug' status, wait for the
transition to the next state.

According to the QMP reference docs:

cancelling:
> in the process of cancelling migration.

wait-unplug:
> wait for device unplug request by guest OS to be completed.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuMigrate.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
index 5b854292..9585e292 100644
--- a/src/PVE/QemuMigrate.pm
+++ b/src/PVE/QemuMigrate.pm
@@ -1349,7 +1349,8 @@ sub phase2 {
         }
 
         my $status = $stat->{status};
-        if (defined($status) && $status =~ m/^(setup)$/im) {
+        if (defined($status) && $status =~ m/^(cancelling|setup|wait-unplug)$/im) {
+            $self->log('info', "migration in status '$status' - waiting for transition");
             sleep(1);
             next;
         }
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+)
  2025-07-28 14:30 [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+) Fiona Ebner
                   ` (2 preceding siblings ...)
  2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 3/3] migration: handle 'cancelling' and 'wait-unplug' status Fiona Ebner
@ 2025-07-29  6:05 ` Thomas Lamprecht
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2025-07-29  6:05 UTC (permalink / raw)
  To: pve-devel, Fiona Ebner

On Mon, 28 Jul 2025 16:30:30 +0200, Fiona Ebner wrote:
> There are some states that 'query-migrate' can return [0] which are
> not properly handled by Proxmox VE yet.
> 
> In particular, as reported in the community forum [1], with QEMU 10.0,
> the 'device' status can be present with migration parameters used by
> Proxmox VE.
> 
> [...]

Got already positive feedback in the forum, so: Applied, thanks!

FWIW, might be worth to transform the regex to a hash and lc() the key before
checking. Seems also a bit odd to me that the regex is using multiline, is that
really needed here? But all pre-existing and not really hurting, so really not
high priority to check.

[1/3] migration: status check: order states in regex alphabetically
      commit: d3842716a1156a99b937af9c8f89ea43defff13d
[2/3] migration: handle 'device' migration status newly present in QEMU 10.0+
      commit: 34d03f914821479515272df79792ab3ae17a1c06
[3/3] migration: handle 'cancelling' and 'wait-unplug' status
      commit: c106f1326daec73677aa33ec5091ac70fe9e6789


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2025-07-29  6:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-28 14:30 [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+) Fiona Ebner
2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 1/3] migration: status check: order states in regex alphabetically Fiona Ebner
2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 2/3] migration: handle 'device' migration status newly present in QEMU 10.0+ Fiona Ebner
2025-07-28 14:30 ` [pve-devel] [PATCH qemu-server 3/3] migration: handle 'cancelling' and 'wait-unplug' status Fiona Ebner
2025-07-29  6:05 ` [pve-devel] [PATCH-SERIES qemu-server 0/3] fix migration status handling (for QEMU 10.0+) Thomas Lamprecht

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