mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: Map running reason to resume event detail
Thanks to the previous commit the RESUME event handler knows what reason should be used when changing the domain state to VIR_DOMAIN_RUNNING, but the emitted VIR_DOMAIN_EVENT_RESUMED event still uses a generic VIR_DOMAIN_EVENT_RESUMED_UNPAUSED detail. Luckily, the event detail can be easily deduced from the running reason, which saves us from having to pass one more value to the handler. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
5dab984ed0
commit
8ae9b49f5a
@ -13505,3 +13505,32 @@ qemuDomainStorageIdReset(qemuDomainObjPrivatePtr priv)
|
||||
{
|
||||
priv->nodenameindex = 0;
|
||||
}
|
||||
|
||||
|
||||
virDomainEventResumedDetailType
|
||||
qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case VIR_DOMAIN_RUNNING_RESTORED:
|
||||
case VIR_DOMAIN_RUNNING_FROM_SNAPSHOT:
|
||||
return VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT;
|
||||
|
||||
case VIR_DOMAIN_RUNNING_MIGRATED:
|
||||
case VIR_DOMAIN_RUNNING_MIGRATION_CANCELED:
|
||||
return VIR_DOMAIN_EVENT_RESUMED_MIGRATED;
|
||||
|
||||
case VIR_DOMAIN_RUNNING_POSTCOPY:
|
||||
return VIR_DOMAIN_EVENT_RESUMED_POSTCOPY;
|
||||
|
||||
case VIR_DOMAIN_RUNNING_UNKNOWN:
|
||||
case VIR_DOMAIN_RUNNING_SAVE_CANCELED:
|
||||
case VIR_DOMAIN_RUNNING_BOOTED:
|
||||
case VIR_DOMAIN_RUNNING_UNPAUSED:
|
||||
case VIR_DOMAIN_RUNNING_WAKEUP:
|
||||
case VIR_DOMAIN_RUNNING_CRASHED:
|
||||
case VIR_DOMAIN_RUNNING_LAST:
|
||||
break;
|
||||
}
|
||||
|
||||
return VIR_DOMAIN_EVENT_RESUMED_UNPAUSED;
|
||||
}
|
||||
|
@ -1082,4 +1082,7 @@ char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv);
|
||||
unsigned int qemuDomainStorageIdNew(qemuDomainObjPrivatePtr priv);
|
||||
void qemuDomainStorageIdReset(qemuDomainObjPrivatePtr priv);
|
||||
|
||||
virDomainEventResumedDetailType
|
||||
qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason);
|
||||
|
||||
#endif /* __QEMU_DOMAIN_H__ */
|
||||
|
@ -714,6 +714,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
virDomainRunningReason reason = VIR_DOMAIN_RUNNING_UNPAUSED;
|
||||
virDomainEventResumedDetailType eventDetail;
|
||||
|
||||
virObjectLock(vm);
|
||||
|
||||
@ -729,14 +730,16 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
eventDetail = qemuDomainRunningReasonToResumeEvent(reason);
|
||||
VIR_DEBUG("Transitioned guest %s out of paused into resumed state, "
|
||||
"reason '%s'",
|
||||
vm->def->name, virDomainRunningReasonTypeToString(reason));
|
||||
"reason '%s', event detail %d",
|
||||
vm->def->name, virDomainRunningReasonTypeToString(reason),
|
||||
eventDetail);
|
||||
|
||||
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
|
||||
event = virDomainEventLifecycleNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_RESUMED,
|
||||
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
|
||||
eventDetail);
|
||||
|
||||
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
|
||||
VIR_WARN("Unable to save status on vm %s after state change",
|
||||
|
Loading…
x
Reference in New Issue
Block a user