diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index d2def788a7123498c3663617f07ca44aabe462bf..97d325eee197ed3ea069805d13677ca1dce428aa 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -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) diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h index 4b5767a23377d6c8721bdcfa0b0bc58a8160d5c3..979ce2afd9fadec4430df671806008128ecbc4b3 100644 --- a/src/libxl/libxl_domain.h +++ b/src/libxl/libxl_domain.h @@ -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, diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 1686da72364be5526b83caba152948402652e1f0..c883ef26b78179a1f7bf31d1fc09082537d16187 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -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;