提交 e4a96909 编写于 作者: J John Ferlan

Separate out StateAutoStart from StateInitialize

Separation allows for dependent drivers to be make a connection during
the AutoStart phase of state initialization.
上级 99d3a60b
...@@ -1800,6 +1800,9 @@ typedef int ...@@ -1800,6 +1800,9 @@ typedef int
virStateInhibitCallback callback, virStateInhibitCallback callback,
void *opaque); void *opaque);
typedef void
(*virDrvStateAutoStart)(void);
typedef int typedef int
(*virDrvStateCleanup)(void); (*virDrvStateCleanup)(void);
...@@ -1815,6 +1818,7 @@ typedef virStateDriver *virStateDriverPtr; ...@@ -1815,6 +1818,7 @@ typedef virStateDriver *virStateDriverPtr;
struct _virStateDriver { struct _virStateDriver {
const char *name; const char *name;
virDrvStateInitialize stateInitialize; virDrvStateInitialize stateInitialize;
virDrvStateAutoStart stateAutoStart;
virDrvStateCleanup stateCleanup; virDrvStateCleanup stateCleanup;
virDrvStateReload stateReload; virDrvStateReload stateReload;
virDrvStateStop stateStop; virDrvStateStop stateStop;
......
...@@ -808,7 +808,11 @@ virRegisterStateDriver(virStateDriverPtr driver) ...@@ -808,7 +808,11 @@ virRegisterStateDriver(virStateDriverPtr driver)
* @callback: callback to invoke to inhibit shutdown of the daemon * @callback: callback to invoke to inhibit shutdown of the daemon
* @opaque: data to pass to @callback * @opaque: data to pass to @callback
* *
* Initialize all virtualization drivers. * Initialize all virtualization drivers. Accomplished in two phases,
* the first being state and structure initialization followed by any
* auto start supported by the driver. This is done to ensure dependencies
* that some drivers may have on another driver having been initialized
* will exist, such as the storage driver's need to use the secret driver.
* *
* Returns 0 if all succeed, -1 upon any failure. * Returns 0 if all succeed, -1 upon any failure.
*/ */
...@@ -836,6 +840,14 @@ int virStateInitialize(bool privileged, ...@@ -836,6 +840,14 @@ int virStateInitialize(bool privileged,
} }
} }
} }
for (i = 0; i < virStateDriverTabCount; i++) {
if (virStateDriverTab[i]->stateAutoStart) {
VIR_DEBUG("Running global auto start for %s state driver",
virStateDriverTab[i]->name);
virStateDriverTab[i]->stateAutoStart();
}
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册