[libvirt PATCH 10/15] systemd: only check for activitable machine1 service

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Mon Apr 6 21:27:07 UTC 2020


From: Marc-André Lureau <marcandre.lureau at redhat.com>

The service is started on demand, checking if it's already registered
on the bus defeat this purpose.

Note: the same is probably true for login1, but I don't intent to look
at the code path yet.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/util/virsystemd.c  |  2 --
 tests/virsystemdtest.c | 35 -----------------------------------
 2 files changed, 37 deletions(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 74d0d15ca7..14d680532f 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -163,8 +163,6 @@ virSystemdHasMachined(void)
         return ret;
     }
 
-    if ((ret = virDBusSystemIsServiceRegistered("org.freedesktop.machine1")) == -1)
-        return ret;
     g_atomic_int_set(&virSystemdHasMachinedCachedValue, ret);
     return ret;
 }
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 050941dce8..8518805f82 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -260,40 +260,6 @@ static int testCreateNoSystemd(const void *opaque G_GNUC_UNUSED)
     return 0;
 }
 
-static int testCreateSystemdNotRunning(const void *opaque G_GNUC_UNUSED)
-{
-    unsigned char uuid[VIR_UUID_BUFLEN] = {
-        1, 1, 1, 1,
-        2, 2, 2, 2,
-        3, 3, 3, 3,
-        4, 4, 4, 4
-    };
-    int rv;
-
-    g_setenv("FAIL_NOT_REGISTERED", "1", TRUE);
-
-    if ((rv = virSystemdCreateMachine("demo",
-                                      "qemu",
-                                      uuid,
-                                      NULL,
-                                      123,
-                                      false,
-                                      0, NULL,
-                                      NULL, 0)) == 0) {
-        g_unsetenv("FAIL_NOT_REGISTERED");
-        fprintf(stderr, "%s", "Unexpected create machine success\n");
-        return -1;
-    }
-    g_unsetenv("FAIL_NOT_REGISTERED");
-
-    if (rv != -2) {
-        fprintf(stderr, "%s", "Unexpected create machine error\n");
-        return -1;
-    }
-
-    return 0;
-}
-
 static int testCreateBadSystemd(const void *opaque G_GNUC_UNUSED)
 {
     unsigned char uuid[VIR_UUID_BUFLEN] = {
@@ -698,7 +664,6 @@ mymain(void)
     DO_TEST("Test create machine ", testCreateMachine);
     DO_TEST("Test terminate machine ", testTerminateMachine);
     DO_TEST("Test create no systemd ", testCreateNoSystemd);
-    DO_TEST("Test create systemd not running ", testCreateSystemdNotRunning);
     DO_TEST("Test create bad systemd ", testCreateBadSystemd);
     DO_TEST("Test create with network ", testCreateNetwork);
     DO_TEST("Test getting machine name ", testGetMachineName);
-- 
2.26.0.rc2.42.g98cedd0233




More information about the libvir-list mailing list