[PATCH] Regression: Report correct CPUs present on executing virsh nodecpumap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Recent changes to virbitmap.c file created a regression
where on executing the virsh nodecpumap command, the number
of CPUs present was shown as (last cpu online id + 1). This
patch fixes the issue.

Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx>
---
 src/Makefile.am      |  2 ++
 src/util/virbitmap.c | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index f95f30e2f..96c541c9c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3303,6 +3303,8 @@ libvirt_nss_la_SOURCES =		\
 		util/viratomic.h		\
 		util/virbitmap.c		\
 		util/virbitmap.h		\
+		util/virhostcpu.c		\
+		util/virhostcpu.h		\
 		util/virbuffer.c		\
 		util/virbuffer.h		\
 		util/vircommand.c		\
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index eac63d997..dc427f430 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -37,6 +37,7 @@
 #include "count-one-bits.h"
 #include "virstring.h"
 #include "virerror.h"
+#include "virhostcpu.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
@@ -565,9 +566,14 @@ virBitmapParseUnlimited(const char *str)
     const char *cur = str;
     char *tmp;
     size_t i;
-    int start, last;
+    int start, last, bitmapSize;
+
+    bitmapSize = virHostCPUGetCount();
+
+    if (bitmapSize < 0)
+        return NULL;
 
-    if (!(bitmap = virBitmapNewEmpty()))
+    if (!(bitmap = virBitmapNew(bitmapSize)))
         return NULL;
 
     if (!str)
-- 
2.11.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux