[libvirt] [RFC PATCH 3/6] LXC: only mount cgroupfs when userns is disabled

Gao feng gaofeng at cn.fujitsu.com
Mon Mar 11 06:26:49 UTC 2013


Since we can't mount cgroupfs in uninit user namespace
now. only mount cgroupfs when userns is disabled.

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

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 5c66ae3..92af3e5 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1979,7 +1979,8 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
 
     /* Now we can re-mount the cgroups controllers in the
      * same configuration as before */
-    if (lxcContainerMountCGroups(mounts, nmounts,
+    if (vmDef->os.userns != VIR_DOMAIN_USER_NS_ENABLED &&
+        lxcContainerMountCGroups(mounts, nmounts,
                                  cgroupRoot, sec_mount_options) < 0)
         goto cleanup;
 
@@ -2087,7 +2088,8 @@ static int lxcContainerSetupExtraMounts(virDomainDefPtr vmDef,
 
     /* Now we can re-mount the cgroups controllers in the
      * same configuration as before */
-    if (lxcContainerMountCGroups(mounts, nmounts,
+    if (vmDef->os.userns != VIR_DOMAIN_USER_NS_ENABLED &&
+        lxcContainerMountCGroups(mounts, nmounts,
                                  cgroupRoot, sec_mount_options) < 0)
         goto cleanup;
 
-- 
1.7.11.7




More information about the libvir-list mailing list