提交 7fb36c7b 编写于 作者: J Jim Fehlig

libxl: include a pointer to the driver in libxlDomainObjPrivate

Include a pointer to the libxl driver in libxlDomainObjPrivate
object so it can be used in the domain event handler and
shutdown thread.
Signed-off-by: NJim Fehlig <jfehlig@suse.com>
上级 3182448f
......@@ -737,10 +737,11 @@ libxlDomainCleanupJob(libxlDriverPrivatePtr driver,
* Register for domain events emitted by libxl.
*/
int
libxlDomainEventsRegister(virDomainObjPtr vm)
libxlDomainEventsRegister(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
{
libxlDomainObjPrivatePtr priv = vm->privateData;
priv->driver = driver;
libxl_event_register_callbacks(priv->ctx, &ev_hooks, vm);
/* Always enable domain death events */
......@@ -1018,7 +1019,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
* be cleaned up if there are any subsequent failures.
*/
vm->def->id = domid;
if (libxlDomainEventsRegister(vm) < 0)
if (libxlDomainEventsRegister(driver, vm) < 0)
goto cleanup_dom;
if ((dom_xml = virDomainDefFormat(vm->def, 0)) == NULL)
......
......@@ -68,6 +68,7 @@ struct _libxlDomainObjPrivate {
/* console */
virChrdevsPtr devs;
libxl_evgen_domain_death *deathW;
libxlDriverPrivatePtr driver;
struct libxlDomainJobObj job;
};
......@@ -117,7 +118,8 @@ libxlDomainCleanupJob(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virDomainShutoffReason reason);
int
libxlDomainEventsRegister(virDomainObjPtr vm);
libxlDomainEventsRegister(libxlDriverPrivatePtr driver,
virDomainObjPtr vm);
int
libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver,
......
......@@ -152,11 +152,11 @@ struct libxlShutdownThreadInfo
static void
libxlDomainShutdownThread(void *opaque)
{
libxlDriverPrivatePtr driver = libxl_driver;
struct libxlShutdownThreadInfo *shutdown_info = opaque;
virDomainObjPtr vm = shutdown_info->vm;
libxlDomainObjPrivatePtr priv = vm->privateData;
libxl_event *ev = shutdown_info->event;
libxlDriverPrivatePtr driver = priv->driver;
libxl_ctx *ctx = priv->ctx;
virObjectEventPtr dom_event = NULL;
libxl_shutdown_reason xl_reason = ev->u.domain_shutdown.shutdown_reason;
......@@ -357,7 +357,7 @@ libxlReconnectDomain(virDomainObjPtr vm,
driver->inhibitCallback(true, driver->inhibitOpaque);
/* Re-register domain death et. al. events */
libxlDomainEventsRegister(vm);
libxlDomainEventsRegister(driver, vm);
virObjectUnlock(vm);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册