[Kimchi-devel] [PATCH v2 2/2] Do not use libvirt to retrieve max vcpu value

Jose Ricardo Ziviani joserz at linux.vnet.ibm.com
Wed Sep 16 19:02:19 UTC 2015


 - libvirt is not returning a right number for the maximum vcpus
   possible in PowerKVM. If such value is used, the VM refuses to boot
   complaining the value is greater than the machine type limit. However
   the limit can be retrieved from ppc64_cpu, which is the number of
   cores available * the number of threads per core.

Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
 src/kimchi/model/vms.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 871f51e..fe1bfe5 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -38,6 +38,7 @@ from kimchi.exception import InvalidOperation, InvalidParameter
 from kimchi.exception import NotFoundError, OperationFailed
 from kimchi.kvmusertests import UserTests
 from kimchi.model.config import CapabilitiesModel
+from kimchi.model.cpuinfo import CPUInfoModel
 from kimchi.model.featuretests import FeatureTests
 from kimchi.model.tasks import TaskModel
 from kimchi.model.templates import TemplateModel
@@ -860,7 +861,9 @@ class VMModel(object):
 
                 try:
                     # set maximum VCPU count
-                    max_vcpus = self.conn.get().getMaxVcpus('kvm')
+                    cpu_model = CPUInfoModel(conn=self.conn)
+                    max_vcpus = cpu_model.cores_available *\
+                        cpu_model.threads_per_core
                     dom.setVcpusFlags(max_vcpus,
                                       libvirt.VIR_DOMAIN_AFFECT_CONFIG |
                                       libvirt.VIR_DOMAIN_VCPU_MAXIMUM)
-- 
1.9.1




More information about the Kimchi-devel mailing list