c480ed
From d91f1d09bcd6297034d7a9b87c40036aafc2b20c Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <d91f1d09bcd6297034d7a9b87c40036aafc2b20c@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:06:14 +0200
c480ed
Subject: [PATCH] vircgroup: rename virCgroupAdd.*Task to virCgroupAdd.*Process
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
In cgroup v2 we need to handle processes and threads differently,
c480ed
following patch will introduce virCgroupAddThread.
c480ed
c480ed
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
(cherry picked from commit 0772c34685848dabf73574feeb2dd35b2edd9e18)
c480ed
c480ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Message-Id: <75bd43c8342b621a7c01e1431a29bc505e7c155f.1561993099.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/libvirt-lxc.c        |  2 +-
c480ed
 src/libvirt_private.syms |  4 ++--
c480ed
 src/lxc/lxc_controller.c |  4 ++--
c480ed
 src/qemu/qemu_process.c  |  4 ++--
c480ed
 src/qemu/qemu_tpm.c      |  2 +-
c480ed
 src/util/vircgroup.c     | 32 ++++++++++++++++----------------
c480ed
 src/util/vircgroup.h     |  4 ++--
c480ed
 7 files changed, 26 insertions(+), 26 deletions(-)
c480ed
c480ed
diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c
c480ed
index c9f2146487..9bf0174b95 100644
c480ed
--- a/src/libvirt-lxc.c
c480ed
+++ b/src/libvirt-lxc.c
c480ed
@@ -306,7 +306,7 @@ int virDomainLxcEnterCGroup(virDomainPtr domain,
c480ed
     if (virCgroupNewDetect(domain->id, -1, &cgroup) < 0)
c480ed
         goto error;
c480ed
 
c480ed
-    if (virCgroupAddTask(cgroup, getpid()) < 0)
c480ed
+    if (virCgroupAddProcess(cgroup, getpid()) < 0)
c480ed
         goto error;
c480ed
 
c480ed
     virCgroupFree(&cgroup);
c480ed
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
c480ed
index 2ec9d8f4bf..5dd24e2e66 100644
c480ed
--- a/src/libvirt_private.syms
c480ed
+++ b/src/libvirt_private.syms
c480ed
@@ -1513,8 +1513,8 @@ virBufferVasprintf;
c480ed
 
c480ed
 
c480ed
 # util/vircgroup.h
c480ed
-virCgroupAddMachineTask;
c480ed
-virCgroupAddTask;
c480ed
+virCgroupAddMachineProcess;
c480ed
+virCgroupAddProcess;
c480ed
 virCgroupAllowAllDevices;
c480ed
 virCgroupAllowDevice;
c480ed
 virCgroupAllowDevicePath;
c480ed
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
c480ed
index 4e84391bf5..4ead2dc9f0 100644
c480ed
--- a/src/lxc/lxc_controller.c
c480ed
+++ b/src/lxc/lxc_controller.c
c480ed
@@ -875,12 +875,12 @@ static int virLXCControllerSetupCgroupLimits(virLXCControllerPtr ctrl)
c480ed
                                             ctrl->nicindexes)))
c480ed
         goto cleanup;
c480ed
 
c480ed
-    if (virCgroupAddMachineTask(ctrl->cgroup, getpid()) < 0)
c480ed
+    if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0)
c480ed
         goto cleanup;
c480ed
 
c480ed
     /* Add all qemu-nbd tasks to the cgroup */
c480ed
     for (i = 0; i < ctrl->nnbdpids; i++) {
c480ed
-        if (virCgroupAddMachineTask(ctrl->cgroup, ctrl->nbdpids[i]) < 0)
c480ed
+        if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->nbdpids[i]) < 0)
c480ed
             goto cleanup;
c480ed
     }
c480ed
 
c480ed
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
c480ed
index db14d322f5..c21586fa12 100644
c480ed
--- a/src/qemu/qemu_process.c
c480ed
+++ b/src/qemu/qemu_process.c
c480ed
@@ -2538,7 +2538,7 @@ qemuProcessSetupPid(virDomainObjPtr vm,
c480ed
             goto cleanup;
c480ed
 
c480ed
         /* Move the thread to the sub dir */
c480ed
-        if (virCgroupAddTask(cgroup, pid) < 0)
c480ed
+        if (virCgroupAddProcess(cgroup, pid) < 0)
c480ed
             goto cleanup;
c480ed
 
c480ed
     }
c480ed
@@ -2776,7 +2776,7 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
c480ed
     }
c480ed
 
c480ed
     if (priv->cgroup &&
c480ed
-        virCgroupAddMachineTask(priv->cgroup, cpid) < 0)
c480ed
+        virCgroupAddMachineProcess(priv->cgroup, cpid) < 0)
c480ed
         goto cleanup;
c480ed
 
c480ed
     if (qemuSecurityDomainSetPathLabel(driver, vm, socketPath, true) < 0)
c480ed
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
c480ed
index 278b262c48..c64114feac 100644
c480ed
--- a/src/qemu/qemu_tpm.c
c480ed
+++ b/src/qemu/qemu_tpm.c
c480ed
@@ -905,7 +905,7 @@ qemuExtTPMSetupCgroup(virQEMUDriverPtr driver,
c480ed
                            _("Could not get process id of swtpm"));
c480ed
             goto cleanup;
c480ed
         }
c480ed
-        if (virCgroupAddTask(cgroup, pid) < 0)
c480ed
+        if (virCgroupAddProcess(cgroup, pid) < 0)
c480ed
             goto cleanup;
c480ed
         break;
