[Kimchi-devel] [PATCH 3/4] Set max VCPU count to the max supported value

Crístian Deives cristiandeives at gmail.com
Mon Jun 29 17:21:23 UTC 2015


When updating the CPU count of a VM, its maximum CPU count is also
updated to the same value. This wouldn't allow for CPU hotplug
afterwards.

Update the maximum CPU count to the maximum value supported by libvirt
when the user updates the VM CPU count.

Signed-off-by: Crístian Deives <cristiandeives at gmail.com>
---
 src/kimchi/model/vms.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index c9ed5f6..374a5da 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -797,7 +797,8 @@ class VMModel(object):
 
             try:
                 # set maximum VCPU count
-                dom.setVcpusFlags(cpus, libvirt.VIR_DOMAIN_AFFECT_CONFIG |
+                max_vcpus = self.conn.get().getMaxVcpus('kvm')
+                dom.setVcpusFlags(max_vcpus, libvirt.VIR_DOMAIN_AFFECT_CONFIG |
                                   libvirt.VIR_DOMAIN_VCPU_MAXIMUM)
 
                 # set current VCPU count
-- 
2.4.3




More information about the Kimchi-devel mailing list