mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemu: hotplug: wait for the tray to eject only for drives with a tray
Use the detected tray presence flag to trigger the tray waiting code only if the given storage device in qemu reports to have a tray. This is necessary as the floppy device lost it's tray as of qemu commit: commit abb3e55b5b718d6392441f56ba0729a62105ac56 Author: Max Reitz <mreitz@redhat.com> Date: Fri Jan 29 20:49:12 2016 +0100 Revert "hw/block/fdc: Implement tray status"
This commit is contained in:
parent
2e75da42e4
commit
72a7ff6b50
@ -208,6 +208,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
|||||||
int ret = -1, rc;
|
int ret = -1, rc;
|
||||||
char *driveAlias = NULL;
|
char *driveAlias = NULL;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||||
const char *format = NULL;
|
const char *format = NULL;
|
||||||
char *sourcestr = NULL;
|
char *sourcestr = NULL;
|
||||||
|
|
||||||
@ -236,8 +237,9 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
|||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* If the tray change event is supported wait for it to open. */
|
/* If the tray is present and tray change event is supported wait for it to open. */
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_TRAY_MOVED)) {
|
if (diskPriv->tray &&
|
||||||
|
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_TRAY_MOVED)) {
|
||||||
if (qemuHotplugWaitForTrayEject(driver, vm, disk, driveAlias, force) < 0)
|
if (qemuHotplugWaitForTrayEject(driver, vm, disk, driveAlias, force) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
@ -247,8 +249,6 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!virStorageSourceIsEmpty(newsrc)) {
|
if (!virStorageSourceIsEmpty(newsrc)) {
|
||||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
|
||||||
|
|
||||||
if (qemuGetDriveSourceString(newsrc, diskPriv->secinfo, &sourcestr) < 0)
|
if (qemuGetDriveSourceString(newsrc, diskPriv->secinfo, &sourcestr) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user