]> xenbits.xensource.com Git - libvirt.git/commitdiff
LXC: Change the owner of host devices to the root of container
authorGao feng <gaofeng@cn.fujitsu.com>
Tue, 16 Jul 2013 02:00:05 +0000 (10:00 +0800)
committerEric Blake <eblake@redhat.com>
Tue, 16 Jul 2013 15:59:29 +0000 (09:59 -0600)
These host devices are created for container,
the owner should be the root user of container.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
src/lxc/lxc_controller.c

index dbb053a6ebd2ff396e1460d9529e3e41412bde0d..ce1f941c5a8bd9bc664b40b6d8342f5f06b4b4c8 100644 (file)
@@ -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;