mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
qemuProcessRefreshDisks: Don't skip filling of disk information if tray state didn't change
Commit5ef2582646
added emitting of even when refreshign disk state, where it wanted to avoid sending the event if disk state didn't change. This was achieved by using 'continue' in the loop filling the information. Unfortunately this skips extraction of whether the device has a tray which is propagated into internal structures, which in turn broke cdrom media change as the code thought there's no tray for the device. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2166411 Fixes:5ef2582646
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
This commit is contained in:
parent
e4cf477701
commit
86cfe93ef7
@ -8715,16 +8715,13 @@ qemuProcessRefreshDisks(virDomainObj *vm,
|
||||
continue;
|
||||
|
||||
if (info->removable) {
|
||||
virObjectEvent *event = NULL;
|
||||
bool emitEvent = info->tray_open != disk->tray_status;
|
||||
int reason;
|
||||
|
||||
if (info->empty)
|
||||
virDomainDiskEmptySource(disk);
|
||||
|
||||
if (info->tray) {
|
||||
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;
|
||||
@ -8733,10 +8730,12 @@ qemuProcessRefreshDisks(virDomainObj *vm,
|
||||
disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
|
||||
}
|
||||
|
||||
event = virDomainEventTrayChangeNewFromObj(vm, disk->info.alias, reason);
|
||||
if (emitEvent) {
|
||||
virObjectEvent *event = virDomainEventTrayChangeNewFromObj(vm, disk->info.alias, reason);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* fill in additional data */
|
||||
diskpriv->removable = info->removable;
|
||||
|
Loading…
Reference in New Issue
Block a user