[PATCH v3 2/5] DO NOT APPLY: Simple reproducer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=1623389

Steps to reproduce:

1) cat shmem.xml
    <shmem name='my_shmem0'>
      <model type='ivshmem-plain'/>
      <size unit='M'>4</size>
      <alias name='ua-123'/>
    </shmem>

2) virsh attach-device vm1 shmem.xml

3) virsh detach-device-alias vm1 ua-123; virsh detach-device vm1 shmem.xml

4) observe that the device is still in the domain:
   virsh dumpxml vm1
    <shmem name='my_shmem0'>
      <model type='ivshmem-plain'/>
      <size unit='M'>4</size>
      <alias name='ua-123'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </shmem>

5) But qemu has the device no more:
   virsh detach-device-alias vm1 ua-123
   error: Failed to detach device with alias ua-123
   error: internal error: unable to execute QEMU command 'device_del': Device 'ua-123' not found

This reproducer is to make sure that DELETE_DEVICE event arrives
while monitor is unlocked. It is very hard to time qemu and
libvirt so that the event comes exactly at the time when
detach-device from 3) is doing the monitor call. Simulate this by
unlocking monitor, waiting a few seconds and locking the monitor
again.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_hotplug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0a3ee2628c..c4a0971a65 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -98,6 +98,11 @@ qemuDomainDeleteDevice(virDomainObjPtr vm,
     qemuDomainObjEnterMonitor(driver, vm);
 
     rc = qemuMonitorDelDevice(priv->mon, alias);
+    if (rc < 0) {
+        virObjectUnlock(priv->mon);
+        sleep(10);
+        virObjectLock(priv->mon);
+    }
 
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         rc = -1;
-- 
2.19.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux