[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Only migrate profile in non-privileged libvirtd instance



From: "Daniel P. Berrange" <berrange redhat com>

Only the non-privileged libvirtd instance uses $HOME. So avoid
running the code for migrating to XDG directories unless using
a non-privileged libvirtd
---
 daemon/libvirtd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index d5ad05e..de6c96e 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -783,6 +783,8 @@ static int migrateProfile(void)
     int ret = -1;
     mode_t old_umask;
 
+    VIR_DEBUG("Checking if user profile needs migrating");
+
     if (!(home = virGetUserDirectory()))
         goto cleanup;
 
@@ -795,6 +797,9 @@ static int migrateProfile(void)
         goto cleanup;
 
     if (!virFileIsDir(old_base) || virFileExists(config_dir)) {
+        VIR_DEBUG("No old profile in '%s' / "
+                  "new profile directory already present '%s'",
+                  old_base, config_dir);
         ret = 0;
         goto cleanup;
     }
@@ -830,6 +835,7 @@ static int migrateProfile(void)
         goto cleanup;
     }
 
+    VIR_DEBUG("Profile migrated from %s to %s", old_base, config_dir);
     ret = 0;
 
  cleanup:
@@ -1063,7 +1069,8 @@ int main(int argc, char **argv) {
         exit(EXIT_FAILURE);
     }
 
-    if (migrateProfile() < 0)
+    if (!privileged &&
+        migrateProfile() < 0)
         exit(EXIT_FAILURE);
 
     if (config->host_uuid &&
-- 
1.7.10.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]