[libvirt] [PATCH 1/3] libxl: send lifecycle event on suspend

Jim Fehlig jfehlig at suse.com
Thu Aug 9 21:48:44 UTC 2018


On 08/05/2018 05:01 PM, Marek Marczykowski-Górecki wrote:
> Signed-off-by: Marek Marczykowski-Górecki <marmarek at invisiblethingslab.com>
> ---
>   src/libxl/libxl_domain.c | 20 ++++++++++++--------
>   1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 2ab78ac..b800bc9 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -520,6 +520,18 @@ libxlDomainShutdownThread(void *opaque)
>           case VIR_DOMAIN_LIFECYCLE_ACTION_LAST:
>               goto endjob;
>           }
> +    } else if (xl_reason == LIBXL_SHUTDOWN_REASON_SUSPEND) {
> +        virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
> +                             VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
> +
> +        dom_event = virDomainEventLifecycleNewFromObj(vm,
> +                                           VIR_DOMAIN_EVENT_PMSUSPENDED,
> +                                           VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY);
> +        /*
> +         * Similar to the xl implementation, ignore SUSPEND.  Any actions needed
> +         * after calling libxl_domain_suspend() are handled by it's callers.
> +         */
> +        goto endjob;
>       } else {
>           VIR_INFO("Unhandled shutdown_reason %d", xl_reason);
>           goto endjob;
> @@ -563,7 +575,6 @@ void
>   libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event)
>   {
>       libxlDriverPrivatePtr driver = data;
> -    libxl_shutdown_reason xl_reason = event->u.domain_shutdown.shutdown_reason;
>       struct libxlShutdownThreadInfo *shutdown_info = NULL;
>       virThread thread;
>       libxlDriverConfigPtr cfg;
> @@ -574,13 +585,6 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event)
>       }
>   
>       /*
> -     * Similar to the xl implementation, ignore SUSPEND.  Any actions needed
> -     * after calling libxl_domain_suspend() are handled by its callers.
> -     */
> -    if (xl_reason == LIBXL_SHUTDOWN_REASON_SUSPEND)
> -        goto error;
> -
> -    /*
>        * Start a thread to handle shutdown.  We don't want to be tying up
>        * libxl's event machinery by doing a potentially lengthy shutdown.
>        */
> 

Reviewed-by: Jim Fehlig <jfehlig at suse.com>

Regards,
Jim




More information about the libvir-list mailing list