[libvirt] [PATCH] util: swap After/Before clauses in virSystemdCreateMachine

Quentin Machu quentin.machu at coreos.com
Wed Jun 29 10:15:44 UTC 2016


An unexpected behavior in systemd has been introduced between the versions
225 and 229: when non-existing units are specified in After/Before clauses,
systemd fails if the After clause is listed first. What is expected is that
systemd simply ignores these clauses. Because the After clause is specified
before the Before clause in virSystemdCreateMachine and because libvirt
does not tolerate missing the systemd-machined registration, it leads to
fatal boot failures, whereas instances could start properly without these
units - only the shutdown workflow could be affected.

This fixes the following error in some particular cases: `libvirtError:
Cannot set property Before, or unknown property.`.
If accepted, this bug fix should be backported.

https://bugzilla.redhat.com/show_bug.cgi?id=1350909
---
 src/util/virsystemd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 871db7e..3a146f8 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -365,8 +365,8 @@ int virSystemdCreateMachine(const char *name,
                               nnicindexes, nicindexes,
                               3,
                               "Slice", "s", slicename,
-                              "After", "as", 1, "libvirtd.service",
-                              "Before", "as", 1, "libvirt-guests.service")
< 0)
+                              "Before", "as", 1, "libvirt-guests.service",
+                              "After", "as", 1, "libvirtd.service") < 0)
             goto cleanup;

         if (error.level == VIR_ERR_ERROR) {
@@ -406,8 +406,8 @@ int virSystemdCreateMachine(const char *name,
                               rootdir ? rootdir : "",
                               3,
                               "Slice", "s", slicename,
-                              "After", "as", 1, "libvirtd.service",
-                              "Before", "as", 1, "libvirt-guests.service")
< 0)
+                              "Before", "as", 1, "libvirt-guests.service",
+                              "After", "as", 1, "libvirtd.service") < 0)
             goto cleanup;
     }

--
1.8.3.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160629/8579ed16/attachment-0001.htm>


More information about the libvir-list mailing list