提交 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); ...@@ -1504,6 +1504,7 @@ typedef int (*virDrvStateInitialize) (int privileged);
typedef int (*virDrvStateCleanup) (void); typedef int (*virDrvStateCleanup) (void);
typedef int (*virDrvStateReload) (void); typedef int (*virDrvStateReload) (void);
typedef int (*virDrvStateActive) (void); typedef int (*virDrvStateActive) (void);
typedef int (*virDrvStateStop) (void);
typedef struct _virStateDriver virStateDriver; typedef struct _virStateDriver virStateDriver;
typedef virStateDriver *virStateDriverPtr; typedef virStateDriver *virStateDriverPtr;
...@@ -1514,6 +1515,7 @@ struct _virStateDriver { ...@@ -1514,6 +1515,7 @@ struct _virStateDriver {
virDrvStateCleanup cleanup; virDrvStateCleanup cleanup;
virDrvStateReload reload; virDrvStateReload reload;
virDrvStateActive active; virDrvStateActive active;
virDrvStateStop stop;
}; };
# endif # endif
......
...@@ -869,6 +869,24 @@ int virStateActive(void) { ...@@ -869,6 +869,24 @@ int virStateActive(void) {
return ret; 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 #endif
......
...@@ -8,3 +8,4 @@ virStateActive; ...@@ -8,3 +8,4 @@ virStateActive;
virStateCleanup; virStateCleanup;
virStateInitialize; virStateInitialize;
virStateReload; virStateReload;
virStateStop;
...@@ -32,6 +32,7 @@ int virStateInitialize(int privileged); ...@@ -32,6 +32,7 @@ int virStateInitialize(int privileged);
int virStateCleanup(void); int virStateCleanup(void);
int virStateReload(void); int virStateReload(void);
int virStateActive(void); int virStateActive(void);
int virStateStop(void);
# endif # endif
/* Feature detection. This is a libvirt-private interface for determining /* 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.
先完成此消息的编辑!
想要评论请 注册