mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu_process: add tray changed event to queue in refresh disks
There are some cases when the internal state of disks can change without qemu sending events about it (e.g. a disk can close during reset). In case this happens, we should emit an event about the modified disk. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1824722#c20 Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e6cd8b6eb3
commit
5ef2582646
@ -8673,6 +8673,7 @@ qemuProcessRefreshDisks(virDomainObj *vm,
|
||||
virDomainAsyncJob asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
virQEMUDriver *driver = priv->driver;
|
||||
g_autoptr(GHashTable) table = NULL;
|
||||
size_t i;
|
||||
|
||||
@ -8697,14 +8698,26 @@ qemuProcessRefreshDisks(virDomainObj *vm,
|
||||
continue;
|
||||
|
||||
if (info->removable) {
|
||||
virObjectEvent *event = NULL;
|
||||
int reason;
|
||||
|
||||
if (info->empty)
|
||||
virDomainDiskEmptySource(disk);
|
||||
|
||||
if (info->tray) {
|
||||
if (info->tray_open)
|
||||
if (info->tray_open == disk->tray_status)
|
||||
continue;
|
||||
|
||||
if (info->tray_open) {
|
||||
reason = VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN;
|
||||
disk->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN;
|
||||
else
|
||||
} else {
|
||||
reason = VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE;
|
||||
disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
|
||||
}
|
||||
|
||||
event = virDomainEventTrayChangeNewFromObj(vm, disk->info.alias, reason);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user