[Kimchi-devel] [PATCH 2/2] Use ppc64_cpu values to retrieve max vcpu value

Jose Ricardo Ziviani joserz at linux.vnet.ibm.com
Tue Sep 15 17:15:51 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 7c0a512..45e0e26 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -36,6 +36,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.tasks import TaskModel
  from kimchi.model.templates import TemplateModel
  from kimchi.model.utils import get_vm_name
@@ -835,7 +836,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