mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
qemu: monitor: qemuMonitorGetCPUInfoHotplug: Add iterator 'anycpu'
Add separate iterator for iterating all the entries
This commit is contained in:
parent
03376b6da0
commit
66da0356cd
@ -1773,6 +1773,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
|
|||||||
int order = 1;
|
int order = 1;
|
||||||
size_t totalvcpus = 0;
|
size_t totalvcpus = 0;
|
||||||
size_t mastervcpu; /* this iterator is used for iterating hotpluggable entities */
|
size_t mastervcpu; /* this iterator is used for iterating hotpluggable entities */
|
||||||
|
size_t anyvcpu; /* this iterator is used for any vcpu entry in the result */
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
@ -1832,27 +1833,27 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
|
|||||||
* multi-vcpu objects */
|
* multi-vcpu objects */
|
||||||
for (j = 0; j < ncpuentries; j++) {
|
for (j = 0; j < ncpuentries; j++) {
|
||||||
/* find the correct entry or beginning of group of entries */
|
/* find the correct entry or beginning of group of entries */
|
||||||
for (i = 0; i < maxvcpus; i++) {
|
for (anyvcpu = 0; anyvcpu < maxvcpus; anyvcpu++) {
|
||||||
if (cpuentries[j].qom_path && vcpus[i].qom_path &&
|
if (cpuentries[j].qom_path && vcpus[anyvcpu].qom_path &&
|
||||||
STREQ(cpuentries[j].qom_path, vcpus[i].qom_path))
|
STREQ(cpuentries[j].qom_path, vcpus[anyvcpu].qom_path))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == maxvcpus) {
|
if (anyvcpu == maxvcpus) {
|
||||||
VIR_DEBUG("too many query-cpus entries for a given "
|
VIR_DEBUG("too many query-cpus entries for a given "
|
||||||
"query-hotpluggable-cpus entry");
|
"query-hotpluggable-cpus entry");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vcpus[i].vcpus != 1) {
|
if (vcpus[anyvcpu].vcpus != 1) {
|
||||||
/* find a possibly empty vcpu thread for core granularity systems */
|
/* find a possibly empty vcpu thread for core granularity systems */
|
||||||
for (; i < maxvcpus; i++) {
|
for (; anyvcpu < maxvcpus; anyvcpu++) {
|
||||||
if (vcpus[i].tid == 0)
|
if (vcpus[anyvcpu].tid == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vcpus[i].tid = cpuentries[j].tid;
|
vcpus[anyvcpu].tid = cpuentries[j].tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user