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

Signed-off-by: Gao feng <gaof...@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to