[libvirt] [PATCH] qemu: hotplug: Ignore cgroup errors when hot-unplugging vcpus

Peter Krempa posted 1 patch 6 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/7ebdaa52abb13b24826f90c25ae43d96dc2eb9f3.1506371847.git.pkrempa@redhat.com
src/qemu/qemu_hotplug.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
[libvirt] [PATCH] qemu: hotplug: Ignore cgroup errors when hot-unplugging vcpus
Posted by Peter Krempa 6 years, 6 months ago
When the vcpu is successfully removed libvirt would remove the cgroup.
In cases when removal of the cgroup fails libvirt would report an error.

This does not make much sense, since the vcpu was removed and we can't
really do anything with the cgroup. This patch silences the errors from
cgroup removal.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1462092
---
 src/qemu/qemu_hotplug.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7592049ea..4913e18e6 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5322,6 +5322,7 @@ qemuDomainRemoveVcpu(virQEMUDriverPtr driver,
     qemuDomainVcpuPrivatePtr vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpuinfo);
     int oldvcpus = virDomainDefGetVcpus(vm->def);
     unsigned int nvcpus = vcpupriv->vcpus;
+    virErrorPtr save_error = NULL;
     size_t i;

     if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0)
@@ -5346,11 +5347,12 @@ qemuDomainRemoveVcpu(virQEMUDriverPtr driver,

     virDomainAuditVcpu(vm, oldvcpus, oldvcpus - nvcpus, "update", true);

-    for (i = vcpu; i < vcpu + nvcpus; i++) {
-        vcpuinfo = virDomainDefGetVcpu(vm->def, i);
-        if (virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i) < 0)
-            return -1;
-    }
+    virErrorPreserveLast(&save_error);
+
+    for (i = vcpu; i < vcpu + nvcpus; i++)
+        ignore_value(virCgroupDelThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i));
+
+    virErrorRestore(&save_error);

     return 0;
 }
-- 
2.14.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: hotplug: Ignore cgroup errors when hot-unplugging vcpus
Posted by John Ferlan 6 years, 6 months ago

On 09/25/2017 04:37 PM, Peter Krempa wrote:
> When the vcpu is successfully removed libvirt would remove the cgroup.
> In cases when removal of the cgroup fails libvirt would report an error.
> 
> This does not make much sense, since the vcpu was removed and we can't
> really do anything with the cgroup. This patch silences the errors from
> cgroup removal.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1462092
> ---
>  src/qemu/qemu_hotplug.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list