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

Nitesh Konkar posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1495701256-804-1-git-send-email-niteshkonkar.libvirt@gmail.com
There is a newer version of this series
src/util/virhostcpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH v2] Regression: Report correct CPUs present on executing virsh nodecpumap
Posted by Nitesh Konkar 6 years, 10 months ago
On executing the virsh nodecpumap command, the number
of CPUs present was shown as (last cpu online id + 1). This
patch fixes the issue by reporting the current number of
CPUs present.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.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 aa9cfeac2..6d7e8b4f4 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -1093,7 +1093,7 @@ virHostCPUGetMap(unsigned char **cpumap,
     if (online)
         *online = virBitmapCountBits(cpus);
 
-    ret = virBitmapSize(cpus);
+    ret = virHostCPUParseCountLinux();
 
  cleanup:
     if (ret < 0 && cpumap)
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Regression: Report correct CPUs present on executing virsh nodecpumap
Posted by Peter Krempa 6 years, 10 months ago
On Thu, May 25, 2017 at 14:04:16 +0530, Nitesh Konkar wrote:
> On executing the virsh nodecpumap command, the number
> of CPUs present was shown as (last cpu online id + 1). This
> patch fixes the issue by reporting the current number of
> CPUs present.
> 
> Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
> ---
>  src/util/virhostcpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Did you test it? I did not.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Regression: Report correct CPUs present on executing virsh nodecpumap
Posted by Ján Tomko 6 years, 10 months ago
On Thu, May 25, 2017 at 02:04:16PM +0530, Nitesh Konkar wrote:
>On executing the virsh nodecpumap command, the number
>of CPUs present was shown as (last cpu online id + 1). This
>patch fixes the issue by reporting the current number of
>CPUs present.
>
>Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.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 aa9cfeac2..6d7e8b4f4 100644
>--- a/src/util/virhostcpu.c
>+++ b/src/util/virhostcpu.c
>@@ -1093,7 +1093,7 @@ virHostCPUGetMap(unsigned char **cpumap,
>     if (online)
>         *online = virBitmapCountBits(cpus);
>
>-    ret = virBitmapSize(cpus);
>+    ret = virHostCPUParseCountLinux();

This should be virHostCPUGetCount, just like we have a few lines above.
That way the function has a chance of working on FreeBSD too.

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Regression: Report correct CPUs present on executing virsh nodecpumap
Posted by Nitesh Konkar 6 years, 10 months ago
On Thu, May 25, 2017 at 2:14 PM, Ján Tomko <jtomko@redhat.com> wrote:

> On Thu, May 25, 2017 at 02:04:16PM +0530, Nitesh Konkar wrote:
>
>> On executing the virsh nodecpumap command, the number
>> of CPUs present was shown as (last cpu online id + 1). This
>> patch fixes the issue by reporting the current number of
>> CPUs present.
>>
>> Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.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 aa9cfeac2..6d7e8b4f4 100644
>> --- a/src/util/virhostcpu.c
>> +++ b/src/util/virhostcpu.c
>> @@ -1093,7 +1093,7 @@ virHostCPUGetMap(unsigned char **cpumap,
>>     if (online)
>>         *online = virBitmapCountBits(cpus);
>>
>> -    ret = virBitmapSize(cpus);
>> +    ret = virHostCPUParseCountLinux();
>>
>
> This should be virHostCPUGetCount, just like we have a few lines above.
> That way the function has a chance of working on FreeBSD too.
>
Yea agree. I missed out on checking for FreeBSD.
Nitesh.

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