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)
7.2
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2015-09-07 04:23:01 EDT
Type: Bug
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 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):
Host:
Kernel:3.10.0-309.el7.x86_64
qemu-kvm-rhev:qemu-kvm-rhev-2.3.0-19.el7.x86_64

Guest:
Kernel:3.10.0-309.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. create domain xml file: (filename: rhel7.2.xml)
<domain type='kvm'>
  <name>rhel7.2</name>
  <uuid>d8e78fe4-4ca1-4bfa-ba09-db32dc532f38</uuid>
  <maxMemory slots='256' unit="KiB">41943040</maxMemory>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.2.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <vmport state='off'/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>SandyBridge</model>
    <numa>
      <cell id='0' cpus='0-3' memory='1048576' unit='KiB'/>
    </numa>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <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'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>
    </controller>
    <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>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/>
    </controller>
    <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'/>
    </controller>
    <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'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <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>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' autoport='yes'>
      <image compression='off'/>
    </graphics>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
</domain>

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'>
<target>
<size unit='KiB'>131072</size>
<node>0</node>
</target>
</memory>

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"}'
{"return":[{"device":"dimm0","source":3,"status":1,"slot":"0","slot-type":"DIMM"},{"source":0,"status":0,"slot":"1","slot-type":"DIMM"},{"source":0,"status":0,"slot":"2","slot-type":"DIMM"},{"source":0,"status":0,"slot":"3","slot-type":"DIMM"},{"source":0,"status":0,"slot":"4","slot-type":"DIMM"},{"source":0,"status":0,"slot":"5","slot-type":"DIMM"},
......(6-254).......
{"source":0,"status":0,"slot":"255","slot-type":"DIMM"}],"id":"libvirt-105"}


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.