diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 67fb6240e6..b8ab068bc4 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -299,8 +299,14 @@ qemuDomainCheckEjectableMedia(virQEMUDriverPtr driver, if (!info) goto cleanup; - if (info->tray_open && virDomainDiskGetSource(disk)) - ignore_value(virDomainDiskSetSource(disk, NULL)); + if (info->tray_open) { + 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; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e3df26563c..2698178e3d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5457,6 +5457,10 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessUpdateVideoRamSize(driver, vm, asyncJob) < 0) goto cleanup; + VIR_DEBUG("Updating ejectable media status"); + if (qemuDomainCheckEjectableMedia(driver, vm, asyncJob) < 0) + goto cleanup; + if (flags & VIR_QEMU_PROCESS_START_AUTODESTROY && qemuProcessAutoDestroyAdd(driver, vm, conn) < 0) goto cleanup;