[PATCH 11/13] libxl: include a pointer to the driver in libxlDomainObjPrivate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_domain.c | 5 +++--
 src/libxl/libxl_domain.h | 4 +++-
 src/libxl/libxl_driver.c | 4 ++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index c1936aa..71cfb3d 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -723,10 +723,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 */
@@ -999,7 +1000,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 4b5767a..979ce2a 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 adf5c5d..ec6c73a 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -145,11 +145,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;
@@ -343,7 +343,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;
 
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]