|
|
6ae9ed |
From c3ae7baaaf353b9d4f71600456f4636030f9d788 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <c3ae7baaaf353b9d4f71600456f4636030f9d788@dist-git>
|
|
|
6ae9ed |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
6ae9ed |
Date: Wed, 14 Sep 2016 13:04:21 +0200
|
|
|
6ae9ed |
Subject: [PATCH] qemu: monitor: qemuMonitorGetCPUInfoHotplug: Add iterator
|
|
|
6ae9ed |
'anycpu'
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1375783
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Add separate iterator for iterating all the entries
|
|
|
6ae9ed |
|
|
|
6ae9ed |
(cherry picked from commit 66da0356cd62398b1e06de317458e8883cb32db6)
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_monitor.c | 17 +++++++++--------
|
|
|
6ae9ed |
1 file changed, 9 insertions(+), 8 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
|
|
6ae9ed |
index 3ddd019..b88b0de 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_monitor.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_monitor.c
|
|
|
6ae9ed |
@@ -1768,6 +1768,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
|
|
|
6ae9ed |
int order = 1;
|
|
|
6ae9ed |
size_t totalvcpus = 0;
|
|
|
6ae9ed |
size_t mastervcpu; /* this iterator is used for iterating hotpluggable entities */
|
|
|
6ae9ed |
+ size_t anyvcpu; /* this iterator is used for any vcpu entry in the result */
|
|
|
6ae9ed |
size_t i;
|
|
|
6ae9ed |
size_t j;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
@@ -1827,27 +1828,27 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
|
|
|
6ae9ed |
* multi-vcpu objects */
|
|
|
6ae9ed |
for (j = 0; j < ncpuentries; j++) {
|
|
|
6ae9ed |
/* find the correct entry or beginning of group of entries */
|
|
|
6ae9ed |
- for (i = 0; i < maxvcpus; i++) {
|
|
|
6ae9ed |
- if (cpuentries[j].qom_path && vcpus[i].qom_path &&
|
|
|
6ae9ed |
- STREQ(cpuentries[j].qom_path, vcpus[i].qom_path))
|
|
|
6ae9ed |
+ for (anyvcpu = 0; anyvcpu < maxvcpus; anyvcpu++) {
|
|
|
6ae9ed |
+ if (cpuentries[j].qom_path && vcpus[anyvcpu].qom_path &&
|
|
|
6ae9ed |
+ STREQ(cpuentries[j].qom_path, vcpus[anyvcpu].qom_path))
|
|
|
6ae9ed |
break;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- if (i == maxvcpus) {
|
|
|
6ae9ed |
+ if (anyvcpu == maxvcpus) {
|
|
|
6ae9ed |
VIR_DEBUG("too many query-cpus entries for a given "
|
|
|
6ae9ed |
"query-hotpluggable-cpus entry");
|
|
|
6ae9ed |
return -1;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- if (vcpus[i].vcpus != 1) {
|
|
|
6ae9ed |
+ if (vcpus[anyvcpu].vcpus != 1) {
|
|
|
6ae9ed |
/* find a possibly empty vcpu thread for core granularity systems */
|
|
|
6ae9ed |
- for (; i < maxvcpus; i++) {
|
|
|
6ae9ed |
- if (vcpus[i].tid == 0)
|
|
|
6ae9ed |
+ for (; anyvcpu < maxvcpus; anyvcpu++) {
|
|
|
6ae9ed |
+ if (vcpus[anyvcpu].tid == 0)
|
|
|
6ae9ed |
break;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- vcpus[i].tid = cpuentries[j].tid;
|
|
|
6ae9ed |
+ vcpus[anyvcpu].tid = cpuentries[j].tid;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
return 0;
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.10.0
|
|
|
6ae9ed |
|