render / rpms / libvirt

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