And replace all calls with virObjectEventStateQueue such that:
libxlDomainEventQueue(driver, event);
becomes:
virObjectEventStateQueue(driver->domainEventState, event);
And remove NULL checking from all callers.
Signed-off-by: Anya Harter <aharter(a)redhat.com>
---
src/libxl/libxl_domain.c | 24 ++++++------------------
src/libxl/libxl_domain.h | 4 ----
src/libxl/libxl_driver.c | 21 +++++++--------------
src/libxl/libxl_migration.c | 18 ++++++------------
4 files changed, 19 insertions(+), 48 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index d12b1b1b4b..2ab78ac9a5 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -526,10 +526,8 @@ libxlDomainShutdownThread(void *opaque)
}
destroy:
- if (dom_event) {
- libxlDomainEventQueue(driver, dom_event);
- dom_event = NULL;
- }
+ virObjectEventStateQueue(driver->domainEventState, dom_event);
+ dom_event = NULL;
libxlDomainDestroyInternal(driver, vm);
libxlDomainCleanup(driver, vm);
if (!vm->persistent)
@@ -538,10 +536,8 @@ libxlDomainShutdownThread(void *opaque)
goto endjob;
restart:
- if (dom_event) {
- libxlDomainEventQueue(driver, dom_event);
- dom_event = NULL;
- }
+ virObjectEventStateQueue(driver->domainEventState, dom_event);
+ dom_event = NULL;
libxlDomainDestroyInternal(driver, vm);
libxlDomainCleanup(driver, vm);
if (libxlDomainStartNew(driver, vm, false) < 0) {
@@ -554,8 +550,7 @@ libxlDomainShutdownThread(void *opaque)
cleanup:
virDomainObjEndAPI(&vm);
- if (dom_event)
- libxlDomainEventQueue(driver, dom_event);
+ virObjectEventStateQueue(driver->domainEventState, dom_event);
libxl_event_free(cfg->ctx, ev);
VIR_FREE(shutdown_info);
virObjectUnref(cfg);
@@ -616,12 +611,6 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event
*event)
VIR_FREE(shutdown_info);
}
-void
-libxlDomainEventQueue(libxlDriverPrivatePtr driver, virObjectEventPtr event)
-{
- virObjectEventStateQueue(driver->domainEventState, event);
-}
-
char *
libxlDomainManagedSavePath(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
{
@@ -1394,8 +1383,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
restore_fd < 0 ?
VIR_DOMAIN_EVENT_STARTED_BOOTED :
VIR_DOMAIN_EVENT_STARTED_RESTORED);
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
ret = 0;
goto cleanup;
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index b5b6332151..5d83230cd6 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -95,10 +95,6 @@ int
libxlDomainJobUpdateTime(struct libxlDomainJobObj *job)
ATTRIBUTE_RETURN_CHECK;
-void
-libxlDomainEventQueue(libxlDriverPrivatePtr driver,
- virObjectEventPtr event);
-
char *
libxlDomainManagedSavePath(libxlDriverPrivatePtr driver,
virDomainObjPtr vm);
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 8c40661e5a..5a5e792957 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1179,8 +1179,7 @@ libxlDomainSuspend(virDomainPtr dom)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
}
@@ -1234,8 +1233,7 @@ libxlDomainResume(virDomainPtr dom)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
}
@@ -1394,8 +1392,7 @@ libxlDomainDestroyFlags(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
}
@@ -1734,8 +1731,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver,
VIR_FREE(xml);
if (VIR_CLOSE(fd) < 0)
virReportSystemError(errno, "%s", _("cannot close file"));
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
}
@@ -1950,8 +1946,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int
flags)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
}
@@ -2755,8 +2750,7 @@ libxlDomainDefineXMLFlags(virConnectPtr conn, const char *xml,
unsigned int flag
virDomainDefFree(def);
virDomainDefFree(oldDef);
virDomainObjEndAPI(&vm);
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return dom;
}
@@ -2827,8 +2821,7 @@ libxlDomainUndefineFlags(virDomainPtr dom,
cleanup:
VIR_FREE(name);
virDomainObjEndAPI(&vm);
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
}
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 206b878292..b2e5847c58 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -1284,10 +1284,8 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
}
- if (event) {
- libxlDomainEventQueue(driver, event);
- event = NULL;
- }
+ virObjectEventStateQueue(driver->domainEventState, event);
+ event = NULL;
if (flags & VIR_MIGRATE_PERSIST_DEST) {
unsigned int oldPersist = vm->persistent;
@@ -1306,10 +1304,8 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
oldPersist ?
VIR_DOMAIN_EVENT_DEFINED_UPDATED :
VIR_DOMAIN_EVENT_DEFINED_ADDED);
- if (event) {
- libxlDomainEventQueue(driver, event);
- event = NULL;
- }
+ virObjectEventStateQueue(driver->domainEventState, event);
+ event = NULL;
}
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) <
0)
@@ -1329,8 +1325,7 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
virDomainObjListRemove(driver->domains, vm);
}
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return dom;
}
@@ -1384,8 +1379,7 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivatePtr driver,
ret = 0;
cleanup:
- if (event)
- libxlDomainEventQueue(driver, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
}
--
2.17.1