[libvirt] [PATCH 7/7] LXC: Change the owner of live attached host devices

Gao feng gaofeng at cn.fujitsu.com
Mon Jul 15 06:08:02 UTC 2013


The owner of this host devices should be the root user of container.

Signed-off-by: Gao feng <gaofeng at cn.fujitsu.com>
---
 src/lxc/lxc_driver.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index bd92135..098051b 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3513,6 +3513,9 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
     }
     created = true;
 
+    if (lxcContainerChown(vm->def, dstfile) < 0)
+        goto cleanup;
+
     if (virSecurityManagerSetHostdevLabel(driver->securityManager,
                                           vm->def, def, vroot) < 0)
         goto cleanup;
@@ -3610,6 +3613,9 @@ lxcDomainAttachDeviceHostdevStorageLive(virLXCDriverPtr driver,
     }
     created = true;
 
+    if (lxcContainerChown(vm->def, dst) < 0)
+        goto cleanup;
+
     if (virSecurityManagerSetHostdevLabel(driver->securityManager,
                                           vm->def, def, vroot) < 0)
         goto cleanup;
@@ -3715,6 +3721,9 @@ lxcDomainAttachDeviceHostdevMiscLive(virLXCDriverPtr driver,
     }
     created = true;
 
+    if (lxcContainerChown(vm->def, dst) < 0)
+        goto cleanup;
+
     if (virSecurityManagerSetHostdevLabel(driver->securityManager,
                                           vm->def, def, vroot) < 0)
         goto cleanup;
-- 
1.8.3.1




More information about the libvir-list mailing list