[PATCH 1/2] qemu: Add some cpu hotpluggable inforamtion in vm xml when run "virsh setvcpus vm --count <current> --live".

xiajidong xiajidong at cmss.chinamobile.com
Wed Apr 22 12:25:00 UTC 2020



On 4/9/20 9:23 AM, Peter Krempa wrote:
> On Thu, Apr 09, 2020 at 20:38:47 +0800, Jidong Xia wrote:
>> From: xiajidong <xiajidong at cmss.chinamobile.com>
>>
>> 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 at cmss.chinamobile.com>
>> ---
>>   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.I think you are right, I am considering and studying this area.
Thanks & Best Regards
Jidong Xia
>  
> 
> 
> 






More information about the libvir-list mailing list