libvirt-8.0.0-5.el9

- Make systemd unit ordering more robust (rhbz#1868537)
- util: Fix machined servicename (rhbz#1868537)

Resolves: rhbz#1868537
This commit is contained in:
Jiri Denemark 2022-02-24 15:30:33 +01:00
parent eb39f127da
commit 2f270eef2c
3 changed files with 167 additions and 1 deletions

View File

@ -0,0 +1,89 @@
From ee1ce580f5373070e4b6a50d1ae4a3218c737a72 Mon Sep 17 00:00:00 2001
Message-Id: <ee1ce580f5373070e4b6a50d1ae4a3218c737a72@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Mon, 14 Feb 2022 12:37:37 +0100
Subject: [PATCH] Make systemd unit ordering more robust
Since libvirt-guests script/service can operate on various URIs and we do
support both socket activation and traditional services, the ordering should be
specified for all the possible sockets and services.
Also remove the Wants= dependency since do not want to start any service. We
cannot know which one libvirt-guests is configured, so we'd have to start all
the daemons which would break if unused colliding services are not
masked (libvirtd.service in the modular case and all the modular daemon service
units in the monolithic scenario). Fortunately we can assume that the system is
configured properly to start services/sockets that are of interest to the user.
That also works with the setup described in https://libvirt.org/daemons.html .
To make it even more robust we add the daemon service into the machine units
created for individual domains as it was missing there.
https://bugzilla.redhat.com/show_bug.cgi?id=1868537
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 4e42686adef8b9e9266f0099ddcd25bc95c4ed43)
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
src/util/virsystemd.c | 8 ++++++--
tools/libvirt-guests.service.in | 12 +++++++++++-
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index a86d4c6bb9..f156c2f39a 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -441,8 +441,10 @@ int virSystemdCreateMachine(const char *name,
nicindexes, nnicindexes, sizeof(int));
gprops = g_variant_new_parsed("[('Slice', <%s>),"
" ('After', <['libvirtd.service']>),"
+ " ('After', <['virt%sd.service']>),"
" ('Before', <['virt-guest-shutdown.target']>)]",
- slicename);
+ slicename,
+ drivername);
message = g_variant_new("(s@ayssus@ai@a(sv))",
name,
guuid,
@@ -489,8 +491,10 @@ int virSystemdCreateMachine(const char *name,
uuid, 16, sizeof(unsigned char));
gprops = g_variant_new_parsed("[('Slice', <%s>),"
" ('After', <['libvirtd.service']>),"
+ " ('After', <['virt%sd.service']>),"
" ('Before', <['virt-guest-shutdown.target']>)]",
- slicename);
+ slicename,
+ drivername);
message = g_variant_new("(s@ayssus@a(sv))",
name,
guuid,
diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
index 1a9b233e11..3cf6476196 100644
--- a/tools/libvirt-guests.service.in
+++ b/tools/libvirt-guests.service.in
@@ -1,10 +1,20 @@
[Unit]
Description=Suspend/Resume Running libvirt Guests
-Wants=libvirtd.service
Requires=virt-guest-shutdown.target
After=network.target
After=time-sync.target
+After=libvirtd.socket
+After=virtqemud.socket
+After=virtlxcd.socket
+After=virtvboxd.socket
+After=virtvzd.socket
+After=virtxend.socket
After=libvirtd.service
+After=virtqemud.service
+After=virtlxcd.service
+After=virtvboxd.service
+After=virtvzd.service
+After=virtxend.service
After=virt-guest-shutdown.target
Documentation=man:libvirt-guests(8)
Documentation=https://libvirt.org
--
2.35.1

View File

@ -0,0 +1,71 @@
From f38b129e38b73cb20a2d858de7b593d09380e548 Mon Sep 17 00:00:00 2001
Message-Id: <f38b129e38b73cb20a2d858de7b593d09380e548@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Wed, 23 Feb 2022 10:45:28 +0100
Subject: [PATCH] util: Fix machined servicename
Commit 4e42686adef8 wrongly assumed how g_variant_new_parsed() works and broke
starting of domains on systems with systemd (machined).
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit a64e666a112d4d6299d1b73704d176283bc42b19)
https://bugzilla.redhat.com/show_bug.cgi?id=1868537
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
src/util/virsystemd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index f156c2f39a..a8af80c495 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -360,6 +360,7 @@ int virSystemdCreateMachine(const char *name,
g_autofree char *creatorname = NULL;
g_autofree char *slicename = NULL;
g_autofree char *scopename = NULL;
+ g_autofree char *servicename = NULL;
static int hasCreateWithNetwork = 1;
if ((rc = virSystemdHasMachined()) < 0)
@@ -369,6 +370,7 @@ int virSystemdCreateMachine(const char *name,
return -1;
creatorname = g_strdup_printf("libvirt-%s", drivername);
+ servicename = g_strdup_printf("virt%sd.service", drivername);
if (partition) {
if (!(slicename = virSystemdMakeSliceName(partition)))
@@ -440,11 +442,10 @@ int virSystemdCreateMachine(const char *name,
gnicindexes = g_variant_new_fixed_array(G_VARIANT_TYPE("i"),
nicindexes, nnicindexes, sizeof(int));
gprops = g_variant_new_parsed("[('Slice', <%s>),"
- " ('After', <['libvirtd.service']>),"
- " ('After', <['virt%sd.service']>),"
+ " ('After', <['libvirtd.service', %s]>),"
" ('Before', <['virt-guest-shutdown.target']>)]",
slicename,
- drivername);
+ servicename);
message = g_variant_new("(s@ayssus@ai@a(sv))",
name,
guuid,
@@ -490,11 +491,10 @@ int virSystemdCreateMachine(const char *name,
guuid = g_variant_new_fixed_array(G_VARIANT_TYPE("y"),
uuid, 16, sizeof(unsigned char));
gprops = g_variant_new_parsed("[('Slice', <%s>),"
- " ('After', <['libvirtd.service']>),"
- " ('After', <['virt%sd.service']>),"
+ " ('After', <['libvirtd.service', %s]>),"
" ('Before', <['virt-guest-shutdown.target']>)]",
slicename,
- drivername);
+ servicename);
message = g_variant_new("(s@ayssus@a(sv))",
name,
guuid,
--
2.35.1

View File

@ -228,7 +228,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 8.0.0
Release: 4%{?dist}%{?extra_release}
Release: 5%{?dist}%{?extra_release}
License: LGPLv2+
URL: https://libvirt.org/
@ -247,6 +247,8 @@ Patch6: libvirt-Revert-report-error-when-virProcessGetStatInfo-is-unable-to-pars
Patch7: libvirt-qemuDomainSetupDisk-Initialize-targetPaths.patch
Patch8: libvirt-qemu_command-Generate-memory-only-after-controllers.patch
Patch9: libvirt-qemu-Validate-domain-definition-even-on-migration.patch
Patch10: libvirt-Make-systemd-unit-ordering-more-robust.patch
Patch11: libvirt-util-Fix-machined-servicename.patch
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
@ -2138,6 +2140,10 @@ exit 0
%changelog
* Thu Feb 24 2022 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-5
- Make systemd unit ordering more robust (rhbz#1868537)
- util: Fix machined servicename (rhbz#1868537)
* Thu Feb 10 2022 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-4
- qemu_command: Generate memory only after controllers (rhbz#2047271)
- qemu: Validate domain definition even on migration (rhbz#2048435)