Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
libvirt.19771
c5bf40bf-add-driver-shutdown-helpers.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File c5bf40bf-add-driver-shutdown-helpers.patch of Package libvirt.19771
commit c5bf40bfa6afa4ec27052120e268a55213709ca4 Author: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> Date: Thu Jul 9 10:46:34 2020 +0300 libvirt: add stateShutdownPrepare/stateShutdownWait to drivers stateShutdownPrepare 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@virtuozzo.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Index: libvirt-6.0.0/scripts/check-drivername.py =================================================================== --- libvirt-6.0.0.orig/scripts/check-drivername.py +++ libvirt-6.0.0/scripts/check-drivername.py @@ -50,6 +50,8 @@ for drvfile in drvfiles: "virDrvStateCleanup", "virDrvStateReload", "virDrvStateStop", + "virDrvStateShutdownPrepare", + "virDrvStateShutdownWait", "virDrvConnectSupportsFeature", "virDrvConnectURIProbe", "virDrvDomainMigratePrepare", Index: libvirt-6.0.0/src/driver-state.h =================================================================== --- libvirt-6.0.0.orig/src/driver-state.h +++ libvirt-6.0.0/src/driver-state.h @@ -44,6 +44,12 @@ typedef int typedef int (*virDrvStateStop)(void); +typedef int +(*virDrvStateShutdownPrepare)(void); + +typedef int +(*virDrvStateShutdownWait)(void); + typedef struct _virStateDriver virStateDriver; typedef virStateDriver *virStateDriverPtr; @@ -53,4 +59,6 @@ struct _virStateDriver { virDrvStateCleanup stateCleanup; virDrvStateReload stateReload; virDrvStateStop stateStop; + virDrvStateShutdownPrepare stateShutdownPrepare; + virDrvStateShutdownWait stateShutdownWait; }; Index: libvirt-6.0.0/src/libvirt.c =================================================================== --- libvirt-6.0.0.orig/src/libvirt.c +++ libvirt-6.0.0/src/libvirt.c @@ -653,6 +653,48 @@ virStateInitialize(bool privileged, /** + * virStateShutdownPrepare: + * + * Run each virtualization driver's shutdown prepare method. + * + * Returns 0 if all succeed, -1 upon any failure. + */ +int +virStateShutdownPrepare(void) +{ + size_t i; + + for (i = 0; i < virStateDriverTabCount; i++) { + if (virStateDriverTab[i]->stateShutdownPrepare && + virStateDriverTab[i]->stateShutdownPrepare() < 0) + return -1; + } + return 0; +} + + +/** + * virStateShutdownWait: + * + * Run each virtualization driver's shutdown wait method. + * + * Returns 0 if all succeed, -1 upon any failure. + */ +int +virStateShutdownWait(void) +{ + size_t i; + + for (i = 0; i < virStateDriverTabCount; i++) { + if (virStateDriverTab[i]->stateShutdownWait && + virStateDriverTab[i]->stateShutdownWait() < 0) + return -1; + } + return 0; +} + + +/** * virStateCleanup: * * Run each virtualization driver's cleanup method. Index: libvirt-6.0.0/src/libvirt_internal.h =================================================================== --- libvirt-6.0.0.orig/src/libvirt_internal.h +++ libvirt-6.0.0/src/libvirt_internal.h @@ -33,6 +33,8 @@ int virStateInitialize(bool privileged, bool mandatory, virStateInhibitCallback inhibit, void *opaque); +int virStateShutdownPrepare(void); +int virStateShutdownWait(void); int virStateCleanup(void); int virStateReload(void); int virStateStop(void); Index: libvirt-6.0.0/src/libvirt_private.syms =================================================================== --- libvirt-6.0.0.orig/src/libvirt_private.syms +++ libvirt-6.0.0/src/libvirt_private.syms @@ -1413,6 +1413,8 @@ virSetSharedStorageDriver; virStateCleanup; virStateInitialize; virStateReload; +virStateShutdownPrepare; +virStateShutdownWait; virStateStop; virStreamInData;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor