render / rpms / libvirt

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