render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 0a811ab61fdd075efa148e50f567c6a198b57148 Mon Sep 17 00:00:00 2001
Message-Id: <0a811ab61fdd075efa148e50f567c6a198b57148@dist-git>
From: Nitesh Konkar <niteshkonkar.libvirt@gmail.com>
Date: Tue, 30 May 2017 13:48:17 +0200
Subject: [PATCH] util: hostcpu: Correctly report total number of vcpus in
 virHostCPUGetMap

Callers expect the return value to be the total number of vcpus in the
host (including offline vcpus). The refactor in c67e04e25fa58104e0fae41
broke this assumption by using virHostCPUGetOnlineBitmap which only
creates a bitmap long enough to hold the last online vcpu.

Report the full number of host vcpus by returning value from
virHostCPUGetCount().

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 4ae0f65669a6672a408e08698678ed2958a77fde)

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1456793
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/util/virhostcpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 20d3a004b..67daace89 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -1081,7 +1081,7 @@ virHostCPUGetMap(unsigned char **cpumap,
     if (online)
         *online = virBitmapCountBits(cpus);
 
-    ret = virBitmapSize(cpus);
+    ret = virHostCPUGetCount();
 
  cleanup:
     if (ret < 0 && cpumap)
-- 
2.13.0