Bug 994356

Summary: virt-login-shell does not switch into container's cgroup
Product: [Community] Virtualization Tools Reporter: Krishna Raman <kraman>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ajia, berrange, cheng.d.wang, crobinso, dyuan, gsun, mfisher, rbalakri, weizhan, zpeng
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-10 10:22:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Krishna Raman 2013-08-07 06:28:31 UTC
Description of problem:
When using virt-login-shell, the resultant process is switch into the containers namespace but the cgroup remains that or the parent shell, instead of the cgroup of the container

Version-Release number of selected component (if applicable):
1.1.1

How reproducible:
Always

Steps to Reproduce:
1. Create and start LXC container
2. Use virt-login-shell to switch into container
3. Inspect the cgroup of the resultant process

Actual results:
CGroup remains cgroup of shell from which virt-login-shell was started.

Expected results:
CGroup switches to container's cgroup

Additional info:
If we dont change cgroup then any process launched from virt-login-shell is not confined to CPU/Memory limits assigned to container.

Comment 1 Daniel Berrangé 2013-08-07 11:16:51 UTC
The same problem exists with the 'virsh lxc-enter-namespace' command.

Comment 3 Cole Robinson 2016-04-10 00:47:10 UTC
This appears to be still relevant

Comment 4 Cole Robinson 2016-04-10 20:33:11 UTC
*** Bug 1176584 has been marked as a duplicate of this bug. ***

Comment 5 Daniel Berrangé 2016-06-10 10:22:46 UTC
Fixed upstream in this huge patch series.

f9d42801456f1c70c942d3edb0d0ac9266dde9fc virt-login-shell: add ability to join the container cgroups
18a10ddc1681f3d7ab58470f5c6e2e335767a60f virt-login-shell: add ability to auto-detect shell from container
ee877b871042099b6e9c66eea6cbcf90f8cfc2f0 virt-login-shell: fully reset container environment
1ebe6f24341f3f8a0f4d4f995ce12326f062119c virt-login-shell: avoid loosing error during cleanup
730466081c49ee5df3693b5574b14b60fea8368a virt-login-shell: allow shell to be a simple string argument
8a95d3df484478313955e3d8eb77f407ab1749f9 virt-login-shell: change way we request a login shell
da7396605b41e646004aa5bac909c6e5defac7ee virt-login-shell: honour the -c option to launch commands
291e1a470c004484d94497ebe3dae5b42bbff1c1 virsh: make lxc-enter-namespace also join the cgroups
57e62ee00ae4fd001cf8b3c0e95f3a05a2565543 libvirt-lxc: add virDomainLxcEnterCGroup API
235620463c62e3293135ae45aa3436b4895b3a3c util: add function for looking up the user shell
86dd9fac0f1d962e0146b9d4b1910d72d6c089de nodeinfo: move host memory APIs out into virhostmem file
eaf18f4c2bf1ca24513a4924616c96da9cf5511d nodeinfo: move host CPU APIs out into virhostcpu.c file
4053350bfebbae264c749ef6d36bb496ddb734c9 nodeinfo: rename all CPU APIs to have a virHostCPU prefix
dcfe37e682a51bf4bb5ce4e1cdfd144fccecea28 nodeinfo: rename all memory APIs to have a virHostMem prefix
bfb412a32e43e5847651bcb64d082aaf5e02da6c nodeinfo: split CPU info retrieval out of nodeGetInfo
3050a3f5a65776ad76d820cd8e7bd7a242a3d5b7 nodeinfo: remove FreeBSD specific code for getting memory
912813de27a5c9bd614fe97a1b80dd10fefc3dfa nodeinfo: make nodeGetInfo() call nodeGetMemory for memory size
08ea852c255a792b85ca89223a31e128a2bf2e21 nodeinfo: remove sysfs_prefix from all methods