提交 d442ee23 编写于 作者: D Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
上级 992ed55f
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册