[pve-devel] [PATCH qemu-server 3/3] migration: conntrack: avoid crash when dbus-vmstate object cannot be added (quickly enough)

Fiona Ebner f.ebner at proxmox.com
Mon Sep 29 14:24:48 CEST 2025


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 at 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





More information about the pve-devel mailing list