mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
libxl: use virDomainObjEndJob()
This patch removes libxlDomainObjEndJob() and replaces it with call to the generalized virDomainObjEndJob(). Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9085ccbfb4
commit
a7ed601d34
@ -43,29 +43,6 @@
|
|||||||
VIR_LOG_INIT("libxl.libxl_domain");
|
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
|
int
|
||||||
libxlDomainJobGetTimeElapsed(virDomainJobObj *job, unsigned long long *timeElapsed)
|
libxlDomainJobGetTimeElapsed(virDomainJobObj *job, unsigned long long *timeElapsed)
|
||||||
{
|
{
|
||||||
@ -505,7 +482,7 @@ libxlDomainShutdownThread(void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -541,7 +518,7 @@ libxlDomainDeathThread(void *opaque)
|
|||||||
libxlDomainCleanup(driver, vm);
|
libxlDomainCleanup(driver, vm);
|
||||||
if (!vm->persistent)
|
if (!vm->persistent)
|
||||||
virDomainObjListRemove(driver->domains, vm);
|
virDomainObjListRemove(driver->domains, vm);
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
virObjectEventStateQueue(driver->domainEventState, dom_event);
|
virObjectEventStateQueue(driver->domainEventState, dom_event);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -49,10 +49,6 @@ extern const struct libxl_event_hooks ev_hooks;
|
|||||||
int
|
int
|
||||||
libxlDomainObjPrivateInitCtx(virDomainObj *vm);
|
libxlDomainObjPrivateInitCtx(virDomainObj *vm);
|
||||||
|
|
||||||
void
|
|
||||||
libxlDomainObjEndJob(libxlDriverPrivate *driver,
|
|
||||||
virDomainObj *obj);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
libxlDomainJobGetTimeElapsed(virDomainJobObj *job,
|
libxlDomainJobGetTimeElapsed(virDomainJobObj *job,
|
||||||
unsigned long long *timeElapsed);
|
unsigned long long *timeElapsed);
|
||||||
|
@ -340,7 +340,7 @@ libxlAutostartDomain(virDomainObj *vm,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
|
|
||||||
@ -1065,7 +1065,7 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,
|
|||||||
dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
|
dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1185,7 +1185,7 @@ libxlDomainSuspend(virDomainPtr dom)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1239,7 +1239,7 @@ libxlDomainResume(virDomainPtr dom)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1398,7 +1398,7 @@ libxlDomainDestroyFlags(virDomainPtr dom,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1472,7 +1472,7 @@ libxlDomainPMSuspendForDuration(virDomainPtr dom,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1537,7 +1537,7 @@ libxlDomainPMWakeup(virDomainPtr dom, unsigned int flags)
|
|||||||
libxlDomainCleanup(driver, vm);
|
libxlDomainCleanup(driver, vm);
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1696,7 +1696,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1917,7 +1917,7 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1979,7 +1979,7 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
|
|||||||
if (ret < 0 && !vm->persistent)
|
if (ret < 0 && !vm->persistent)
|
||||||
virDomainObjListRemove(driver->domains, vm);
|
virDomainObjListRemove(driver->domains, vm);
|
||||||
|
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (VIR_CLOSE(fd) < 0)
|
if (VIR_CLOSE(fd) < 0)
|
||||||
@ -2076,7 +2076,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -2129,7 +2129,7 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -2344,7 +2344,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|||||||
}
|
}
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(bitmask);
|
VIR_FREE(bitmask);
|
||||||
@ -2489,7 +2489,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
|
|||||||
}
|
}
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -2793,7 +2793,7 @@ libxlDomainCreateWithFlags(virDomainPtr dom,
|
|||||||
dom->id = vm->def->id;
|
dom->id = vm->def->id;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -4152,7 +4152,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
|
|||||||
}
|
}
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainDeviceDefFree(devConf);
|
virDomainDeviceDefFree(devConf);
|
||||||
@ -4240,7 +4240,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
|
|||||||
}
|
}
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainDeviceDefFree(dev);
|
virDomainDeviceDefFree(dev);
|
||||||
@ -4522,7 +4522,7 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -4723,7 +4723,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -4989,7 +4989,6 @@ libxlDomainInterfaceStats(virDomainPtr dom,
|
|||||||
const char *device,
|
const char *device,
|
||||||
virDomainInterfaceStatsPtr stats)
|
virDomainInterfaceStatsPtr stats)
|
||||||
{
|
{
|
||||||
libxlDriverPrivate *driver = dom->conn->privateData;
|
|
||||||
virDomainObj *vm;
|
virDomainObj *vm;
|
||||||
virDomainNetDef *net = NULL;
|
virDomainNetDef *net = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -5016,7 +5015,7 @@ libxlDomainInterfaceStats(virDomainPtr dom,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -5189,7 +5188,7 @@ libxlDomainMemoryStats(virDomainPtr dom,
|
|||||||
ret = i;
|
ret = i;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
libxl_dominfo_dispose(&d_info);
|
libxl_dominfo_dispose(&d_info);
|
||||||
@ -5511,7 +5510,6 @@ libxlDomainBlockStats(virDomainPtr dom,
|
|||||||
const char *path,
|
const char *path,
|
||||||
virDomainBlockStatsPtr stats)
|
virDomainBlockStatsPtr stats)
|
||||||
{
|
{
|
||||||
libxlDriverPrivate *driver = dom->conn->privateData;
|
|
||||||
virDomainObj *vm;
|
virDomainObj *vm;
|
||||||
libxlBlockStats blkstats;
|
libxlBlockStats blkstats;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -5542,7 +5540,7 @@ libxlDomainBlockStats(virDomainPtr dom,
|
|||||||
stats->errs = -1;
|
stats->errs = -1;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -5556,7 +5554,6 @@ libxlDomainBlockStatsFlags(virDomainPtr dom,
|
|||||||
int *nparams,
|
int *nparams,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
libxlDriverPrivate *driver = dom->conn->privateData;
|
|
||||||
virDomainObj *vm;
|
virDomainObj *vm;
|
||||||
libxlBlockStats blkstats;
|
libxlBlockStats blkstats;
|
||||||
int nstats;
|
int nstats;
|
||||||
@ -5615,7 +5612,7 @@ libxlDomainBlockStatsFlags(virDomainPtr dom,
|
|||||||
#undef LIBXL_BLKSTAT_ASSIGN_PARAM
|
#undef LIBXL_BLKSTAT_ASSIGN_PARAM
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -6381,7 +6378,7 @@ libxlDomainSetMetadata(virDomainPtr dom,
|
|||||||
virObjectEventStateQueue(driver->domainEventState, ev);
|
virObjectEventStateQueue(driver->domainEventState, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
|
@ -417,7 +417,7 @@ libxlDomainMigrationSrcBegin(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
libxlMigrationCookieFree(mig);
|
libxlMigrationCookieFree(mig);
|
||||||
@ -604,7 +604,7 @@ libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dconn,
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
libxlMigrationCookieFree(mig);
|
libxlMigrationCookieFree(mig);
|
||||||
@ -774,7 +774,7 @@ libxlDomainMigrationDstPrepare(virConnectPtr dconn,
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
for (i = 0; i < nsocks; i++) {
|
for (i = 0; i < nsocks; i++) {
|
||||||
@ -1155,7 +1155,7 @@ libxlDomainMigrationSrcPerformP2P(libxlDriverPrivate *driver,
|
|||||||
* Confirm phase will not be executed if perform fails. End the
|
* Confirm phase will not be executed if perform fails. End the
|
||||||
* job started in begin phase.
|
* job started in begin phase.
|
||||||
*/
|
*/
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -1226,7 +1226,7 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *driver,
|
|||||||
* Confirm phase will not be executed if perform fails. End the
|
* Confirm phase will not be executed if perform fails. End the
|
||||||
* job started in begin phase.
|
* job started in begin phase.
|
||||||
*/
|
*/
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1327,7 +1327,7 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* EndJob for corresponding BeginJob in prepare phase */
|
/* EndJob for corresponding BeginJob in prepare phase */
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
virObjectEventStateQueue(driver->domainEventState, event);
|
virObjectEventStateQueue(driver->domainEventState, event);
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
return dom;
|
return dom;
|
||||||
@ -1384,7 +1384,7 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivate *driver,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
/* EndJob for corresponding BeginJob in begin phase */
|
/* EndJob for corresponding BeginJob in begin phase */
|
||||||
libxlDomainObjEndJob(driver, vm);
|
virDomainObjEndJob(vm);
|
||||||
virObjectEventStateQueue(driver->domainEventState, event);
|
virObjectEventStateQueue(driver->domainEventState, event);
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user