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

- 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@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

I could not apply this patch into master. Could you rebase and resend? Thanks, Aline Manera On 15/09/2015 14:15, Jose Ricardo Ziviani wrote:
- 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@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)
participants (2)
-
Aline Manera
-
Jose Ricardo Ziviani