all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 3/3] migration: conntrack: avoid crash when dbus-vmstate object cannot be added (quickly enough)
Date: Mon, 29 Sep 2025 14:24:48 +0200	[thread overview]
Message-ID: <20250929122529.90484-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250929122529.90484-1-f.ebner@proxmox.com>

As reported in the community forum [0], it might happen that the
dbus-vmstate object is not added (quickly enough) to the target QEMU
instance, before the migration state is loaded. This would result in
a crash of the target instance:

> kvm: Unknown savevm section or instance 'dbus-vmstate/dbus-vmstate'
> 0. Make sure that your current VM setup matches your saved VM setup,
> including any hotplugged devices
> kvm: load of migration failed: Invalid argument

This is after the configuration is already moved and thus there also
is no source instance running anymore.

Make sure that the qemu_add_dbus_vmstate() function only returns
success when the object is successfully added.

[0]: https://forum.proxmox.com/threads/172588/

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

diff --git a/src/PVE/QemuServer/DBusVMState.pm b/src/PVE/QemuServer/DBusVMState.pm
index a72d6dd2..354602a7 100644
--- a/src/PVE/QemuServer/DBusVMState.pm
+++ b/src/PVE/QemuServer/DBusVMState.pm
@@ -11,6 +11,7 @@ use PVE::Systemd;
 use PVE::Tools;
 
 use PVE::QemuServer::Helpers;
+use PVE::QemuServer::Monitor qw(mon_cmd);
 
 use constant {
     DBUS_VMSTATE_EXE => '/usr/libexec/qemu-server/dbus-vmstate',
@@ -59,6 +60,15 @@ sub qemu_add_dbus_vmstate {
     if (my $err = $@) {
         die "failed to start DBus VMState service for VM $vmid: $err\n";
     }
+
+    # Need to wait for the object to be added by the started service.
+    for (my $i = 0; $i < 5; $i++) {
+        my $qom_list = mon_cmd($vmid, 'qom-list', path => '/objects');
+        return if grep { $_->{name} eq 'pve-vmstate' } $qom_list->@*;
+        sleep 1;
+    }
+
+    die "timeout waiting for pve-vmstate object to show up\n";
 }
 
 # Stops the dbus-vmstate helper D-Bus service daemon and removes the associated
-- 
2.47.3



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


  parent reply	other threads:[~2025-09-29 12:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 12:24 [pve-devel] [PATCH-SERIES qemu-server 0/3] migration: conntrack: fix two edge cases Fiona Ebner
2025-09-29 12:24 ` [pve-devel] [PATCH qemu-server 1/3] dbus vmstate: add missing includes Fiona Ebner
2025-09-29 12:24 ` [pve-devel] [PATCH qemu-server 2/3] migration: conntrack: work around systemd issue where scope for VM might become blocked Fiona Ebner
2025-09-29 12:24 ` Fiona Ebner [this message]
2025-10-03 11:42   ` [pve-devel] [PATCH qemu-server 3/3] migration: conntrack: avoid crash when dbus-vmstate object cannot be added (quickly enough) Fabian Grünbichler
2025-10-06  8:51     ` Fiona Ebner
2025-10-03 11:43 ` [pve-devel] partially-applied: [PATCH-SERIES qemu-server 0/3] migration: conntrack: fix two edge cases Fabian Grünbichler

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=20250929122529.90484-4-f.ebner@proxmox.com \
    --to=f.ebner@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