From d91f1d09bcd6297034d7a9b87c40036aafc2b20c Mon Sep 17 00:00:00 2001
Message-Id: <d91f1d09bcd6297034d7a9b87c40036aafc2b20c@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:06:14 +0200
Subject: [PATCH] vircgroup: rename virCgroupAdd.*Task to virCgroupAdd.*Process
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In cgroup v2 we need to handle processes and threads differently,
following patch will introduce virCgroupAddThread.
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 0772c34685848dabf73574feeb2dd35b2edd9e18)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <75bd43c8342b621a7c01e1431a29bc505e7c155f.1561993099.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@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 2ec9d8f4bf..5dd24e2e66 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1513,8 +1513,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 db14d322f5..c21586fa12 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2538,7 +2538,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;
}
@@ -2776,7 +2776,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.22.0