[PATCH 6/7] LXC: Change the owner of host devices to the root of container

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

 



These host devices are created for container,
the owner should be the root user of container.

Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
---
 src/lxc/lxc_controller.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index dbb053a..ce1f941 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1348,6 +1348,9 @@ virLXCControllerSetupHostdevSubsysUSB(virDomainDefPtr vmDef,
         goto cleanup;
     }
 
+    if (lxcContainerChown(vmDef, dstfile) < 0)
+        goto cleanup;
+
     if (virSecurityManagerSetHostdevLabel(securityDriver,
                                           vmDef, def, vroot) < 0)
         goto cleanup;
@@ -1425,6 +1428,9 @@ virLXCControllerSetupHostdevCapsStorage(virDomainDefPtr vmDef,
         goto cleanup;
     }
 
+    if (lxcContainerChown(vmDef, dst) < 0)
+        goto cleanup;
+
     def->source.caps.u.storage.block = dst;
     if (virSecurityManagerSetHostdevLabel(securityDriver, vmDef, def, NULL) < 0)
         goto cleanup;
@@ -1501,6 +1507,9 @@ virLXCControllerSetupHostdevCapsMisc(virDomainDefPtr vmDef,
         goto cleanup;
     }
 
+    if (lxcContainerChown(vmDef, dst) < 0)
+        goto cleanup;
+
     def->source.caps.u.misc.chardev = dst;
     if (virSecurityManagerSetHostdevLabel(securityDriver, vmDef, def, NULL) < 0)
         goto cleanup;
-- 
1.8.3.1

--
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]