From: Gao feng Date: Tue, 16 Jul 2013 02:00:06 +0000 (+0800) Subject: LXC: Change the owner of live attached host devices X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=129d25dcd91fc1d15e9067df2cc65125dc49a34b;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git 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 --- 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;