RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1131919 - setmem doesn't take effect for lxc guest
Summary: setmem doesn't take effect for lxc guest
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Erik Skultety
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-20 09:48 UTC by Jincheng Miao
Modified: 2015-11-19 05:47 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:47:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Jincheng Miao 2014-08-20 09:48:59 UTC
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.

Comment 1 Erik Skultety 2014-11-13 14:19:51 UTC
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

Comment 4 Yang Yang 2015-05-14 06:12:02 UTC
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

Comment 7 errata-xmlrpc 2015-11-19 05:47:48 UTC
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


Note You need to log in before you can comment on or make changes to this bug.