Bug 808522

Summary: regression in parsing libvirt-generated xml memory limits
Product: Red Hat Enterprise Linux 6 Reporter: Eric Blake <eblake>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, ajia, dallan, dyasny, dyuan, eblake, gsun, mzhan, rwu, veillard
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.10-10.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 796526 Environment:
Last Closed: 2012-06-20 06:51:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 796526, 813972    
Bug Blocks:    

Comment 1 Eric Blake 2012-03-30 15:24:21 UTC
The correct fix is to relax the parser to accept up to a megabyte discrepancy (since that's all the more that the qemu driver would introduce) and round down current memory when a discrepancy is found; as well as to fix the qemu driver to update the xml when rounding occurs.

Comment 2 Eric Blake 2012-03-30 15:56:31 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2012-March/msg01343.html

Comment 6 dyuan 2012-04-25 09:03:17 UTC
Verified with libvirt-0.9.10-14.el6.

Create a guest with the following xml:

  <memory unit='MB'>1000</memory>
  <currentMemory unit='MB'>1000</currentMemory>

# virsh dumpxml xp|grep mem -i
  <memory unit='KiB'>976896</memory>
  <currentMemory unit='KiB'>976896</currentMemory>

And the mem is using correct in guest.

Reproduce this bug with libvirt-0.9.10-9.el6.

Create a guest with the following xml:

  <memory unit='MB'>1000</memory>
  <currentMemory unit='MB'>1000</currentMemory>

# virsh dumpxml xp
  <memory unit='KiB'>976563</memory>
  <currentMemory unit='KiB'>976896</currentMemory>

# virsh list
 Id    Name                           State
----------------------------------------------------
 1     xp                           running

# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]

# virsh list
 Id    Name                           State
----------------------------------------------------

but the qemu process is still existing.

# ps aux|grep qemu
qemu     23391 37.4 13.8 2175244 1050520 ?     Sl   16:16   0:38 /usr/libexec/qemu-kvm -S -M rhel6.3.0 -enable-kvm -m 954 -smp 4,sockets=4,cores=1,threads=1 -name xp -uuid 18585065-c348-1c4f-46b9-fdfee279543b -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/xp.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/var/lib/libvirt/images/winXP-32-virtio.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/usr/share/virtio-win/virtio-win.vfd,if=none,id=drive-fdc0-0-0,format=raw,cache=none -global isa-fdc.driveA=drive-fdc0-0-0 -netdev tap,fd=22,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:3a:5f:6c,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5900,addr=127.0.0.1,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -device qxl,id=video1,vram_size=67108864,bus=pci.0,addr=0x7 -device qxl,id=video2,vram_size=67108864,bus=pci.0,addr=0x8 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6

Comment 8 errata-xmlrpc 2012-06-20 06:51:36 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