c480ed
     case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
c480ed
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
c480ed
index 2328957818..cf510fb019 100644
c480ed
--- a/src/util/vircgroup.c
c480ed
+++ b/src/util/vircgroup.c
c480ed
@@ -1183,35 +1183,35 @@ virCgroupAddTaskInternal(virCgroupPtr group, pid_t pid, bool withSystemd)
c480ed
 }
c480ed
 
c480ed
 /**
c480ed
- * virCgroupAddTask:
c480ed
+ * virCgroupAddProcess:
c480ed
  *
c480ed
- * @group: The cgroup to add a task to
c480ed
- * @pid: The pid of the task to add
c480ed
+ * @group: The cgroup to add a process to
c480ed
+ * @pid: The pid of the process to add
c480ed
  *
c480ed
- * Will add the task to all controllers, except the
c480ed
+ * Will add the process to all controllers, except the
c480ed
  * systemd unit controller.
c480ed
  *
c480ed
  * Returns: 0 on success, -1 on error
c480ed
  */
c480ed
 int
c480ed
-virCgroupAddTask(virCgroupPtr group, pid_t pid)
c480ed
+virCgroupAddProcess(virCgroupPtr group, pid_t pid)
c480ed
 {
c480ed
     return virCgroupAddTaskInternal(group, pid, false);
c480ed
 }
c480ed
 
c480ed
 /**
c480ed
- * virCgroupAddMachineTask:
c480ed
+ * virCgroupAddMachineProcess:
c480ed
  *
c480ed
- * @group: The cgroup to add a task to
c480ed
- * @pid: The pid of the task to add
c480ed
+ * @group: The cgroup to add a process to
c480ed
+ * @pid: The pid of the process to add
c480ed
  *
c480ed
- * Will add the task to all controllers, including the
c480ed
+ * Will add the process to all controllers, including the
c480ed
  * systemd unit controller.
c480ed
  *
c480ed
  * Returns: 0 on success, -1 on error
c480ed
  */
c480ed
 int
c480ed
-virCgroupAddMachineTask(virCgroupPtr group, pid_t pid)
c480ed
+virCgroupAddMachineProcess(virCgroupPtr group, pid_t pid)
c480ed
 {
c480ed
     return virCgroupAddTaskInternal(group, pid, true);
c480ed
 }
c480ed
@@ -1592,7 +1592,7 @@ virCgroupNewMachineSystemd(const char *name,
c480ed
         goto error;
c480ed
     }
c480ed
 
c480ed
-    if (virCgroupAddTask(*group, pidleader) < 0)
c480ed
+    if (virCgroupAddProcess(*group, pidleader) < 0)
c480ed
         goto error;
c480ed
 
c480ed
     return 0;
c480ed
@@ -1648,7 +1648,7 @@ virCgroupNewMachineManual(const char *name,
c480ed
                                     group) < 0)
c480ed
         goto cleanup;
c480ed
 
c480ed
-    if (virCgroupAddTask(*group, pidleader) < 0) {
c480ed
+    if (virCgroupAddProcess(*group, pidleader) < 0) {
c480ed
         virErrorPtr saved = virSaveLastError();
c480ed
         virCgroupRemove(*group);
c480ed
         virCgroupFree(group);
c480ed
@@ -4198,8 +4198,8 @@ virCgroupPathOfController(virCgroupPtr group ATTRIBUTE_UNUSED,
c480ed
 
c480ed
 
c480ed
 int
c480ed
-virCgroupAddTask(virCgroupPtr group ATTRIBUTE_UNUSED,
c480ed
-                 pid_t pid ATTRIBUTE_UNUSED)
c480ed
+virCgroupAddProcess(virCgroupPtr group ATTRIBUTE_UNUSED,
c480ed
+                    pid_t pid ATTRIBUTE_UNUSED)
c480ed
 {
c480ed
     virReportSystemError(ENXIO, "%s",
c480ed
                          _("Control groups not supported on this platform"));
c480ed
@@ -4208,8 +4208,8 @@ virCgroupAddTask(virCgroupPtr group ATTRIBUTE_UNUSED,
c480ed
 
c480ed
 
c480ed
 int
c480ed
-virCgroupAddMachineTask(virCgroupPtr group ATTRIBUTE_UNUSED,
c480ed
-                        pid_t pid ATTRIBUTE_UNUSED)
c480ed
+virCgroupAddMachineProcess(virCgroupPtr group ATTRIBUTE_UNUSED,
c480ed
+                           pid_t pid ATTRIBUTE_UNUSED)
c480ed
 {
c480ed
     virReportSystemError(ENXIO, "%s",
c480ed
                          _("Control groups not supported on this platform"));
c480ed
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
c480ed
index ee3b7c7222..bbd4c2ed57 100644
c480ed
--- a/src/util/vircgroup.h
c480ed
+++ b/src/util/vircgroup.h
c480ed
@@ -118,8 +118,8 @@ int virCgroupPathOfController(virCgroupPtr group,
c480ed
                               const char *key,
c480ed
                               char **path);
c480ed
 
c480ed
-int virCgroupAddTask(virCgroupPtr group, pid_t pid);
c480ed
-int virCgroupAddMachineTask(virCgroupPtr group, pid_t pid);
c480ed
+int virCgroupAddProcess(virCgroupPtr group, pid_t pid);
c480ed
+int virCgroupAddMachineProcess(virCgroupPtr group, pid_t pid);
c480ed
 
c480ed
 int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight);
c480ed
 int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight);
c480ed
-- 
c480ed
2.22.0
c480ed