qemuBuildSmpCommandLine - is ending up generating "-smp 0," after
first/subsequent restarts of the guest and we see "error: internal error: qemu
reported thread id for inactive vcpu 'X'"
The PostParse logic which changes the hotplug = ABSENT to NO for each vcpus is
not called with virDomainDefCopy(because of SKIP_POST_PARSE) after
first/subsequent restarts of the guest. Skipping post-parse is fine for all
devices as the changes done as part of previous post-parse are captured in
virDomainDefFormat and effectively copied during virDomainDefCopy. With
cpu-hotplug, the def->individualvcpus is what determines whether the <vcpus>
are to be formatted or not in the xml. Since individualvcpus is not set, the
copies will have hotpluggable as ABSENT.
The fix here is qemuBuildSmpCommandLine to check if the individualvcpus are
set OR check the ABSENT flag. We dont want to set the individualvcpus in
post-parse as that would disallow migration backwards to qemus not supporting
hotplug. So, set check the ABSENT flag too when counting the vcpus instead.
Signed-off-by: Shivaprasad <sbhat(a)linux.vnet.ibm.com>
---
src/qemu/qemu_command.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 529bcb1..0a3c9ed 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7113,7 +7113,8 @@ qemuBuildSmpCommandLine(virCommandPtr cmd,
* in a different way */
for (i = 0; i < maxvcpus; i++) {
vcpu = virDomainDefGetVcpu(def, i);
- if (vcpu->online && vcpu->hotpluggable == VIR_TRISTATE_BOOL_NO)
+ if (vcpu->online && ((vcpu->hotpluggable == VIR_TRISTATE_BOOL_NO)
||
+ (vcpu->hotpluggable == VIR_TRISTATE_BOOL_ABSENT)))
nvcpus++;
}