[libvirt] [PATCH] Fix a JSON CPU information bug.

When using the JSON monitor, qemuMonitorJSONExtractCPUInfo was returning 0 on success. Unfortunately, higher levels of the cpuinfo code expect that it returns the number of CPUs it found on success. This one-line patch fixes it so that it returns the correct number. This makes "virsh vcpuinfo <domain>" work when using the JSON monitor. Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_monitor_json.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index f04fd2e..7a263cb 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -648,7 +648,7 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply, *pids = threads; threads = NULL; - ret = 0; + ret = ncpus; cleanup: VIR_FREE(threads); -- 1.6.6.1

On Wed, Mar 10, 2010 at 01:36:21PM -0500, Chris Lalancette wrote:
When using the JSON monitor, qemuMonitorJSONExtractCPUInfo was returning 0 on success. Unfortunately, higher levels of the cpuinfo code expect that it returns the number of CPUs it found on success. This one-line patch fixes it so that it returns the correct number. This makes "virsh vcpuinfo <domain>" work when using the JSON monitor.
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_monitor_json.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index f04fd2e..7a263cb 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -648,7 +648,7 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
*pids = threads; threads = NULL; - ret = 0; + ret = ncpus;
cleanup: VIR_FREE(threads);
ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 03/11/2010 10:38 AM, Daniel Veillard wrote:
On Wed, Mar 10, 2010 at 01:36:21PM -0500, Chris Lalancette wrote:
When using the JSON monitor, qemuMonitorJSONExtractCPUInfo was returning 0 on success. Unfortunately, higher levels of the cpuinfo code expect that it returns the number of CPUs it found on success. This one-line patch fixes it so that it returns the correct number. This makes "virsh vcpuinfo <domain>" work when using the JSON monitor.
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_monitor_json.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index f04fd2e..7a263cb 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -648,7 +648,7 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
*pids = threads; threads = NULL; - ret = 0; + ret = ncpus;
cleanup: VIR_FREE(threads);
ACK,
Thanks, pushed. -- Chris Lalancette
participants (2)
-
Chris Lalancette
-
Daniel Veillard