Bug 1131919
| Summary: | setmem doesn't take effect for lxc guest | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Jincheng Miao <jmiao> |
| Component: | libvirt | Assignee: | Erik Skultety <eskultet> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | dyuan, eskultet, lhuang, mzhan, rbalakri, yanyang, ydu |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.13-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 05:47:48 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: | |||
Fixed upstream:
commit c87f268a369eb0f275781abbf446731f6c23f522
Author: Erik Skultety <eskultet>
Date: Fri Oct 24 11:17:20 2014 +0200
lxc: fix setmem effect on a running LXC machine
When user calls setmem on a running LXC machine, we do update its cgroup
entry, however we neither update domain's runtime XML nor
we update our internal structures and this patch fixes it.
v1.2.10-98-gc87f268
Verified on libvirt-1.2.15-1.el7.x86_64
Steps
1. prepare a lxc with following xml
# virsh -c lxc:/// dumpxml helloworld
<domain type='lxc' id='14079'>
<name>helloworld</name>
<uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid>
<memory unit='KiB'>102400</memory>
<currentMemory unit='KiB'>1000</currentMemory>
<vcpu placement='static' cpuset='1-3'>2</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64'>exe</type>
<init>/bin/sh</init>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/'/>
<target dir='/'/>
</filesystem>
<console type='pty' tty='/dev/pts/11'>
<source path='/dev/pts/11'/>
<target type='lxc' port='0'/>
<alias name='console0'/>
</console>
</devices>
<seclabel type='dynamic' model='selinux' relabel='yes'>
<label>system_u:system_r:svirt_lxc_net_t:s0:c822,c883</label>
<imagelabel>system_u:object_r:svirt_sandbox_file_t:s0:c822,c883</imagelabel>
</seclabel>
</domain>
2. check mem
# virsh -c lxc:// dumpxml helloworld | grep -1 memory
<uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid>
<memory unit='KiB'>102400</memory>
<currentMemory unit='KiB'>102300</currentMemory>
# virsh -c lxc:/// memtune helloworld
hard_limit : 102400
soft_limit : unlimited
swap_hard_limit: unlimited
# virsh -c lxc:/// dommemstat helloworld
actual 102300
swap_in 564
rss 564
3. set memory
# virsh -c lxc:/// setmem helloworld 1000
# virsh -c lxc:// dumpxml helloworld | grep -1 memory
<uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid>
<memory unit='KiB'>102400</memory>
<currentMemory unit='KiB'>1000</currentMemory>
# virsh -c lxc:/// memtune helloworld
hard_limit : 1000
soft_limit : unlimited
swap_hard_limit: unlimited
# virsh -c lxc:/// dommemstat helloworld
actual 1000
swap_in 564
rss 564
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2202.html |
Description of problem: setmem doesn't take effect for lxc guest. Version-Release number of selected component (if applicable): libvirt-1.2.7-1.el7.x86_64 kernel-3.10.0-145.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. define and start a lxc guest # virsh -c lxc:// dumpxml helloworld <domain type='lxc'> <name>helloworld</name> <uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid> <memory unit='KiB'>102400</memory> <currentMemory unit='KiB'>102400</currentMemory> <vcpu placement='static'>1</vcpu> <resource> <partition>/machine</partition> </resource> <os> <type arch='x86_64'>exe</type> <init>/bin/sh</init> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount' accessmode='passthrough'> <source dir='/'/> <target dir='/'/> </filesystem> <console type='pty' tty='/dev/pts/3'> <source path='/dev/pts/3'/> <target type='lxc' port='0'/> <alias name='console0'/> </console> </devices> <seclabel type='none' model='selinux'/> </domain> 2. check cur_balloon memory size # virsh -c lxc:// dumpxml helloworld | grep -1 memory <uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid> <memory unit='KiB'>102400</memory> <currentMemory unit='KiB'>102400</currentMemory> # virsh memtune helloworld hard_limit : 102400 soft_limit : unlimited swap_hard_limit: unlimited # virsh dommemstat helloworld actual 102400 swap_in 948 rss 948 3. set cur_balloon memory to lower value # virsh -c lxc:// setmem helloworld 1000 # echo $? 0 4. check that value # virsh -c lxc:// dumpxml helloworld | grep -1 memory <uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid> <memory unit='KiB'>102400</memory> <currentMemory unit='KiB'>102400</currentMemory> # virsh memtune helloworld hard_limit : 1000 soft_limit : unlimited swap_hard_limit: unlimited # virsh dommemstat helloworld actual 102400 swap_in 948 rss 948 only the output of memtune is changed as we specified, dumpxml and dommemstat aren't updated. check from cgroup memory controller: # cat /sys/fs/cgroup/memory/machine.slice/machine-lxc\\x2dhelloworld.scope/memory.limit_in_bytes 1024000 This value also didn't change. Expect result: cur_balloon memory is changed to what setmem specified.