mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +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.
This commit is contained in:
parent
a34faf3301
commit
833ae6b435
@ -325,6 +325,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
|
||||
"pxb",
|
||||
|
||||
"pxb-pcie", /* 220 */
|
||||
"device-tray-moved-event",
|
||||
);
|
||||
|
||||
|
||||
@ -1498,6 +1499,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[] = {
|
||||
|
@ -356,6 +356,7 @@ typedef enum {
|
||||
|
||||
/* 220 */
|
||||
QEMU_CAPS_DEVICE_PXB_PCIE, /* -device pxb-pcie */
|
||||
QEMU_CAPS_DEVICE_TRAY_MOVED, /* DEVICE_TRAY_MOVED event */
|
||||
|
||||
QEMU_CAPS_LAST /* this must always be the last item */
|
||||
} virQEMUCapsFlags;
|
||||
|
@ -203,6 +203,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)
|
||||
|
@ -113,4 +113,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>
|
||||
|
@ -128,4 +128,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>
|
||||
|
@ -138,4 +138,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>
|
||||
|
@ -144,4 +144,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>
|
||||
|
@ -144,4 +144,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>
|
||||
|
@ -162,4 +162,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-vga.vram64_size_mb'/>
|
||||
<flag name='debug-threads'/>
|
||||
<flag name='pxb'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -175,4 +175,5 @@
|
||||
<flag name='qxl-vga.vram64_size_mb'/>
|
||||
<flag name='debug-threads'/>
|
||||
<flag name='pxb'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
@ -180,4 +180,5 @@
|
||||
<flag name='secret'/>
|
||||
<flag name='pxb'/>
|
||||
<flag name='pxb-pcie'/>
|
||||
<flag name='device-tray-moved-event'/>
|
||||
</qemuCaps>
|
||||
|
Loading…
x
Reference in New Issue
Block a user