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(a)redhat.com>
---
config-post.h | 2 ++
src/Makefile.am | 4 ++++
tools/virt-login-shell.c | 2 ++
3 files changed, 8 insertions(+)
diff --git a/config-post.h b/config-post.h
index 2398d3d..f43521b 100644
--- a/config-post.h
+++ b/config-post.h
@@ -32,6 +32,7 @@
# undef HAVE_LIBSASL2
# undef WITH_CAPNG
# undef WITH_CURL
+# undef WITH_DBUS
# undef WITH_DTRACE_PROBES
# undef WITH_GNUTLS
# undef WITH_GNUTLS_GCRYPT
@@ -39,6 +40,7 @@
# undef WITH_NUMACTL
# undef WITH_SASL
# undef WITH_SSH2
+# undef WITH_SYSTEMD_DAEMON
# undef WITH_VIRTUALPORT
# undef WITH_YAJL
# undef WITH_YAJL2
diff --git a/src/Makefile.am b/src/Makefile.am
index 8b6ff15..ca0350e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2325,14 +2325,17 @@ libvirt_setuid_rpc_client_la_SOURCES = \
util/viratomic.h \
util/virbitmap.c \
util/virbuffer.c \
+ util/vircgroup.c \
util/vircommand.c \
util/virconf.c \
+ util/virdbus.c \
util/virerror.c \
util/virevent.c \
util/vireventpoll.c \
util/virfile.c \
util/virhash.c \
util/virhashcode.c \
+ util/virhostcpu.c \
util/virjson.c \
util/virlog.c \
util/virobject.c \
@@ -2341,6 +2344,7 @@ libvirt_setuid_rpc_client_la_SOURCES = \
util/virrandom.c \
util/virsocketaddr.c \
util/virstring.c \
+ util/virsystemd.c \
util/virtime.c \
util/virthread.c \
util/virthreadjob.c \
diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c
index 7680266..9d916f2 100644
--- a/tools/virt-login-shell.c
+++ b/tools/virt-login-shell.c
@@ -362,6 +362,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;
--
2.5.5