This patch removes libxlDomainObjEndJob() and replaces it with
call to the generalized virDomainObjEndJob().
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/libxl/libxl_domain.c | 27 ++------------------
src/libxl/libxl_domain.h | 4 ---
src/libxl/libxl_driver.c | 51 +++++++++++++++++--------------------
src/libxl/libxl_migration.c | 14 +++++-----
4 files changed, 33 insertions(+), 63 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 3a1b371054..2d53250895 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -43,29 +43,6 @@
VIR_LOG_INIT("libxl.libxl_domain");
-/*
- * obj must be locked before calling
- *
- * To be called after completing the work associated with the
- * earlier libxlDomainBeginJob() call
- *
- * Returns true if the remaining reference count on obj is
- * non-zero, false if the reference count has dropped to zero
- * and obj is disposed.
- */
-void
-libxlDomainObjEndJob(libxlDriverPrivate *driver G_GNUC_UNUSED,
- virDomainObj *obj)
-{
- virDomainJob job = obj->job->active;
-
- VIR_DEBUG("Stopping job: %s",
- virDomainJobTypeToString(job));
-
- virDomainObjResetJob(obj->job);
- virCondSignal(&obj->job->cond);
-}
-
int
libxlDomainJobGetTimeElapsed(virDomainJobObj *job, unsigned long long *timeElapsed)
{
@@ -505,7 +482,7 @@ libxlDomainShutdownThread(void *opaque)
}
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -541,7 +518,7 @@ libxlDomainDeathThread(void *opaque)
libxlDomainCleanup(driver, vm);
if (!vm->persistent)
virDomainObjListRemove(driver->domains, vm);
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
virObjectEventStateQueue(driver->domainEventState, dom_event);
cleanup:
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index b80552e30a..94b693e477 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -49,10 +49,6 @@ extern const struct libxl_event_hooks ev_hooks;
int
libxlDomainObjPrivateInitCtx(virDomainObj *vm);
-void
-libxlDomainObjEndJob(libxlDriverPrivate *driver,
- virDomainObj *obj);
-
int
libxlDomainJobGetTimeElapsed(virDomainJobObj *job,
unsigned long long *timeElapsed);
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index d94430708a..79af2f4441 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -340,7 +340,7 @@ libxlAutostartDomain(virDomainObj *vm,
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1065,7 +1065,7 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,
dom = virGetDomain(conn, vm->def->name, vm->def->uuid,
vm->def->id);
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1185,7 +1185,7 @@ libxlDomainSuspend(virDomainPtr dom)
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1239,7 +1239,7 @@ libxlDomainResume(virDomainPtr dom)
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1398,7 +1398,7 @@ libxlDomainDestroyFlags(virDomainPtr dom,
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1472,7 +1472,7 @@ libxlDomainPMSuspendForDuration(virDomainPtr dom,
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1537,7 +1537,7 @@ libxlDomainPMWakeup(virDomainPtr dom, unsigned int flags)
libxlDomainCleanup(driver, vm);
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1696,7 +1696,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1917,7 +1917,7 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char
*dxml,
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -1979,7 +1979,7 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
if (ret < 0 && !vm->persistent)
virDomainObjListRemove(driver->domains, vm);
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
if (VIR_CLOSE(fd) < 0)
@@ -2076,7 +2076,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int
flags)
}
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -2129,7 +2129,7 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -2344,7 +2344,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
}
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
VIR_FREE(bitmask);
@@ -2489,7 +2489,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
}
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -2793,7 +2793,7 @@ libxlDomainCreateWithFlags(virDomainPtr dom,
dom->id = vm->def->id;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -4152,7 +4152,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
}
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainDeviceDefFree(devConf);
@@ -4240,7 +4240,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
}
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainDeviceDefFree(dev);
@@ -4522,7 +4522,7 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart)
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -4723,7 +4723,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -4989,7 +4989,6 @@ libxlDomainInterfaceStats(virDomainPtr dom,
const char *device,
virDomainInterfaceStatsPtr stats)
{
- libxlDriverPrivate *driver = dom->conn->privateData;
virDomainObj *vm;
virDomainNetDef *net = NULL;
int ret = -1;
@@ -5016,7 +5015,7 @@ libxlDomainInterfaceStats(virDomainPtr dom,
ret = 0;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -5189,7 +5188,7 @@ libxlDomainMemoryStats(virDomainPtr dom,
ret = i;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
libxl_dominfo_dispose(&d_info);
@@ -5511,7 +5510,6 @@ libxlDomainBlockStats(virDomainPtr dom,
const char *path,
virDomainBlockStatsPtr stats)
{
- libxlDriverPrivate *driver = dom->conn->privateData;
virDomainObj *vm;
libxlBlockStats blkstats;
int ret = -1;
@@ -5542,7 +5540,7 @@ libxlDomainBlockStats(virDomainPtr dom,
stats->errs = -1;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -5556,7 +5554,6 @@ libxlDomainBlockStatsFlags(virDomainPtr dom,
int *nparams,
unsigned int flags)
{
- libxlDriverPrivate *driver = dom->conn->privateData;
virDomainObj *vm;
libxlBlockStats blkstats;
int nstats;
@@ -5615,7 +5612,7 @@ libxlDomainBlockStatsFlags(virDomainPtr dom,
#undef LIBXL_BLKSTAT_ASSIGN_PARAM
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
@@ -6381,7 +6378,7 @@ libxlDomainSetMetadata(virDomainPtr dom,
virObjectEventStateQueue(driver->domainEventState, ev);
}
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
virDomainObjEndAPI(&vm);
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 90cf12ae00..6048540334 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -417,7 +417,7 @@ libxlDomainMigrationSrcBegin(virConnectPtr conn,
goto cleanup;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
cleanup:
libxlMigrationCookieFree(mig);
@@ -604,7 +604,7 @@ libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dconn,
goto done;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
error:
libxlMigrationCookieFree(mig);
@@ -774,7 +774,7 @@ libxlDomainMigrationDstPrepare(virConnectPtr dconn,
goto done;
endjob:
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
error:
for (i = 0; i < nsocks; i++) {
@@ -1155,7 +1155,7 @@ libxlDomainMigrationSrcPerformP2P(libxlDriverPrivate *driver,
* Confirm phase will not be executed if perform fails. End the
* job started in begin phase.
*/
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
}
cleanup:
@@ -1226,7 +1226,7 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *driver,
* Confirm phase will not be executed if perform fails. End the
* job started in begin phase.
*/
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
}
return ret;
@@ -1327,7 +1327,7 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
}
/* EndJob for corresponding BeginJob in prepare phase */
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return dom;
@@ -1384,7 +1384,7 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivate *driver,
cleanup:
/* EndJob for corresponding BeginJob in begin phase */
- libxlDomainObjEndJob(driver, vm);
+ virDomainObjEndJob(vm);
virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
--
2.37.1