mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virLXCControllerSetup(Resource|Cgroup)Limits: Refactor cleanup
Remove the pointless cleanup sections. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
94490b59f1
commit
4c4b4b3691
@ -808,7 +808,6 @@ static int virLXCControllerGetNumadAdvice(virLXCController *ctrl,
|
|||||||
static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
||||||
{
|
{
|
||||||
g_autoptr(virBitmap) auto_nodeset = NULL;
|
g_autoptr(virBitmap) auto_nodeset = NULL;
|
||||||
int ret = -1;
|
|
||||||
virBitmap *nodeset = NULL;
|
virBitmap *nodeset = NULL;
|
||||||
virDomainNumatuneMemMode mode;
|
virDomainNumatuneMemMode mode;
|
||||||
|
|
||||||
@ -824,21 +823,19 @@ static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
|||||||
VIR_DEBUG("Setting up process resource limits");
|
VIR_DEBUG("Setting up process resource limits");
|
||||||
|
|
||||||
if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0)
|
if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);
|
nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);
|
||||||
|
|
||||||
if (virNumaSetupMemoryPolicy(mode, nodeset) < 0)
|
if (virNumaSetupMemoryPolicy(mode, nodeset) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virLXCControllerSetupCpuAffinity(ctrl) < 0)
|
if (virLXCControllerSetupCpuAffinity(ctrl) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -849,14 +846,13 @@ static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
|||||||
static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
|
static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
|
||||||
{
|
{
|
||||||
g_autoptr(virBitmap) auto_nodeset = NULL;
|
g_autoptr(virBitmap) auto_nodeset = NULL;
|
||||||
int ret = -1;
|
|
||||||
virBitmap *nodeset = NULL;
|
virBitmap *nodeset = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
VIR_DEBUG("Setting up cgroup resource limits");
|
VIR_DEBUG("Setting up cgroup resource limits");
|
||||||
|
|
||||||
if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0)
|
if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);
|
nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);
|
||||||
|
|
||||||
@ -864,23 +860,21 @@ static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
|
|||||||
ctrl->initpid,
|
ctrl->initpid,
|
||||||
ctrl->nnicindexes,
|
ctrl->nnicindexes,
|
||||||
ctrl->nicindexes)))
|
ctrl->nicindexes)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0)
|
if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* Add all qemu-nbd tasks to the cgroup */
|
/* Add all qemu-nbd tasks to the cgroup */
|
||||||
for (i = 0; i < ctrl->nnbdpids; i++) {
|
for (i = 0; i < ctrl->nnbdpids; i++) {
|
||||||
if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->nbdpids[i]) < 0)
|
if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->nbdpids[i]) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virLXCCgroupSetup(ctrl->def, ctrl->cgroup, nodeset) < 0)
|
if (virLXCCgroupSetup(ctrl->def, ctrl->cgroup, nodeset) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user