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 589849 - [LXC] Changing shutoff guest max memory can effect current memory
Summary: [LXC] Changing shutoff guest max memory can effect current memory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: i386
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: Rhel6.1LibvirtTier1
TreeView+ depends on / blocked
 
Reported: 2010-05-07 05:20 UTC by zhanghaiyan
Modified: 2012-06-20 06:20 UTC (History)
9 users (show)

Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 06:20:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description zhanghaiyan 2010-05-07 05:20:29 UTC
Description of problem:
Can change a shutoff guest max memory to a value which is lower than current memory (current memory is lower than current max memory), and leads both max memory and current memory are changed to the value set.

Version-Release number of selected component (if applicable):
- kernel-2.6.32-24.el6.i686
- libvirt-0.8.1-1.el6.i686

How reproducible:
Always

Steps to Reproduce:
1. # virsh define vm1.xml
2. # virsh list --all
 Id Name                 State
----------------------------------
  - fedora-rawhide       shut off
  - vm1                  shut off

3.# virsh dumpxml vm1
<domain type='lxc'>
  <name>vm1</name>
  <uuid>386f5b25-43ee-9d62-4ce2-58c3809e47c1</uuid>
  <memory>400000</memory>
  <currentMemory>350000</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='i686'>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>
    <interface type='network'>
      <mac address='52:54:00:f2:2c:ac'/>
      <source network='default'/>
      <target dev='veth0'/>
    </interface>
    <console type='pty'>
      <target port='0'/>
    </console>
  </devices>
</domain>

4. # virsh setmaxmem vm1 300000
5. # virsh dumpxml vm1
<domain type='lxc'>
  <name>vm1</name>
  <uuid>386f5b25-43ee-9d62-4ce2-58c3809e47c1</uuid>
  <memory>300000</memory>
  <currentMemory>300000</currentMemory>
  <vcpu>1</vcpu>
.......
6. # virsh start vm1
Domain vm1 started
7. # virsh dumpxml vm1
<domain type='lxc' id='3778'>
  <name>vm1</name>
  <uuid>386f5b25-43ee-9d62-4ce2-58c3809e47c1</uuid>
  <memory>300000</memory>
  <currentMemory>300000</currentMemory>
  <vcpu>1</vcpu>
.......
  
Actual results:
After step4, both max memory and current memory are changed to the value set

Expected results:
Should not allow to change max memory to the value which is lower that current memory. 

Additional info:
I suspect whether it should allow to change a shutoff guest max memory. Because according to https://bugzilla.redhat.com/show_bug.cgi?id=572474#c5, it is not allowed to change shutoff guest current memory.

Changing running guest max memory to the value which is lower that current memory is not allowed. ( This is expected result.)
Continue after step7.
8. # virsh setmaxmem vm1 250000
error: Unable to change MaxMemorySize
error: invalid argument in Cannot set max memory lower than current memory

Comment 2 RHEL Program Management 2010-05-07 06:40:39 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 4 Daniel Berrangé 2010-10-11 15:16:46 UTC
FYI upstream has introduced a bunch of new memory tunables into LXC which may interact with this problem

http://www.redhat.com/archives/libvir-list/2010-October/msg00208.html

Comment 9 Jiri Denemark 2011-11-29 14:19:46 UTC
This appears to be fixed on current libvirt git (v0.9.7-179-g6b84ee3). Moving to POST.

Comment 12 Alex Jia 2012-01-10 10:33:17 UTC
I retest the bug on libvirt-0.9.9-1.el6.x86_64, however, there are some issues still exist:

# service cgconfig status
Running

# virsh -c lxc:/// start toy
Domain toy started

# virsh -c lxc:/// dominfo toy
Id:             24858
Name:           toy
UUID:           d1f4798b-bebf-d93c-1d97-fe1c1cb7c780
OS Type:        exe
State:          running
CPU(s):         1
CPU time:       0.0s
Max memory:     500000 kB
Used memory:    460 kB
Persistent:     yes
Autostart:      disable
Managed save:   unknown

Note, Max memory is 500000 kB, and Used memory is 460 kB.

# virsh -c lxc:/// setmaxmem toy 600000

# echo $?
0

# virsh -c lxc:/// dominfo toy
Id:             24858
Name:           toy
UUID:           d1f4798b-bebf-d93c-1d97-fe1c1cb7c780
OS Type:        exe
State:          running
CPU(s):         1
CPU time:       0.0s
Max memory:     600000 kB
Used memory:    460 kB
Persistent:     yes
Autostart:      disable
Managed save:   unknown

Note, as expected, Max memory is 600000 kB.

# virsh -c lxc:/// destroy toy
Domain toy destroyed

# virsh -c lxc:/// setmaxmem toy 800000

# echo $?
0

# virsh -c lxc:/// dominfo toy
Id:             -
Name:           toy
UUID:           d1f4798b-bebf-d93c-1d97-fe1c1cb7c780
OS Type:        exe
State:          shut off
CPU(s):         1
Max memory:     800000 kB
Used memory:    500000 kB
Persistent:     yes
Autostart:      disable
Managed save:   unknown

Note, as expected, Max memory is 800000 kB, but Used memory is 500000 kB, the guest is shut off state, is this a expected result?

# virsh -c lxc:/// start toy
Domain toy started

# virsh -c lxc:/// dominfo toy
Id:             24967
Name:           toy
UUID:           d1f4798b-bebf-d93c-1d97-fe1c1cb7c780
OS Type:        exe
State:          running
CPU(s):         1
CPU time:       0.0s
Max memory:     800000 kB
Used memory:    460 kB
Persistent:     yes
Autostart:      disable
Managed save:   unknown

Comment 14 Jiri Denemark 2012-02-02 10:56:58 UTC
Oh, I was finally able to think about this without being confused :-) I
believe this is the expected result. I guess you original domain XML had

    <memory>500000</memory>
    <currentMemory>500000</currentMemory>

Is that right? The "virsh dominfo" command prints "currentMemory" for inactive
domains but once the domain is started, "Used memory" is the real memory
consumed by the domain. Thus you see 460 kB (and not 500000 kB) when the
domain is running. When you destroy the domain, it becomes inactive and
dominfo starts printing "currentMemory" for "Used memory" again.

"setmaxmem" command only changes the "memory" element leaving "currentMemory"
untouched.

Comment 15 dyuan 2012-02-24 03:34:48 UTC
Move this bug to VERIFIED according to comment 12 and comment 14.

Comment 17 errata-xmlrpc 2012-06-20 06:20:58 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.

http://rhn.redhat.com/errata/RHSA-2012-0748.html


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