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 */
|
"qxl-vga.vram64_size_mb", /* 215 */
|
||||||
"chardev-logfile",
|
"chardev-logfile",
|
||||||
"debug-threads",
|
"debug-threads",
|
||||||
|
"device-tray-moved-event",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1493,6 +1494,7 @@ struct virQEMUCapsStringFlags virQEMUCapsEvents[] = {
|
|||||||
{ "DEVICE_DELETED", QEMU_CAPS_DEVICE_DEL_EVENT },
|
{ "DEVICE_DELETED", QEMU_CAPS_DEVICE_DEL_EVENT },
|
||||||
{ "MIGRATION", QEMU_CAPS_MIGRATION_EVENT },
|
{ "MIGRATION", QEMU_CAPS_MIGRATION_EVENT },
|
||||||
{ "VSERPORT_CHANGE", QEMU_CAPS_VSERPORT_CHANGE },
|
{ "VSERPORT_CHANGE", QEMU_CAPS_VSERPORT_CHANGE },
|
||||||
|
{ "DEVICE_TRAY_MOVED", QEMU_CAPS_DEVICE_TRAY_MOVED },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
|
struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
|
||||||
|
@ -351,6 +351,7 @@ typedef enum {
|
|||||||
QEMU_CAPS_QXL_VGA_VRAM64, /* -device qxl-vga.vram64_size_mb */
|
QEMU_CAPS_QXL_VGA_VRAM64, /* -device qxl-vga.vram64_size_mb */
|
||||||
QEMU_CAPS_CHARDEV_LOGFILE, /* -chardev logfile=xxxx */
|
QEMU_CAPS_CHARDEV_LOGFILE, /* -chardev logfile=xxxx */
|
||||||
QEMU_CAPS_NAME_DEBUG_THREADS, /* Is -name debug-threads= available */
|
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 */
|
QEMU_CAPS_LAST /* this must always be the last item */
|
||||||
} virQEMUCapsFlags;
|
} virQEMUCapsFlags;
|
||||||
|
@ -202,6 +202,15 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
|||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
goto cleanup;
|
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) {
|
if (rc < 0) {
|
||||||
/* we've already tried, error out */
|
/* we've already tried, error out */
|
||||||
if (ejectRetry)
|
if (ejectRetry)
|
||||||
|
@ -114,4 +114,5 @@
|
|||||||
<flag name='virtio-net'/>
|
<flag name='virtio-net'/>
|
||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -129,4 +129,5 @@
|
|||||||
<flag name='virtio-net'/>
|
<flag name='virtio-net'/>
|
||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -130,4 +130,5 @@
|
|||||||
<flag name='virtio-net'/>
|
<flag name='virtio-net'/>
|
||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -139,4 +139,5 @@
|
|||||||
<flag name='virtio-net'/>
|
<flag name='virtio-net'/>
|
||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -145,4 +145,5 @@
|
|||||||
<flag name='virtio-net'/>
|
<flag name='virtio-net'/>
|
||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -145,4 +145,5 @@
|
|||||||
<flag name='virtio-net'/>
|
<flag name='virtio-net'/>
|
||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -163,4 +163,5 @@
|
|||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
<flag name='debug-threads'/>
|
<flag name='debug-threads'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -174,4 +174,5 @@
|
|||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
<flag name='debug-threads'/>
|
<flag name='debug-threads'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -175,4 +175,5 @@
|
|||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
<flag name='debug-threads'/>
|
<flag name='debug-threads'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
@ -178,4 +178,5 @@
|
|||||||
<flag name='qxl.vram64_size_mb'/>
|
<flag name='qxl.vram64_size_mb'/>
|
||||||
<flag name='qxl-vga.vram64_size_mb'/>
|
<flag name='qxl-vga.vram64_size_mb'/>
|
||||||
<flag name='debug-threads'/>
|
<flag name='debug-threads'/>
|
||||||
|
<flag name='device-tray-moved-event'/>
|
||||||
</qemuCaps>
|
</qemuCaps>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user