[libvirt] [PATCH 2/3] Automatically set correct ownership of QEMU state directories

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

 



* src/qemu_driver.c: Change ownership of /var/{lib,cache}/libvirt/qemu
  to match user/group that QEMU VMs are configured to run as.
---
 src/qemu_driver.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index c561c06..0342627 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -559,6 +559,21 @@ qemudStartup(int privileged) {
         goto error;
     }
 
+    if (privileged) {
+        if (chown(qemu_driver->libDir, qemu_driver->user, qemu_driver->group) < 0) {
+            virReportSystemError(NULL, errno,
+                                 _("unable to set ownership of '%s' to user %d:%d"),
+                                 qemu_driver->libDir, qemu_driver->user, qemu_driver->group);
+            goto error;
+        }
+        if (chown(qemu_driver->cacheDir, qemu_driver->user, qemu_driver->group) < 0) {
+            virReportSystemError(NULL, errno,
+                                 _("unable to set ownership of '%s' to %d:%d"),
+                                 qemu_driver->cacheDir, qemu_driver->user, qemu_driver->group);
+            goto error;
+        }
+    }
+
     if (qemudSecurityInit(qemu_driver) < 0) {
         goto error;
     }
-- 
1.6.2.5

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]