]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vircgroup: rename virCgroupAdd.*Task to virCgroupAdd.*Process
authorPavel Hrdina <phrdina@redhat.com>
Tue, 11 Sep 2018 13:03:22 +0000 (15:03 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 25 Sep 2018 07:59:23 +0000 (09:59 +0200)
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>
src/libvirt-lxc.c
src/libvirt_private.syms
src/lxc/lxc_controller.c
src/qemu/qemu_process.c
src/qemu/qemu_tpm.c
src/util/vircgroup.c
src/util/vircgroup.h

index c9f2146487d6a9b6c34c889b7bdea0e260b39524..9bf0174b955ef0614cdc7572639f4f61bca37eeb 100644 (file)
@@ -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);
index 36a15ada4be680a797195f9275895c261d227e69..825f68005ef74b70a62bdf72418dee3bb5899f39 100644 (file)
@@ -1498,8 +1498,8 @@ virBufferVasprintf;
 
 
 # util/vircgroup.h
-virCgroupAddMachineTask;
-virCgroupAddTask;
+virCgroupAddMachineProcess;
+virCgroupAddProcess;
 virCgroupAllowAllDevices;
 virCgroupAllowDevice;
 virCgroupAllowDevicePath;
index d81c8e946dba87db8c57f1e61a1427d7e469c921..62dfd094739ddc41e5d9a08e77dada212cc2ae6a 100644 (file)
@@ -874,12 +874,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;
     }
 
index 98a240a350ca7293eaebf4833725a7ae61a5fe8d..ca0fb0504d435dad924a553c9e56da88f56f243a 100644 (file)
@@ -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)
index 278b262c48b993e42053688b03ebc831667065b0..c64114feacc60260cab9f81d8da2fe48b83d366d 100644 (file)
@@ -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:
index 8508a951d484698f69b93e717765c57050063ba0..a6d216693059b8f7e72f8912082286af73b971e7 100644 (file)
@@ -1179,35 +1179,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);
 }
@@ -1588,7 +1588,7 @@ virCgroupNewMachineSystemd(const char *name,
         goto error;
     }
 
-    if (virCgroupAddTask(*group, pidleader) < 0)
+    if (virCgroupAddProcess(*group, pidleader) < 0)
         goto error;
 
     return 0;
@@ -1644,7 +1644,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);
@@ -4194,8 +4194,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"));
@@ -4204,8 +4204,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"));
index ee3b7c72229f0c643df66e50375082bfc2f436d3..bbd4c2ed57cbc3fc696d12830b0f3ae9b442c291 100644 (file)
@@ -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);