libvirt/libvirt-virshDomainGetVcpuBitmap-Return-bitmap-when-taking-the-fallback-path.patch
Jiri Denemark 96fb2403dd libvirt-7.7.0-3.el9
- virshDomainGetVcpuBitmap: Return bitmap when taking the fallback path (rhbz#2004429)

Resolves: rhbz#2004429
2021-09-22 13:37:01 +02:00

46 lines
1.5 KiB
Diff

From fdbfa94e98ef8a62dc170c6f22970bddba602eda Mon Sep 17 00:00:00 2001
Message-Id: <fdbfa94e98ef8a62dc170c6f22970bddba602eda@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 15 Sep 2021 15:09:00 +0200
Subject: [PATCH] virshDomainGetVcpuBitmap: Return bitmap when taking the
fallback path
In case the specific VCPU states are not present in the XML we were
taking a fallback code path just noting that all cpus of the VM are
enabled.
This was broken by a mistake in a recent refactor where a 'goto cleanup'
was mistakenly replaced by a 'return NULL'. This broke reporting of cpus
and also caused a memory leak.
Return the fallback cpu map.
Fixes: bd1f40fe7d4
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2004429
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
(cherry picked from commit 59e74c319384b766a50669c6248222da0cf10fd0)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e5bd1fdd75..f5a3e1accc 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6710,7 +6710,7 @@ virshDomainGetVcpuBitmap(vshControl *ctl,
for (i = 0; i < curvcpus; i++)
ignore_value(virBitmapSetBit(ret, i));
- return NULL;
+ return ret;
}
for (i = 0; i < nnodes; i++) {
--
2.33.0