qemu: process: Refresh ejectable media tray state on VM start

Empty floppy drives start with tray in "open" state and libvirt did not
refresh it after startup. The code that inserts media into the tray then
waited until the tray was open before inserting the media and thus
floppies could not be inserted.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1326660
(cherry picked from commit a34faf33011c5c0d7b47ee0849bf1e11635e17c5)
This commit is contained in:
Peter Krempa 2016-04-29 13:38:51 +02:00 committed by Cole Robinson
parent b73dc2e56b
commit f6721a3d9a
2 changed files with 12 additions and 2 deletions

View File

@ -299,8 +299,14 @@ qemuDomainCheckEjectableMedia(virQEMUDriverPtr driver,
if (!info) if (!info)
goto cleanup; goto cleanup;
if (info->tray_open && virDomainDiskGetSource(disk)) if (info->tray_open) {
ignore_value(virDomainDiskSetSource(disk, NULL)); if (virDomainDiskGetSource(disk))
ignore_value(virDomainDiskSetSource(disk, NULL));
disk->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN;
} else {
disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
}
} }
ret = 0; ret = 0;

View File

@ -5457,6 +5457,10 @@ qemuProcessLaunch(virConnectPtr conn,
if (qemuProcessUpdateVideoRamSize(driver, vm, asyncJob) < 0) if (qemuProcessUpdateVideoRamSize(driver, vm, asyncJob) < 0)
goto cleanup; goto cleanup;
VIR_DEBUG("Updating ejectable media status");
if (qemuDomainCheckEjectableMedia(driver, vm, asyncJob) < 0)
goto cleanup;
if (flags & VIR_QEMU_PROCESS_START_AUTODESTROY && if (flags & VIR_QEMU_PROCESS_START_AUTODESTROY &&
qemuProcessAutoDestroyAdd(driver, vm, conn) < 0) qemuProcessAutoDestroyAdd(driver, vm, conn) < 0)
goto cleanup; goto cleanup;