Blame SOURCES/libvirt-util-Extract-and-rename-qemuDomainDelCgroupForThread-to-virCgroupDelThread.patch

6ae9ed
From 717c8b3107df3cda89453bd2427c231bdad84357 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <717c8b3107df3cda89453bd2427c231bdad84357@dist-git>
6ae9ed
From: Peter Krempa <pkrempa@redhat.com>
6ae9ed
Date: Wed, 24 Aug 2016 16:11:32 -0400
6ae9ed
Subject: [PATCH] util: Extract and rename qemuDomainDelCgroupForThread to
6ae9ed
 virCgroupDelThread
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
6ae9ed
6ae9ed
(cherry picked from commit c84c2cb389398d684a00066c421813e7908a84e7)
6ae9ed
---
6ae9ed
 src/libvirt_private.syms |  1 +
6ae9ed
 src/qemu/qemu_driver.c   | 27 +++------------------------
6ae9ed
 src/util/vircgroup.c     | 20 ++++++++++++++++++++
6ae9ed
 src/util/vircgroup.h     |  4 ++++
6ae9ed
 4 files changed, 28 insertions(+), 24 deletions(-)
6ae9ed
6ae9ed
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
6ae9ed
index b7a1663..7535064 100644
6ae9ed
--- a/src/libvirt_private.syms
6ae9ed
+++ b/src/libvirt_private.syms
6ae9ed
@@ -1265,6 +1265,7 @@ virCgroupBindMount;
6ae9ed
 virCgroupControllerAvailable;
6ae9ed
 virCgroupControllerTypeFromString;
6ae9ed
 virCgroupControllerTypeToString;
6ae9ed
+virCgroupDelThread;
6ae9ed
 virCgroupDenyAllDevices;
6ae9ed
 virCgroupDenyDevice;
6ae9ed
 virCgroupDenyDevicePath;
6ae9ed
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
6ae9ed
index 35ed8ec..43e00ff 100644
6ae9ed
--- a/src/qemu/qemu_driver.c
6ae9ed
+++ b/src/qemu/qemu_driver.c
6ae9ed
@@ -4596,25 +4596,6 @@ static void qemuProcessEventHandler(void *data, void *opaque)
6ae9ed
 
6ae9ed
 
6ae9ed
 static int
6ae9ed
-qemuDomainDelCgroupForThread(virCgroupPtr cgroup,
6ae9ed
-                             virCgroupThreadName nameval,
6ae9ed
-                             int idx)
6ae9ed
-{
6ae9ed
-    virCgroupPtr new_cgroup = NULL;
6ae9ed
-
6ae9ed
-    if (cgroup) {
6ae9ed
-        if (virCgroupNewThread(cgroup, nameval, idx, false, &new_cgroup) < 0)
6ae9ed
-            return -1;
6ae9ed
-
6ae9ed
-        /* Remove the offlined cgroup */
6ae9ed
-        virCgroupRemove(new_cgroup);
6ae9ed
-        virCgroupFree(&new_cgroup);
6ae9ed
-    }
6ae9ed
-
6ae9ed
-    return 0;
6ae9ed
-}
6ae9ed
-
6ae9ed
-static int
6ae9ed
 qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
6ae9ed
                          virDomainObjPtr vm,
6ae9ed
                          unsigned int vcpu)
6ae9ed
@@ -4707,8 +4688,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
6ae9ed
 
6ae9ed
     virDomainAuditVcpu(vm, oldvcpus, oldvcpus - 1, "update", true);
6ae9ed
 
6ae9ed
-    if (qemuDomainDelCgroupForThread(priv->cgroup,
6ae9ed
-                                     VIR_CGROUP_THREAD_VCPU, vcpu) < 0)
6ae9ed
+    if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, vcpu) < 0)
6ae9ed
         goto cleanup;
6ae9ed
 
6ae9ed
     ret = 0;
6ae9ed
@@ -5910,9 +5890,8 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver,
6ae9ed
 
6ae9ed
     virDomainIOThreadIDDel(vm->def, iothread_id);
6ae9ed
 
6ae9ed
-    if (qemuDomainDelCgroupForThread(priv->cgroup,
6ae9ed
-                                     VIR_CGROUP_THREAD_IOTHREAD,
6ae9ed
-                                     iothread_id) < 0)
6ae9ed
+    if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_IOTHREAD,
6ae9ed
+                           iothread_id) < 0)
6ae9ed
         goto cleanup;
6ae9ed
 
6ae9ed
     ret = 0;
6ae9ed
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
6ae9ed
index 04f3818..97cf246 100644
6ae9ed
--- a/src/util/vircgroup.c
6ae9ed
+++ b/src/util/vircgroup.c
6ae9ed
@@ -4819,3 +4819,23 @@ virCgroupControllerAvailable(int controller ATTRIBUTE_UNUSED)
6ae9ed
     return false;
6ae9ed
 }
6ae9ed
 #endif /* !VIR_CGROUP_SUPPORTED */
6ae9ed
+
6ae9ed
+
6ae9ed
+int
6ae9ed
+virCgroupDelThread(virCgroupPtr cgroup,
6ae9ed
+                   virCgroupThreadName nameval,
6ae9ed
+                   int idx)
6ae9ed
+{
6ae9ed
+    virCgroupPtr new_cgroup = NULL;
6ae9ed
+
6ae9ed
+    if (cgroup) {
6ae9ed
+        if (virCgroupNewThread(cgroup, nameval, idx, false, &new_cgroup) < 0)
6ae9ed
+            return -1;
6ae9ed
+
6ae9ed
+        /* Remove the offlined cgroup */
6ae9ed
+        virCgroupRemove(new_cgroup);
6ae9ed
+        virCgroupFree(&new_cgroup);
6ae9ed
+    }
6ae9ed
+
6ae9ed
+    return 0;
6ae9ed
+}
6ae9ed
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
6ae9ed
index 2ddbb35..4b8f3ff 100644
6ae9ed
--- a/src/util/vircgroup.h
6ae9ed
+++ b/src/util/vircgroup.h
6ae9ed
@@ -86,6 +86,10 @@ int virCgroupNewThread(virCgroupPtr domain,
6ae9ed
                        virCgroupPtr *group)
6ae9ed
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(5);
6ae9ed
 
6ae9ed
+int virCgroupDelThread(virCgroupPtr cgroup,
6ae9ed
+                       virCgroupThreadName nameval,
6ae9ed
+                       int idx);
6ae9ed
+
6ae9ed
 int virCgroupNewDetect(pid_t pid,
6ae9ed
                        int controllers,
6ae9ed
                        virCgroupPtr *group);
6ae9ed
-- 
6ae9ed
2.10.0
6ae9ed