libvirt/libvirt-util-don-t-attempt-to-acquire-logind-inhibitor-if-not-requested.patch
Jiri Denemark 8026296455 libvirt-10.10.0-9.el9
- util: introduce object for holding a system inhibitor lock (RHEL-83064)
- src: convert drivers over to new virInhibitor APIs (RHEL-83064)
- rpc: remove logind support for virNetDaemon (RHEL-83064)
- util: fix off-by-1 in inhibitor constants (RHEL-83064)
- util: don't attempt to acquire logind inhibitor if not requested (RHEL-83064)
- network: Free inhibitor in networkStateCleanup() (RHEL-83064)
- conf: introduce support for multiple ACPI tables (RHEL-81041)
- src: validate permitted ACPI table types in libxl/qemu drivers (RHEL-81041)
- src: introduce 'raw' and 'rawset' ACPI table types (RHEL-81041)
- qemu: support 'raw' ACPI table type (RHEL-81041)
- libxl: support 'rawset' ACPI table type (RHEL-81041)
- conf: support MSDM ACPI table type (RHEL-81041)
- qemu: support MSDM ACPI table type (RHEL-81041)
- qemuxmlconftest: Include shared memory 'net-vhostuser' test cases (RHEL-84133)
- qemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces (RHEL-84133)
- qemu: process: Remove un-updated 'qemuProcessStartWarnShmem' (RHEL-84133)

Resolves: RHEL-81041, RHEL-83064, RHEL-84133
2025-03-26 13:05:21 +01:00

53 lines
2.1 KiB
Diff

From ceeaa000473ddb72db453f7e38943b961ca16c22 Mon Sep 17 00:00:00 2001
Message-ID: <ceeaa000473ddb72db453f7e38943b961ca16c22.1742990721.git.jdenemar@redhat.com>
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Wed, 8 Jan 2025 17:37:03 +0000
Subject: [PATCH] util: don't attempt to acquire logind inhibitor if not
requested
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When VIR_INHIBITOR_WHAT_NONE is passed to virInhibitorNew, it is
an indication that daemon shutdown should be inhibited, but no
OS level inhibitors acquired. This is done by the virtnetworkd
daemon, for example, to prevent shutdown while running virtual
machines are present, without blocking / delaying OS shutdown.
Unfortunately the code forgot to skip the DBus call in this case,
resulting in errors being logged.
Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit caa10431cdd1aa476637ff721f1947c4e0b53da1)
Resolves: https://issues.redhat.com/browse/RHEL-83064
---
src/util/virinhibitor.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/virinhibitor.c b/src/util/virinhibitor.c
index 647bdc9fbb..a95021de5a 100644
--- a/src/util/virinhibitor.c
+++ b/src/util/virinhibitor.c
@@ -152,7 +152,7 @@ virInhibitor *virInhibitorNew(virInhibitorWhat what,
virInhibitor *inhibitor = g_new0(virInhibitor, 1);
inhibitor->fd = -1;
- inhibitor->what = virInhibitorWhatFormat(what);
+ inhibitor->what = what ? virInhibitorWhatFormat(what) : NULL;
inhibitor->who = g_strdup(who);
inhibitor->why = g_strdup(why);
inhibitor->mode = virInhibitorModeTypeToString(mode);
@@ -171,7 +171,8 @@ void virInhibitorHold(virInhibitor *inhibitor)
inhibitor->action(true, inhibitor->actionData);
}
#ifdef G_OS_UNIX
- if (virInhibitorAcquire(
+ if (inhibitor->what &&
+ virInhibitorAcquire(
inhibitor->what, inhibitor->who, inhibitor->why,
inhibitor->mode, &inhibitor->fd) < 0) {
VIR_ERROR(_("Failed to acquire inhibitor: %1$s"),
--
2.49.0