[PATCH 07/10] libxl: remove unnecessary libxlDomainEventsRegister

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

 



This function now only enables domain death events.  Simply call
libxl_evenable_domain_death() instead of an unnecessary wrapper.

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_domain.c | 32 +++++++-------------------------
 src/libxl/libxl_domain.h |  5 -----
 src/libxl/libxl_driver.c |  5 +++--
 3 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index ea3276c..69d5c5b 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -751,30 +751,6 @@ libxlDomainCleanupJob(libxlDriverPrivatePtr driver,
 }
 
 /*
- * Register for domain events emitted by libxl.
- */
-int
-libxlDomainEventsRegister(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
-{
-    libxlDomainObjPrivatePtr priv = vm->privateData;
-
-    priv->driver = driver;
-
-    /* Always enable domain death events */
-    if (libxl_evenable_domain_death(priv->ctx, vm->def->id, 0, &priv->deathW))
-        goto error;
-
-    return 0;
-
- error:
-    if (priv->deathW) {
-        libxl_evdisable_domain_death(priv->ctx, priv->deathW);
-        priv->deathW = NULL;
-    }
-    return -1;
-}
-
-/*
  * Core dump domain to default dump path.
  *
  * virDomainObjPtr must be locked on invocation
@@ -1076,7 +1052,9 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
      * be cleaned up if there are any subsequent failures.
      */
     vm->def->id = domid;
-    if (libxlDomainEventsRegister(driver, vm) < 0)
+
+    /* Always enable domain death events */
+    if (libxl_evenable_domain_death(priv->ctx, vm->def->id, 0, &priv->deathW))
         goto cleanup_dom;
 
     if ((dom_xml = virDomainDefFormat(vm->def, 0)) == NULL)
@@ -1116,6 +1094,10 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
     goto endjob;
 
  cleanup_dom:
+    if (priv->deathW) {
+        libxl_evdisable_domain_death(priv->ctx, priv->deathW);
+        priv->deathW = NULL;
+    }
     libxl_domain_destroy(priv->ctx, domid, NULL);
     vm->def->id = -1;
     virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_FAILED);
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 96e238e..297dffb 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -68,7 +68,6 @@ struct _libxlDomainObjPrivate {
     /* console */
     virChrdevsPtr devs;
     libxl_evgen_domain_death *deathW;
-    libxlDriverPrivatePtr driver;
     unsigned short migrationPort;
 
     struct libxlDomainJobObj job;
@@ -134,10 +133,6 @@ libxlDomainEventHandler(void *data,
                         VIR_LIBXL_EVENT_CONST libxl_event *event);
 
 int
-libxlDomainEventsRegister(libxlDriverPrivatePtr driver,
-                          virDomainObjPtr vm);
-
-int
 libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver,
                         virDomainObjPtr vm);
 
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 8e88645..43ee629 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -367,8 +367,9 @@ libxlReconnectDomain(virDomainObjPtr vm,
     if (virAtomicIntInc(&driver->nactive) == 1 && driver->inhibitCallback)
         driver->inhibitCallback(true, driver->inhibitOpaque);
 
-    /* Re-register domain death et. al. events */
-    libxlDomainEventsRegister(driver, vm);
+    /* Enable domain death events */
+    libxl_evenable_domain_death(priv->ctx, vm->def->id, 0, &priv->deathW);
+
     virObjectUnlock(vm);
     return 0;
 
-- 
1.8.4.5

--
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]