]> xenbits.xensource.com Git - libvirt.git/commitdiff
Only migrate profile in non-privileged libvirtd instance
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 11 Jun 2012 11:29:09 +0000 (12:29 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 11 Jun 2012 14:57:12 +0000 (15:57 +0100)
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

index d5ad05e92da2712f6e7953f13520ddfa709c1b4b..de6c96eab56be580e9c2f02ff97aba74e395a5fd 100644 (file)
@@ -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 &&