|
|
6ae9ed |
From 5baee3e1d886f59e18e18c8c585dd74565945531 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <5baee3e1d886f59e18e18c8c585dd74565945531@dist-git>
|
|
|
6ae9ed |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
6ae9ed |
Date: Wed, 14 Sep 2016 13:04:20 +0200
|
|
|
6ae9ed |
Subject: [PATCH] qemu: monitor: Use a more obvious iterator name
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1375783
|
|
|
6ae9ed |
|
|
|
6ae9ed |
The algorithm that matches data from query-cpus and
|
|
|
6ae9ed |
query-hotpluggable-cpus is quite complex. Start using descriptive
|
|
|
6ae9ed |
iterator names to avoid confusion.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
(cherry picked from commit 03376b6da0c1e1774513048b6c992d9836600aac)
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_monitor.c | 23 ++++++++++++-----------
|
|
|
6ae9ed |
1 file changed, 12 insertions(+), 11 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
|
|
6ae9ed |
index 699dd7d..3ddd019 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_monitor.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_monitor.c
|
|
|
6ae9ed |
@@ -1767,6 +1767,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
|
|
|
6ae9ed |
char *tmp;
|
|
|
6ae9ed |
int order = 1;
|
|
|
6ae9ed |
size_t totalvcpus = 0;
|
|
|
6ae9ed |
+ size_t mastervcpu; /* this iterator is used for iterating hotpluggable entities */
|
|
|
6ae9ed |
size_t i;
|
|
|
6ae9ed |
size_t j;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
@@ -1807,19 +1808,19 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
|
|
|
6ae9ed |
/* transfer appropriate data from the hotpluggable list to corresponding
|
|
|
6ae9ed |
* entries. the entries returned by qemu may in fact describe multiple
|
|
|
6ae9ed |
* logical vcpus in the guest */
|
|
|
6ae9ed |
- j = 0;
|
|
|
6ae9ed |
+ mastervcpu = 0;
|
|
|
6ae9ed |
for (i = 0; i < nhotplugvcpus; i++) {
|
|
|
6ae9ed |
- vcpus[j].socket_id = hotplugvcpus[i].socket_id;
|
|
|
6ae9ed |
- vcpus[j].core_id = hotplugvcpus[i].core_id;
|
|
|
6ae9ed |
- vcpus[j].thread_id = hotplugvcpus[i].thread_id;
|
|
|
6ae9ed |
- vcpus[j].vcpus = hotplugvcpus[i].vcpus;
|
|
|
6ae9ed |
- VIR_STEAL_PTR(vcpus[j].qom_path, hotplugvcpus[i].qom_path);
|
|
|
6ae9ed |
- VIR_STEAL_PTR(vcpus[j].alias, hotplugvcpus[i].alias);
|
|
|
6ae9ed |
- VIR_STEAL_PTR(vcpus[j].type, hotplugvcpus[i].type);
|
|
|
6ae9ed |
- vcpus[j].id = hotplugvcpus[i].enable_id;
|
|
|
6ae9ed |
+ vcpus[mastervcpu].socket_id = hotplugvcpus[i].socket_id;
|
|
|
6ae9ed |
+ vcpus[mastervcpu].core_id = hotplugvcpus[i].core_id;
|
|
|
6ae9ed |
+ vcpus[mastervcpu].thread_id = hotplugvcpus[i].thread_id;
|
|
|
6ae9ed |
+ vcpus[mastervcpu].vcpus = hotplugvcpus[i].vcpus;
|
|
|
6ae9ed |
+ VIR_STEAL_PTR(vcpus[mastervcpu].qom_path, hotplugvcpus[i].qom_path);
|
|
|
6ae9ed |
+ VIR_STEAL_PTR(vcpus[mastervcpu].alias, hotplugvcpus[i].alias);
|
|
|
6ae9ed |
+ VIR_STEAL_PTR(vcpus[mastervcpu].type, hotplugvcpus[i].type);
|
|
|
6ae9ed |
+ vcpus[mastervcpu].id = hotplugvcpus[i].enable_id;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- /* skip over vcpu entries covered by this hotpluggable entry */
|
|
|
6ae9ed |
- j += hotplugvcpus[i].vcpus;
|
|
|
6ae9ed |
+ /* calculate next master vcpu (hotpluggable unit) entry */
|
|
|
6ae9ed |
+ mastervcpu += hotplugvcpus[i].vcpus;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
/* match entries from query cpus to the output array taking into account
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.10.0
|
|
|
6ae9ed |
|