[libvirt] [PATCH 2/2] qemu: emit 'defined' event after reverted to snapshot

John Ferlan jferlan at redhat.com
Mon Dec 14 20:10:31 UTC 2015



On 12/09/2015 03:29 AM, Dmitry Andreev wrote:
> Config file is changed. VIR_DOMAIN_EVENT_DEFINED should be emitted
> ---
>  src/qemu/qemu_driver.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index ae1d8e7..b32172a 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -15293,6 +15293,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
>      virDomainSnapshotObjPtr snap = NULL;
>      virObjectEventPtr event = NULL;
>      virObjectEventPtr event2 = NULL;
> +    virObjectEventPtr define_event = NULL;
>      int detail;
>      qemuDomainObjPrivatePtr priv;
>      int rc;
> @@ -15401,6 +15402,9 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
>          config = virDomainDefCopy(snap->def->dom, caps, driver->xmlopt, true);
>          if (!config)
>              goto endjob;
> +        define_event = virDomainEventLifecycleNewFromObj(vm,
> +                                     VIR_DOMAIN_EVENT_DEFINED,
> +                                     VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT);
>      }
>  
>      switch ((virDomainState) snap->def->state) {
> @@ -15627,6 +15631,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
>      } else if (snap) {
>          snap->def->current = false;
>      }
> +    qemuDomainEventQueue(driver, define_event);

I think this can go right after the generation of the event. That way it
can come "in order"...

Following the rest of the logic, event can be queued as it happens and
then "reused" in a few instances prior to event2 being generated. Then
at cleanup the most recent event and event2 get queued.

If you're OK with me moving that, then I can do so and push the two patches.

John
>      if (event) {
>          qemuDomainEventQueue(driver, event);
>          qemuDomainEventQueue(driver, event2);
> 




More information about the libvir-list mailing list