Bug 1414393
Summary: | Device present in the domain XML after VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED was received | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Milan Zamazal <mzamazal> | ||||
Component: | libvirt | Assignee: | Peter Krempa <pkrempa> | ||||
Status: | CLOSED ERRATA | QA Contact: | Jing Qi <jinqi> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 7.3 | CC: | dyuan, jdenemar, pkrempa, pzhang, rbalakri, xuzhang, yalzhang | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | libvirt-3.1.0-1.el7 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2017-08-01 17:21:45 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
The event was emitted prior to accessing the monitor to delete the memory backends and thus it was possible to get the XML at the time when the memory element was still present. Posted https://www.redhat.com/archives/libvir-list/2017-January/msg00914.html to address the issue. Fixed upstream: commit 1d4fd2dd0fe0ebde9a9c61ebc4326b4181092d58 Author: Peter Krempa <pkrempa> Date: Fri Jan 20 14:24:35 2017 +0100 qemu: hotplug: Properly emit "DEVICE_DELETED" event when unplugging memory The event needs to be emitted after the last monitor call, so that it's not possible to find the device in the XML accidentally while the vm object is unlocked. Verified with libvirt-3.2.0-3.el7.x86_64 and qemu-kvm-rhev-2.9.0-3.el7.x86_64 Domain xml: <maxMemory slots='16' unit='KiB'>25600000</maxMemory> <memory unit='KiB'>4048896</memory> <currentMemory unit='KiB'>4048896</currentMemory> Mem.xml <memory model='dimm'> <target> <size unit='m'>500</size> <node>0</node> </target> </memory> # virsh attach-device rhel7.4 mem.xml Device attached successfully # virsh detach-device rhel7.4 mem.xml Device detached successfully # python2 device-removal-bug.py rhel7.4 Device removal reported DIMM no longer present in the domain 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. https://access.redhat.com/errata/RHEA-2017:1846 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. https://access.redhat.com/errata/RHEA-2017:1846 |
Created attachment 1242125 [details] Python test script Description of problem: When a VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event is received, the given device may still be present in the domain XML returned from libvirt for a short while afterwards. It eventually disappears, but its temporary presence may cause trouble. For instance, when a memory device is hotunplugged and the corresponding event is received, the domain XML may contain not only the supposedly already removed device but also obsolete information about the VM memory size. Version-Release number of selected component (if applicable): libvirt-2.0.0-10.el7_3.4.x86_64 qemu-kvm-rhev-2.6.0-28.el7_3.3.x86_64 How reproducible: Most of the time on my machine. Steps to Reproduce: 1. Run a VM with a guest OS supporting memory hotplug and hotunplug (such as RHEL/CentOS 7.3 x86_64). 2. Register a callback on device removal in libvirt API. 3. Hotplug a DIMM device into the VM. 4. Hotunplug the DIMM device from the VM. 5. Fetch the domain XML in the device removal callback. It may still contain the removed DIMM. The attached test script demonstrates the problem. You can use it (at your own risk!) for steps 2.-5. above: sudo python2 device-removal-bug.py DOMAIN-NAME where DOMAIN-NAME is the name of the already running VM. Actual results: Sometimes output like this from the test script, the DIMM is present in the domain XML retrieved in the callback: Device removal reported ERROR: DIMM still present in the domain XML DIMM no longer present in the domain XML Expected results: Always output like this from the test script, the DIMM is never present in the domain XML retrieved in the callback: Device removal reported DIMM no longer present in the domain XML Additional info: