---
src/libvirt_private.syms | 1 +
src/qemu/qemu_driver.c | 27 +++------------------------
src/util/vircgroup.c | 20 ++++++++++++++++++++
src/util/vircgroup.h | 4 ++++
4 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 419c33d..1424f62 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1268,6 +1268,7 @@ virCgroupBindMount;
virCgroupControllerAvailable;
virCgroupControllerTypeFromString;
virCgroupControllerTypeToString;
+virCgroupDelThread;
virCgroupDenyAllDevices;
virCgroupDenyDevice;
virCgroupDenyDevicePath;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cd1fb3d..476f9d8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4590,25 +4590,6 @@ static void qemuProcessEventHandler(void *data, void *opaque)
static int
-qemuDomainDelCgroupForThread(virCgroupPtr cgroup,
- virCgroupThreadName nameval,
- int idx)
-{
- virCgroupPtr new_cgroup = NULL;
-
- if (cgroup) {
- if (virCgroupNewThread(cgroup, nameval, idx, false, &new_cgroup) < 0)
- return -1;
-
- /* Remove the offlined cgroup */
- virCgroupRemove(new_cgroup);
- virCgroupFree(&new_cgroup);
- }
-
- return 0;
-}
-
-static int
qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
virDomainObjPtr vm,
unsigned int vcpu)
@@ -4701,8 +4682,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
virDomainAuditVcpu(vm, oldvcpus, oldvcpus - 1, "update", true);
- if (qemuDomainDelCgroupForThread(priv->cgroup,
- VIR_CGROUP_THREAD_VCPU, vcpu) < 0)
+ if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, vcpu) < 0)
goto cleanup;
ret = 0;
@@ -5877,9 +5857,8 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver,
virDomainIOThreadIDDel(vm->def, iothread_id);
- if (qemuDomainDelCgroupForThread(priv->cgroup,
- VIR_CGROUP_THREAD_IOTHREAD,
- iothread_id) < 0)
+ if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_IOTHREAD,
+ iothread_id) < 0)
goto cleanup;
ret = 0;
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 07cd7f6..f2477d5 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -4821,3 +4821,23 @@ virCgroupControllerAvailable(int controller ATTRIBUTE_UNUSED)
return false;
}
#endif /* !VIR_CGROUP_SUPPORTED */
+
+
+int
+virCgroupDelThread(virCgroupPtr cgroup,
+ virCgroupThreadName nameval,
+ int idx)
+{
+ virCgroupPtr new_cgroup = NULL;
+
+ if (cgroup) {
+ if (virCgroupNewThread(cgroup, nameval, idx, false, &new_cgroup) < 0)
+ return -1;
+
+ /* Remove the offlined cgroup */
+ virCgroupRemove(new_cgroup);
+ virCgroupFree(&new_cgroup);
+ }
+
+ return 0;
+}
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 2ddbb35..4b8f3ff 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -86,6 +86,10 @@ int virCgroupNewThread(virCgroupPtr domain,
virCgroupPtr *group)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(5);
+int virCgroupDelThread(virCgroupPtr cgroup,
+ virCgroupThreadName nameval,
+ int idx);
+
int virCgroupNewDetect(pid_t pid,
int controllers,
virCgroupPtr *group);
--
2.9.2