mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 20:51:26 +00:00
lxc: use job functions in lxcDomain* functions that perform modify actions.
Use the recently added job functions and unlock the virDomainObj while performing the respective modify operation. This commit affects lxcDomain{DestroyFlags, Reboot, SetBlkioParameters, SetMemoryParameters, SetMetadata, SetSchedulerParameterFlags, ShutdownFlags} Signed-off-by: Katerina Koukiou <k.koukiou@gmail.com>
This commit is contained in:
parent
95cee48056
commit
15ccb0dbf3
@ -857,16 +857,19 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
|
|||||||
vm, &flags, &vmdef) < 0)
|
vm, &flags, &vmdef) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE &&
|
if (flags & VIR_DOMAIN_AFFECT_LIVE &&
|
||||||
!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
|
!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("cgroup memory controller is not mounted"));
|
"%s", _("cgroup memory controller is not mounted"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \
|
#define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \
|
||||||
if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \
|
if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \
|
||||||
goto cleanup; \
|
goto endjob; \
|
||||||
\
|
\
|
||||||
if (rc == 1) \
|
if (rc == 1) \
|
||||||
set_ ## VALUE = true;
|
set_ ## VALUE = true;
|
||||||
@ -893,7 +896,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
|
|||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("memory hard_limit tunable value must be lower "
|
_("memory hard_limit tunable value must be lower "
|
||||||
"than or equal to swap_hard_limit"));
|
"than or equal to swap_hard_limit"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,7 +907,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
|
|||||||
virReportSystemError(-rc, _("unable to set memory %s tunable"), \
|
virReportSystemError(-rc, _("unable to set memory %s tunable"), \
|
||||||
#VALUE); \
|
#VALUE); \
|
||||||
\
|
\
|
||||||
goto cleanup; \
|
goto endjob; \
|
||||||
} \
|
} \
|
||||||
vm->def->mem.VALUE = VALUE; \
|
vm->def->mem.VALUE = VALUE; \
|
||||||
} \
|
} \
|
||||||
@ -932,9 +935,14 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
|
|||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG &&
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG &&
|
||||||
virDomainSaveConfig(cfg->configDir, driver->caps, vmdef) < 0)
|
virDomainSaveConfig(cfg->configDir, driver->caps, vmdef) < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
endjob:
|
||||||
|
if (!virLXCDomainObjEndJob(driver, vm))
|
||||||
|
vm = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (vm)
|
if (vm)
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
@ -1538,10 +1546,13 @@ lxcDomainDestroyFlags(virDomainPtr dom,
|
|||||||
if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0)
|
if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("Domain is not running"));
|
"%s", _("Domain is not running"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv = vm->privateData;
|
priv = vm->privateData;
|
||||||
@ -1556,6 +1567,10 @@ lxcDomainDestroyFlags(virDomainPtr dom,
|
|||||||
vm = NULL;
|
vm = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endjob:
|
||||||
|
if (!virLXCDomainObjEndJob(driver, vm))
|
||||||
|
vm = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (vm)
|
if (vm)
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
@ -1989,22 +2004,25 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
|
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
|
||||||
vm, &flags, &vmdef) < 0)
|
vm, &flags, &vmdef) < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||||
/* Make a copy for updated domain. */
|
/* Make a copy for updated domain. */
|
||||||
vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
|
vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
|
||||||
if (!vmdef)
|
if (!vmdef)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) {
|
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("cgroup CPU controller is not mounted"));
|
"%s", _("cgroup CPU controller is not mounted"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2015,10 +2033,10 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
unsigned long long val;
|
unsigned long long val;
|
||||||
if (virCgroupSetCpuShares(priv->cgroup, params[i].value.ul) < 0)
|
if (virCgroupSetCpuShares(priv->cgroup, params[i].value.ul) < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
|
if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
vm->def->cputune.shares = val;
|
vm->def->cputune.shares = val;
|
||||||
vm->def->cputune.sharesSpecified = true;
|
vm->def->cputune.sharesSpecified = true;
|
||||||
@ -2032,7 +2050,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
rc = lxcSetVcpuBWLive(priv->cgroup, params[i].value.ul, 0);
|
rc = lxcSetVcpuBWLive(priv->cgroup, params[i].value.ul, 0);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
if (params[i].value.ul)
|
if (params[i].value.ul)
|
||||||
vm->def->cputune.period = params[i].value.ul;
|
vm->def->cputune.period = params[i].value.ul;
|
||||||
@ -2044,7 +2062,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
rc = lxcSetVcpuBWLive(priv->cgroup, 0, params[i].value.l);
|
rc = lxcSetVcpuBWLive(priv->cgroup, 0, params[i].value.l);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
if (params[i].value.l)
|
if (params[i].value.l)
|
||||||
vm->def->cputune.quota = params[i].value.l;
|
vm->def->cputune.quota = params[i].value.l;
|
||||||
@ -2056,13 +2074,13 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
|
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||||
rc = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
|
rc = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
virDomainObjAssignDef(vm, vmdef, false, NULL);
|
virDomainObjAssignDef(vm, vmdef, false, NULL);
|
||||||
vmdef = NULL;
|
vmdef = NULL;
|
||||||
@ -2070,6 +2088,10 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
endjob:
|
||||||
|
if (!virLXCDomainObjEndJob(driver, vm))
|
||||||
|
vm = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainDefFree(vmdef);
|
virDomainDefFree(vmdef);
|
||||||
if (vm)
|
if (vm)
|
||||||
@ -2627,15 +2649,18 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
|||||||
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
|
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
|
||||||
&persistentDef) < 0)
|
&persistentDef) < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_BLKIO)) {
|
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_BLKIO)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("blkio cgroup isn't mounted"));
|
_("blkio cgroup isn't mounted"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2745,7 +2770,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||||
/* Clang can't see that if we get here, persistentDef was set. */
|
/* Clang can't see that if we get here, persistentDef was set. */
|
||||||
sa_assert(persistentDef);
|
sa_assert(persistentDef);
|
||||||
@ -2783,6 +2808,10 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endjob:
|
||||||
|
if (!virLXCDomainObjEndJob(driver, vm))
|
||||||
|
vm = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (vm)
|
if (vm)
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
@ -3712,6 +3741,7 @@ static int
|
|||||||
lxcDomainShutdownFlags(virDomainPtr dom,
|
lxcDomainShutdownFlags(virDomainPtr dom,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
virLXCDriverPtr driver = dom->conn->privateData;
|
||||||
virLXCDomainObjPrivatePtr priv;
|
virLXCDomainObjPrivatePtr priv;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -3728,16 +3758,19 @@ lxcDomainShutdownFlags(virDomainPtr dom,
|
|||||||
if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
|
if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("Domain is not running"));
|
"%s", _("Domain is not running"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->initpid == 0) {
|
if (priv->initpid == 0) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("Init process ID is not yet known"));
|
"%s", _("Init process ID is not yet known"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags == 0 ||
|
if (flags == 0 ||
|
||||||
@ -3747,12 +3780,12 @@ lxcDomainShutdownFlags(virDomainPtr dom,
|
|||||||
if ((rc = virProcessRunInMountNamespace(priv->initpid,
|
if ((rc = virProcessRunInMountNamespace(priv->initpid,
|
||||||
lxcDomainInitctlCallback,
|
lxcDomainInitctlCallback,
|
||||||
&command)) < 0)
|
&command)) < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
if (rc == 0 && flags != 0 &&
|
if (rc == 0 && flags != 0 &&
|
||||||
((flags & ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) {
|
((flags & ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) {
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
_("Container does not provide an initctl pipe"));
|
_("Container does not provide an initctl pipe"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
@ -3766,12 +3799,16 @@ lxcDomainShutdownFlags(virDomainPtr dom,
|
|||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("Unable to send SIGTERM to init pid %llu"),
|
_("Unable to send SIGTERM to init pid %llu"),
|
||||||
(unsigned long long)priv->initpid);
|
(unsigned long long)priv->initpid);
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
endjob:
|
||||||
|
if (!virLXCDomainObjEndJob(driver, vm))
|
||||||
|
vm = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (vm)
|
if (vm)
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
@ -3789,6 +3826,7 @@ static int
|
|||||||
lxcDomainReboot(virDomainPtr dom,
|
lxcDomainReboot(virDomainPtr dom,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
virLXCDriverPtr driver = dom->conn->privateData;
|
||||||
virLXCDomainObjPrivatePtr priv;
|
virLXCDomainObjPrivatePtr priv;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -3805,16 +3843,19 @@ lxcDomainReboot(virDomainPtr dom,
|
|||||||
if (virDomainRebootEnsureACL(dom->conn, vm->def, flags) < 0)
|
if (virDomainRebootEnsureACL(dom->conn, vm->def, flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("Domain is not running"));
|
"%s", _("Domain is not running"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->initpid == 0) {
|
if (priv->initpid == 0) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("Init process ID is not yet known"));
|
"%s", _("Init process ID is not yet known"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags == 0 ||
|
if (flags == 0 ||
|
||||||
@ -3824,12 +3865,12 @@ lxcDomainReboot(virDomainPtr dom,
|
|||||||
if ((rc = virProcessRunInMountNamespace(priv->initpid,
|
if ((rc = virProcessRunInMountNamespace(priv->initpid,
|
||||||
lxcDomainInitctlCallback,
|
lxcDomainInitctlCallback,
|
||||||
&command)) < 0)
|
&command)) < 0)
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
if (rc == 0 && flags != 0 &&
|
if (rc == 0 && flags != 0 &&
|
||||||
((flags & ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) {
|
((flags & ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) {
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
_("Container does not provide an initctl pipe"));
|
_("Container does not provide an initctl pipe"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
@ -3843,12 +3884,16 @@ lxcDomainReboot(virDomainPtr dom,
|
|||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("Unable to send SIGTERM to init pid %llu"),
|
_("Unable to send SIGTERM to init pid %llu"),
|
||||||
(unsigned long long)priv->initpid);
|
(unsigned long long)priv->initpid);
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
endjob:
|
||||||
|
if (!virLXCDomainObjEndJob(driver, vm))
|
||||||
|
vm = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (vm)
|
if (vm)
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
@ -5669,11 +5714,18 @@ lxcDomainSetMetadata(virDomainPtr dom,
|
|||||||
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, caps,
|
ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, caps,
|
||||||
driver->xmlopt, cfg->stateDir,
|
driver->xmlopt, cfg->stateDir,
|
||||||
cfg->configDir, flags);
|
cfg->configDir, flags);
|
||||||
|
|
||||||
|
if (!virLXCDomainObjEndJob(driver, vm))
|
||||||
|
vm = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
if (vm)
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user