In cgroup v2 we need to handle processes and threads differently,
following patch will introduce virCgroupAddThread.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/libvirt-lxc.c | 2 +-
src/libvirt_private.syms | 4 ++--
src/lxc/lxc_controller.c | 4 ++--
src/qemu/qemu_process.c | 4 ++--
src/qemu/qemu_tpm.c | 2 +-
src/util/vircgroup.c | 32 ++++++++++++++++----------------
src/util/vircgroup.h | 4 ++--
7 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c
index c9f2146487..9bf0174b95 100644
--- a/src/libvirt-lxc.c
+++ b/src/libvirt-lxc.c
@@ -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);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b9dabfef1b..eac66b0174 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1498,8 +1498,8 @@ virBufferVasprintf;
# util/vircgroup.h
-virCgroupAddMachineTask;
-virCgroupAddTask;
+virCgroupAddMachineProcess;
+virCgroupAddProcess;
virCgroupAllowAllDevices;
virCgroupAllowDevice;
virCgroupAllowDevicePath;
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 4e84391bf5..4ead2dc9f0 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -875,12 +875,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;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 72a59dec55..249dac39f2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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)
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 278b262c48..c64114feac 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -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:
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 2328957818..cf510fb019 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1183,35 +1183,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);
}
@@ -1592,7 +1592,7 @@ virCgroupNewMachineSystemd(const char *name,
goto error;
}
- if (virCgroupAddTask(*group, pidleader) < 0)
+ if (virCgroupAddProcess(*group, pidleader) < 0)
goto error;
return 0;
@@ -1648,7 +1648,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);
@@ -4198,8 +4198,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"));
@@ -4208,8 +4208,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"));
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index ee3b7c7222..bbd4c2ed57 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -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);
--
2.17.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list