[PATCH 01/10] libvirt: add stateShutdown/stateShutdownWait to drivers

Daniel P. Berrangé berrange at redhat.com
Tue Jul 21 15:31:42 UTC 2020


On Tue, Jul 14, 2020 at 12:32:52PM +0300, Nikolay Shirokovskiy wrote:
> stateShutdown is supposed to inform driver that it will be closed soon so that
> the driver can prepare and finish all background threads quickly on
> stateShutdownWait call.
> 
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
> ---
>  scripts/check-drivername.py |  2 ++
>  src/driver-state.h          |  8 ++++++++
>  src/libvirt.c               | 42 ++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_internal.h      |  2 ++
>  4 files changed, 54 insertions(+)
> 
> diff --git a/scripts/check-drivername.py b/scripts/check-drivername.py
> index 39eff83..19d1cd1 100644
> --- a/scripts/check-drivername.py
> +++ b/scripts/check-drivername.py
> @@ -50,6 +50,8 @@ for drvfile in drvfiles:
>                      "virDrvStateCleanup",
>                      "virDrvStateReload",
>                      "virDrvStateStop",
> +                    "virDrvStateShutdown",
> +                    "virDrvStateShutdownWait",
>                      "virDrvConnectSupportsFeature",
>                      "virDrvConnectURIProbe",
>                      "virDrvDomainMigratePrepare",
> diff --git a/src/driver-state.h b/src/driver-state.h
> index 6b3f501..1f664f3 100644
> --- a/src/driver-state.h
> +++ b/src/driver-state.h
> @@ -45,6 +45,12 @@ typedef int
>  typedef int
>  (*virDrvStateStop)(void);
>  
> +typedef int
> +(*virDrvStateShutdown)(void);
> +
> +typedef int
> +(*virDrvStateShutdownWait)(void);

This is a bit of a bikeshedding comment, but I would have called
them   "StateShutdownPrepare" and "StateShutdownComplete" (or Wait)
just to make it slightly clearer that the first method is just
intended to kick off a shutdown asynchronously.

The design overall looks fine though, so regardless of the name

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list