[libvirt] [PATCH 4/4] Check the kvm host cpu max limits in virConnectGetDomainCapabilities()

Andrea Bolognani abologna at redhat.com
Thu Jun 23 15:27:34 UTC 2016


On Wed, 2016-06-15 at 09:58 +0000, Shivaprasad G Bhat wrote:
> -    domCaps->maxvcpus = maxvcpus;
> +    domCaps->maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, domCaps-
>machine);
> +    if (virttype == VIR_DOMAIN_VIRT_KVM) {
> +        hostmaxvcpus = virHostCPUGetKVMVCPUs(VIR_HOSTCPU_KVM_MAXVCPUS);
> +        domCaps->suggestedvcpus =
virHostCPUGetKVMVCPUs(VIR_HOSTCPU_KVM_NR_VCPUS);
> +        domCaps->maxvcpus = MIN(domCaps->maxvcpus, hostmaxvcpus);
> +    }

Forgot to mention this yesterday: domCaps->suggestedvcpus
will have to be capped by hostmaxvcpus as well, because
otherwise you would end up with stuff like

  <vcpu max='1' suggested='160'/>

for the 'isapc' or 'xenpv' machine types.


-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list