From 129d25dcd91fc1d15e9067df2cc65125dc49a34b Mon Sep 17 00:00:00 2001 From: Gao feng Date: Tue, 16 Jul 2013 10:00:06 +0800 Subject: [PATCH] LXC: Change the owner of live attached host devices The owner of this host devices should be the root user of container. Signed-off-by: Gao feng --- 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 bd921351a..098051be4 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; -- 2.39.5