]> xenbits.xensource.com Git - libvirt.git/commitdiff
virt-login-shell: add ability to join the container cgroups
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 13 Apr 2016 10:00:11 +0000 (11:00 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 10 Jun 2016 10:03:02 +0000 (11:03 +0100)
Prior to joining the namespaces of the container, move the
process into the containers' cgroups, so that the shell that
is subsequently launched is under the container resource
constraints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tools/virt-login-shell.c

index dc3d3e371b15394765e5223676bf0a30234a604d..38fcb9e38fc66d430cfa5560a245def3c76db05d 100644 (file)
@@ -355,6 +355,8 @@ main(int argc, char **argv)
         goto cleanup;
     if (virDomainLxcEnterSecurityLabel(secmodel, seclabel, NULL, 0) < 0)
         goto cleanup;
+    if (virDomainLxcEnterCGroup(dom, 0) < 0)
+        goto cleanup;
     if (nfdlist > 0 &&
         virDomainLxcEnterNamespace(dom, nfdlist, fdlist, NULL, NULL, 0) < 0)
         goto cleanup;