diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 47069be90072f6e0d9fb51b4dfe090296fab3fdf..a76df64a7b913ff9720df0b9e280d5372254becc 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6478,18 +6478,16 @@ qemuDomainVcpuValidateConfig(virDomainDefPtr def, return -1; } + firstvcpu = virBitmapNextSetBit(map, -1); + /* non-hotpluggable vcpus need to stay clustered starting from vcpu 0 */ - for (next = virBitmapNextSetBit(map, -1) + 1; next < maxvcpus; next++) { + for (next = firstvcpu + 1; next < maxvcpus; next++) { if (!(vcpu = virDomainDefGetVcpu(def, next))) continue; /* skip vcpus being modified */ - if (virBitmapIsBitSet(map, next)) { - if (firstvcpu < 0) - firstvcpu = next; - + if (virBitmapIsBitSet(map, next)) continue; - } if (vcpu->online && vcpu->hotpluggable == VIR_TRISTATE_BOOL_NO) { virReportError(VIR_ERR_INVALID_ARG,