Bug 589849 - [LXC] Changing shutoff guest max memory can effect current memory
[LXC] Changing shutoff guest max memory can effect current memory
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.0
i386 Linux
low Severity medium
: rc
: ---
Assigned To: Jiri Denemark
Virtualization Bugs
:
Depends On:
Blocks: Rhel6.1LibvirtTier1
  Show dependency treegraph
 
Reported: 2010-05-07 01:20 EDT by zhanghaiyan
Modified: 2012-06-20 02:20 EDT (History)
9 users (show)

See Also:
Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 02:20:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description zhanghaiyan 2010-05-07 01:20:29 EDT
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 Product and Program Management 2010-05-07 02:40:39 EDT
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 Berrange 2010-10-11 11:16:46 EDT
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 09:19:46 EST
This appears to be fixed on current libvirt git (v0.9.7-179-g6b84ee3). Moving to POST.
Comment 12 Alex Jia 2012-01-10 05:33:17 EST
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 05:56:58 EST
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-23 22:34:48 EST
Move this bug to VERIFIED according to comment 12 and comment 14.
Comment 17 errata-xmlrpc 2012-06-20 02:20:58 EDT
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.