mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: hotplug: Skip waiting for tray opening if qemu doesn't notify us
If qemu doesn't support DEVICE_TRAY_MOVED event the code that attempts to change media would attempt to re-eject the tray even if it wouldn't be notified when the tray opened. Add a capability bit and skip retrying for old qemus. (cherry picked from commit 833ae6b4356934e7b779c4be01bd2bf051930dde)
This commit is contained in:
parent
5247bd3aaf
commit
7dffff778e
@ -321,6 +321,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
|
||||
"qxl-vga.vram64_size_mb", /* 215 */
|
||||
"chardev-logfile",
|
||||
"debug-threads",
|
||||
"device-tray-moved-event",
|
||||
);
|
||||
|
||||
|
||||
@ -1493,6 +1494,7 @@ struct virQEMUCapsStringFlags virQEMUCapsEvents[] = {
|
||||
{ "DEVICE_DELETED", QEMU_CAPS_DEVICE_DEL_EVENT },
|
||||
{ "MIGRATION", QEMU_CAPS_MIGRATION_EVENT },
|
||||
{ "VSERPORT_CHANGE", QEMU_CAPS_VSERPORT_CHANGE },
|
||||
{ "DEVICE_TRAY_MOVED", QEMU_CAPS_DEVICE_TRAY_MOVED },
|
||||
};
|
||||
|
||||
struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
|
||||
|
@ -351,6 +351,7 @@ typedef enum {
|
||||
QEMU_CAPS_QXL_VGA_VRAM64, /* -device qxl-vga.vram64_size_mb */
|
||||
QEMU_CAPS_CHARDEV_LOGFILE, /* -chardev logfile=xxxx */
|
||||
QEMU_CAPS_NAME_DEBUG_THREADS, /* Is -name debug-threads= available */
|
||||
QEMU_CAPS_DEVICE_TRAY_MOVED, /* DEVICE_TRAY_MOVED event */
|
||||
|
||||
QEMU_CAPS_LAST /* this must always be the last item */
|
||||
} virQEMUCapsFlags;
|
||||
|
@ -202,6 +202,15 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* skip all retrying if qemu doesn't notify us on tray change */
|
||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_TRAY_MOVED)) {
|
||||
if (rc == 0)
|
||||
break;
|
||||
|
||||
if (rc < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (rc < 0) {
|
||||
/* we've already tried, error out */
|
||||
if (ejectRetry)
|
||||
|
@ -114,4 +114,5 @@
|
||||
<flag name='virtio-net'/>
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -129,4 +129,5 @@
|
||||
<flag name='virtio-net'/>
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -130,4 +130,5 @@
|
||||
<flag name='virtio-net'/>
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -139,4 +139,5 @@
|
||||
<flag name='virtio-net'/>
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -145,4 +145,5 @@
|
||||
<flag name='virtio-net'/>
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -145,4 +145,5 @@
|
||||
<flag name='virtio-net'/>
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -163,4 +163,5 @@
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='debug-threads'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -174,4 +174,5 @@
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='debug-threads'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -175,4 +175,5 @@
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='debug-threads'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -178,4 +178,5 @@
|
||||
<flag name='qxl.vram64_size_mb'/>
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='debug-threads'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
Loading…
x
Reference in New Issue
Block a user