[libvirt PATCH 04/11] qemu_snapshot: revert: fix emitting events

Peter Krempa pkrempa at redhat.com
Tue Nov 16 15:04:50 UTC 2021


On Mon, Nov 15, 2021 at 17:22:47 +0100, Pavel Hrdina wrote:
> Now that we always restart the QEMU process events are emitted
> differently so we need to update the code and the comment as well.
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  src/qemu/qemu_snapshot.c | 37 ++++++++++---------------------------
>  1 file changed, 10 insertions(+), 27 deletions(-)
> 
> diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
> index 251a0e5cfa..e08959a754 100644
> --- a/src/qemu/qemu_snapshot.c
> +++ b/src/qemu/qemu_snapshot.c

[...]

> @@ -1865,15 +1864,14 @@ qemuSnapshotRevert(virDomainObj *vm,
>      /* We have the following transitions, which create the following events:
>       * 1. inactive -> inactive: none
>       * 2. inactive -> running:  EVENT_STARTED
> -     * 3. inactive -> paused:   EVENT_STARTED, EVENT_PAUSED
> +     * 3. inactive -> paused:   EVENT_STARTED, EVENT_SUSPENDED
>       * 4. running  -> inactive: EVENT_STOPPED
> -     * 5. running  -> running:  none
> -     * 6. running  -> paused:   EVENT_PAUSED
> +     * 5. running  -> running:  EVENT_STOPPED, EVENT_STARTED
> +     * 6. running  -> paused:   EVENT_STOPPED, EVENT_STARTED, EVENT_SUSPENDED
>       * 7. paused   -> inactive: EVENT_STOPPED
> -     * 8. paused   -> running:  EVENT_RESUMED
> -     * 9. paused   -> paused:   none
> -     * Also, several transitions occur even if we fail partway through,
> -     * and use of FORCE can cause multiple transitions.
> +     * 8. paused   -> running:  EVENT_STOPPED, EVENT_STARTED
> +     * 9. paused   -> paused:   EVENT_STOPPED, EVENT_STARTED, EVENT_SUSPENDED
> +     * Also, several transitions occur even if we fail partway through.
>       */
>  

[...]

> @@ -2053,15 +2045,6 @@ qemuSnapshotRevert(virDomainObj *vm,
>                                        QEMU_ASYNC_JOB_START);
>              if (rc < 0)
>                  goto endjob;
> -            virObjectUnref(event);
> -            event = NULL;
> -            if (was_stopped) {
> -                /* Transition 2 */
> -                detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT;
> -                event = virDomainEventLifecycleNewFromObj(vm,
> -                                                 VIR_DOMAIN_EVENT_STARTED,
> -                                                 detail);
> -            }

Okay so if I understand correctly, this was a duplicate 'STARTED' event
which would overwrite the previously assigned STARTED event.

Reviewed-by: Peter Krempa <pkrempa at redhat.com>




More information about the libvir-list mailing list