[pve-devel] [PATCH qemu-server 3/3] dbus-vmstate: guard more errors in qemu_del_dbus_vmstate()
Fiona Ebner
f.ebner at proxmox.com
Wed Dec 17 14:17:12 CET 2025
Before commit "systemd: vmid.scope: add orderings to fix dbus-vmstate
cleanup (regression)", an issue with hard errors during cleanup of the
dbus-vmstate surfaced if the dbus.service was already not running. In
particular, the Net::DBus->system() call would fail when the
dbus.service is not running. Guard errors there and for the
get_bus_object() call, like other errors in qemu_del_dbus_vmstate()
already are guarded. Do not honor the 'quiet' option for these and
log failures in any case, because not having a working system DBus
is a more fundamental failure than the other failure scenarios in the
function and should still be recorded.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
src/PVE/QemuServer/DBusVMState.pm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/PVE/QemuServer/DBusVMState.pm b/src/PVE/QemuServer/DBusVMState.pm
index 480d9f70..3b5fe301 100644
--- a/src/PVE/QemuServer/DBusVMState.pm
+++ b/src/PVE/QemuServer/DBusVMState.pm
@@ -82,8 +82,19 @@ sub qemu_del_dbus_vmstate {
my ($vmid, %params) = @_;
my $num_entries = undef;
- my $dbus = Net::DBus->system();
- my $dbus_obj = $dbus->get_bus_object();
+ my $dbus = eval { Net::DBus->system(); };
+ if (my $err = $@) {
+ # log fundamental error even if $params{quiet} is set
+ syslog('warn', "failed to connect to DBus system bus: $err");
+ return undef;
+ }
+
+ my $dbus_obj = eval { $dbus->get_bus_object(); };
+ if (my $err = $@) {
+ # log fundamental error even if $params{quiet} is set
+ syslog('warn', "failed to get DBus bus object: $err");
+ return undef;
+ }
my $owners = eval { $dbus_obj->ListQueuedOwners('org.qemu.VMState1') };
if (my $err = $@) {
--
2.47.3
More information about the pve-devel
mailing list