提交 0772c346 编写于 作者: P Pavel Hrdina

vircgroup: rename virCgroupAdd.*Task to virCgroupAdd.*Process

In cgroup v2 we need to handle processes and threads differently,
following patch will introduce virCgroupAddThread.
Reviewed-by: NFabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 63b4ed0d
......@@ -306,7 +306,7 @@ int virDomainLxcEnterCGroup(virDomainPtr domain,
if (virCgroupNewDetect(domain->id, -1, &cgroup) < 0)
goto error;
if (virCgroupAddTask(cgroup, getpid()) < 0)
if (virCgroupAddProcess(cgroup, getpid()) < 0)
goto error;
virCgroupFree(&cgroup);
......
......@@ -1498,8 +1498,8 @@ virBufferVasprintf;
# util/vircgroup.h
virCgroupAddMachineTask;
virCgroupAddTask;
virCgroupAddMachineProcess;
virCgroupAddProcess;
virCgroupAllowAllDevices;
virCgroupAllowDevice;
virCgroupAllowDevicePath;
......
......@@ -874,12 +874,12 @@ static int virLXCControllerSetupCgroupLimits(virLXCControllerPtr ctrl)
ctrl->nicindexes)))
goto cleanup;
if (virCgroupAddMachineTask(ctrl->cgroup, getpid()) < 0)
if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0)
goto cleanup;
/* Add all qemu-nbd tasks to the cgroup */
for (i = 0; i < ctrl->nnbdpids; i++) {
if (virCgroupAddMachineTask(ctrl->cgroup, ctrl->nbdpids[i]) < 0)
if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->nbdpids[i]) < 0)
goto cleanup;
}
......
......@@ -2549,7 +2549,7 @@ qemuProcessSetupPid(virDomainObjPtr vm,
goto cleanup;
/* Move the thread to the sub dir */
if (virCgroupAddTask(cgroup, pid) < 0)
if (virCgroupAddProcess(cgroup, pid) < 0)
goto cleanup;
}
......@@ -2787,7 +2787,7 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
}
if (priv->cgroup &&
virCgroupAddMachineTask(priv->cgroup, cpid) < 0)
virCgroupAddMachineProcess(priv->cgroup, cpid) < 0)
goto cleanup;
if (qemuSecurityDomainSetPathLabel(driver, vm, socketPath, true) < 0)
......
......@@ -905,7 +905,7 @@ qemuExtTPMSetupCgroup(virQEMUDriverPtr driver,
_("Could not get process id of swtpm"));
goto cleanup;
}
if (virCgroupAddTask(cgroup, pid) < 0)
if (virCgroupAddProcess(cgroup, pid) < 0)
goto cleanup;
break;
case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
......
......@@ -1179,35 +1179,35 @@ virCgroupAddTaskInternal(virCgroupPtr group, pid_t pid, bool withSystemd)
}
/**
* virCgroupAddTask:
* virCgroupAddProcess:
*
* @group: The cgroup to add a task to
* @pid: The pid of the task to add
* @group: The cgroup to add a process to
* @pid: The pid of the process to add
*
* Will add the task to all controllers, except the
* Will add the process to all controllers, except the
* systemd unit controller.
*
* Returns: 0 on success, -1 on error
*/
int
virCgroupAddTask(virCgroupPtr group, pid_t pid)
virCgroupAddProcess(virCgroupPtr group, pid_t pid)
{
return virCgroupAddTaskInternal(group, pid, false);
}
/**
* virCgroupAddMachineTask:
* virCgroupAddMachineProcess:
*
* @group: The cgroup to add a task to
* @pid: The pid of the task to add
* @group: The cgroup to add a process to
* @pid: The pid of the process to add
*
* Will add the task to all controllers, including the
* Will add the process to all controllers, including the
* systemd unit controller.
*
* Returns: 0 on success, -1 on error
*/
int
virCgroupAddMachineTask(virCgroupPtr group, pid_t pid)
virCgroupAddMachineProcess(virCgroupPtr group, pid_t pid)
{
return virCgroupAddTaskInternal(group, pid, true);
}
......@@ -1588,7 +1588,7 @@ virCgroupNewMachineSystemd(const char *name,
goto error;
}
if (virCgroupAddTask(*group, pidleader) < 0)
if (virCgroupAddProcess(*group, pidleader) < 0)
goto error;
return 0;
......@@ -1644,7 +1644,7 @@ virCgroupNewMachineManual(const char *name,
group) < 0)
goto cleanup;
if (virCgroupAddTask(*group, pidleader) < 0) {
if (virCgroupAddProcess(*group, pidleader) < 0) {
virErrorPtr saved = virSaveLastError();
virCgroupRemove(*group);
virCgroupFree(group);
......@@ -4194,8 +4194,8 @@ virCgroupPathOfController(virCgroupPtr group ATTRIBUTE_UNUSED,
int
virCgroupAddTask(virCgroupPtr group ATTRIBUTE_UNUSED,
pid_t pid ATTRIBUTE_UNUSED)
virCgroupAddProcess(virCgroupPtr group ATTRIBUTE_UNUSED,
pid_t pid ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
_("Control groups not supported on this platform"));
......@@ -4204,8 +4204,8 @@ virCgroupAddTask(virCgroupPtr group ATTRIBUTE_UNUSED,
int
virCgroupAddMachineTask(virCgroupPtr group ATTRIBUTE_UNUSED,
pid_t pid ATTRIBUTE_UNUSED)
virCgroupAddMachineProcess(virCgroupPtr group ATTRIBUTE_UNUSED,
pid_t pid ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
_("Control groups not supported on this platform"));
......
......@@ -118,8 +118,8 @@ int virCgroupPathOfController(virCgroupPtr group,
const char *key,
char **path);
int virCgroupAddTask(virCgroupPtr group, pid_t pid);
int virCgroupAddMachineTask(virCgroupPtr group, pid_t pid);
int virCgroupAddProcess(virCgroupPtr group, pid_t pid);
int virCgroupAddMachineProcess(virCgroupPtr group, pid_t pid);
int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight);
int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册