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

Jidong Xia xiajidong at cmss.chinamobile.com
Thu Apr 9 12:38:47 UTC 2020


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;
+        }
+
         for (i = maxvcpus - 1; i >= 0 && curvcpus > nvcpus; i--) {
             vcpu = virDomainDefGetVcpu(def, i);
             vcpupriv =  QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
--
1.8.3.1







More information about the libvir-list mailing list