[PATCH 06/11] qemu: Update tray status while tray moved event is emitted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this patch, libvirt won't start the guest with the medium
source which already ejected by guest when doing migration, or
saving/restoring.
---
 src/qemu/qemu_process.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b6e14ad..7511d4e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1038,6 +1038,16 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
         event = virDomainEventTrayChangeNewFromObj(vm,
                                                    devAlias,
                                                    reason);
+        /* Update disk tray status */
+        if (reason == VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN)
+            disk->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN;
+        else if (reason == VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE)
+            disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
+
+        if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
+            VIR_WARN("Unable to save status on vm %s after tray moved event",
+                     vm->def->name);
+        }
     }
 
     virDomainObjUnlock(vm);
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]