mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 17:18:01 +03:00
Introduce a 'stop' method to virDriverState
To allow actions to be performed in libvirtd when the host shuts down, or user session exits, introduce a 'stop' method to virDriverState. This will do things like saving the VM state to a file. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
992ed55fea
commit
d442ee23bd
@ -1504,6 +1504,7 @@ typedef int (*virDrvStateInitialize) (int privileged);
|
||||
typedef int (*virDrvStateCleanup) (void);
|
||||
typedef int (*virDrvStateReload) (void);
|
||||
typedef int (*virDrvStateActive) (void);
|
||||
typedef int (*virDrvStateStop) (void);
|
||||
|
||||
typedef struct _virStateDriver virStateDriver;
|
||||
typedef virStateDriver *virStateDriverPtr;
|
||||
@ -1514,6 +1515,7 @@ struct _virStateDriver {
|
||||
virDrvStateCleanup cleanup;
|
||||
virDrvStateReload reload;
|
||||
virDrvStateActive active;
|
||||
virDrvStateStop stop;
|
||||
};
|
||||
# endif
|
||||
|
||||
|
@ -869,6 +869,24 @@ int virStateActive(void) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* virStateStop:
|
||||
*
|
||||
* Run each virtualization driver's "stop" method.
|
||||
*
|
||||
* Returns 0 if successful, -1 on failure
|
||||
*/
|
||||
int virStateStop(void) {
|
||||
int i, ret = 0;
|
||||
|
||||
for (i = 0 ; i < virStateDriverTabCount ; i++) {
|
||||
if (virStateDriverTab[i]->stop &&
|
||||
virStateDriverTab[i]->stop())
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -8,3 +8,4 @@ virStateActive;
|
||||
virStateCleanup;
|
||||
virStateInitialize;
|
||||
virStateReload;
|
||||
virStateStop;
|
||||
|
@ -32,6 +32,7 @@ int virStateInitialize(int privileged);
|
||||
int virStateCleanup(void);
|
||||
int virStateReload(void);
|
||||
int virStateActive(void);
|
||||
int virStateStop(void);
|
||||
# endif
|
||||
|
||||
/* Feature detection. This is a libvirt-private interface for determining
|
||||
|
Loading…
Reference in New Issue
Block a user