mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Update tray status while tray moved event is emitted
With this patch, libvirt won't start the guest with the medium source which already ejected by guest when doing migration, or saving/restoring.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user