diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e3bc8cc77bb128171bc693f9cdbff88308b797c2..845ecdca866e0ec5bb3443521d61b2c9ffe07f7a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4943,9 +4943,20 @@ qemuDomainSetVcpusConfig(virDomainDefPtr def, for (i = 0; i < maxvcpus; i++) { vcpu = virDomainDefGetVcpu(def, i); - if (!vcpu || vcpu->online) + if (!vcpu) continue; + if (vcpu->online) { + /* non-hotpluggable vcpus need to be clustered at the beggining, + * thus we need to force vcpus to be hotpluggable when we find + * vcpus that are hotpluggable and online prior to the ones + * we are going to add */ + if (vcpu->hotpluggable == VIR_TRISTATE_BOOL_YES) + hotpluggable = true; + + continue; + } + vcpu->online = true; if (hotpluggable) { vcpu->hotpluggable = VIR_TRISTATE_BOOL_YES;