On Thu, Apr 09, 2020 at 20:38:47 +0800, Jidong Xia wrote: > From: xiajidong <xiajidong@xxxxxxxxxxxxxxxxxxxx> > > The optional cpu attribute current can be used to specify whether > fewer than the maximum number of virtual CPUs should be enabled. > when run "virsh setvcpus vm --count <current> --live", it can > display cpu hotpluggable information when run "virsh dumpxml vm > | grep vcpu". so we can know the value of enabled and hotpluggable > attributes of the current vcpus. > > Signed-off-by: Jidong Xia <xiajidong@xxxxxxxxxxxxxxxxxxxx> > --- > src/qemu/qemu_hotplug.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c > index 14654a1..c574f63 100644 > --- a/src/qemu/qemu_hotplug.c > +++ b/src/qemu/qemu_hotplug.c > @@ -6168,6 +6168,10 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDefPtr def, > } else { > *enable = false; > > + if (nvcpus == curvcpus) { > + def->individualvcpus = true; > + } The 'individualvcpus' flag here is deliberately not asserted in this API so that if only old/legacy vcpu hotplug APIs are used (qemuDomainSetVcpusFlags, note the plural Vcpus) we don't change the behaviour or XML. With new APIs used (qemuDomainSetVcpu, virsh setvcpu - note singular vcpu) the flag is asserted always and the output now displays everything. The commit message plainly states the facts when the extended cpu state is displayed, but does not justify why you want to change it, so please add a justification. Additionally if you justify the change enough, the correct fix will be to remove individualvcpus completely from 'def' and always display the information in the XML rather than adding these hacks.