Bug 1258312 - When un-hotplug memory failed, libvirt gives user a wrong message
When un-hotplug memory failed, libvirt gives user a wrong message
Status: CLOSED DUPLICATE of bug 993631
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2015-08-31 00:46 EDT by Pei Zhang
Modified: 2015-09-07 04:23 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-09-07 04:23:01 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Pei Zhang 2015-08-31 00:46:59 EDT
Description of problem:
When un-hotplug memory failed in guest, qemu returns failure status, but libvirt still prints "Device detached successfully". So libvirt gives user a wrong message.

Version-Release number of selected component (if applicable):


How reproducible:

Steps to Reproduce:
1. create domain xml file: (filename: rhel7.2.xml)
<domain type='kvm'>
  <maxMemory slots='256' unit="KiB">41943040</maxMemory>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>4</vcpu>
    <type arch='x86_64' machine='pc-i440fx-rhel7.2.0'>hvm</type>
    <boot dev='hd'/>
    <vmport state='off'/>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>SandyBridge</model>
      <cell id='0' cpus='0-3' memory='1048576' unit='KiB'/>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/rhel7.2.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    <interface type='bridge'>
      <mac address='52:54:00:b7:68:3d'/>
      <source bridge='switch'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    <serial type='pty'>
      <target port='0'/>
    <console type='pty'>
      <target type='serial' port='0'/>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/rhel7.1.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' autoport='yes'>
      <image compression='off'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    <redirdev bus='usb' type='spicevmc'>
    <redirdev bus='usb' type='spicevmc'>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>

2. define domain
# virsh define rhel7.2.xml
Domain rhel7.2 defined from rhel7.2.xml

3. start domain
# virsh start rhel7.2
Domain rhel7.2 started

4. create memory device xml (filename: memdevice.xml)
<memory model='dimm'>
<size unit='KiB'>131072</size>

5. hotplug memory
# virsh attach-device rhel7.2 memdevice.xml
Device attached successfully

6. unhotplug memory
# virsh detach-device rhel7.2 memdevice.xml
Device detached successfully

Actually, the memory is not removed, but 'Device detached successfully' is still printed. Below shows more details.

(1) qmp event
# virsh qemu-monitor-command rhel7.2 '{"execute":"query-acpi-ospm-status"}'

dimm0 'status' is 1 which may mean hot-remove fail.

(2)in guest 
# dmesg
[   19.423016] ACPI: \_SB_.MP00: ACPI_NOTIFY_DEVICE_CHECK event
[   19.423310] init_memory_mapping: [mem 0x100000000-0x107ffffff]
[   19.423313]  [mem 0x100000000-0x107ffffff] page 2M
[   19.426830] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 237216
[   19.426833] Policy zone: DMA32
[   19.430999] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 269984
[   19.431000] Policy zone: Normal
[   30.004479] ACPI: \_SB_.MP00: ACPI_NOTIFY_EJECT_REQUEST event
[   30.005028] memory memory32: Offline failed.

Actual results:
Libvirt prints 'Device detached successfully'.

Expected results:
Libvirt prints 'Device detached failed' or other error message.

Additional info:
When the memory is un-hotplug successfully, qemu will return:
{"source": 3, "status": 0, "slot": "0", "slot-type": "DIMM"}.
Comment 2 dyuan 2015-09-02 03:45:35 EDT
It should be a known issue for libvirt. See BZ993631 which is not fixed.
Comment 3 Peter Krempa 2015-09-07 04:23:01 EDT

*** This bug has been marked as a duplicate of bug 993631 ***

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