[PATCH 3/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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 574477e916..0caf75659c 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -82,8 +82,12 @@ static inline int
 qemuDomainDeleteDevice(qemuMonitorPtr mon,
                        const char *alias)
 {
-    if (qemuMonitorDelDevice(mon, alias) < 0)
+    if (qemuMonitorDelDevice(mon, alias) < 0) {
+        virObjectUnlock(mon);
+        sleep(10);
+        virObjectLock(mon);
         return -1;
+    }
 
     return 0;
 }
-- 
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