From a64e666a112d4d6299d1b73704d176283bc42b19 Mon Sep 17 00:00:00 2001 From: Martin Kletzander 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 Reviewed-by: Jiri Denemark --- 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 0554884811..18bf2932a4 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,