]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: process: Refresh ejectable media tray state on VM start
authorPeter Krempa <pkrempa@redhat.com>
Fri, 29 Apr 2016 11:38:51 +0000 (13:38 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 2 May 2016 06:49:34 +0000 (08:49 +0200)
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

src/qemu/qemu_hotplug.c
src/qemu/qemu_process.c

index ef8696be4690c0e202f20eb6f2bbf08a2ea6e0fc..ad4e7ab76e249bb1cf2ac1c5e8ec4f142e4e508c 100644 (file)
@@ -300,8 +300,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;
index 0ccc3ac64385de5d176a0887fb28e37bb5a9eb13..4a7c141b933fa2533fc2eeb5ee95390146a4cee6 100644 (file)
@@ -5555,6 +5555,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;