[libvirt] [PATCH 1/2] Revert "libxl: send lifecycle event on suspend"

Daniel Henrique Barboza danielhb413 at gmail.com
Tue Aug 20 13:49:09 UTC 2019



On 8/13/19 6:06 PM, Jim Fehlig wrote:
> A libxl event with shutdown reason LIBXL_SHUTDOWN_REASON_SUSPEND
> is sent after a domain is successfully suspended, which could result
> from suspending the domain to file (virDomainSave), suspending it to
> socket (virDomainMigrate), or suspending it to memory
> (virDomainPMSuspendForDuration). Commit d00c77ae changed the event
> handler to always set domain state to VIR_DOMAIN_PMSUSPENDED when
> LIBXL_SHUTDOWN_REASON_SUSPEND is received. The causes a persistent
> domain to show state "pmsuspended" after a successful migrate or save
> operation. Revert the commit and ignore the suspend event as before.
>
> This reverts commit d00c77ae45c7d9fd90384f01cd8b04c54f501e96.
>
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---

(pure code review, sadly I don't have access to a XEN env to test it)

Reviewed-by: Daniel Henrique Barboza <danielhb413 at gmail.com>

>   src/libxl/libxl_domain.c | 19 ++++++++-----------
>   1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index b60511a266..4073bf8d46 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -559,17 +559,6 @@ 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.
> -         */
>   #ifdef LIBXL_HAVE_SOFT_RESET
>       } else if (xl_reason == LIBXL_SHUTDOWN_REASON_SOFT_RESET) {
>           libxlDomainObjPrivatePtr priv = vm->privateData;
> @@ -669,6 +658,7 @@ 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;
> @@ -680,6 +670,13 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event)
>           goto error;
>       }
>   
> +    /*
> +     * 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.




More information about the libvir-list mailing list