mirror of https://gitee.com/openkylin/libvirt.git
qemu_driver: Try KVM_CAP_MAX_VCPUS only if defined
With our recent patch (1715c83b5f
) we thrive to get the correct
number of maximal VCPUs. However, we are using a constant from
linux/kvm.h which may be not defined in every distro. Hence, we
should guard usage of the constant with ifdef preprocessor
directive. This was introduced in kernel:
commit 8c3ba334f8588e1d5099f8602cf01897720e0eca
Author: Sasha Levin <levinsasha928@gmail.com>
Date: Mon Jul 18 17:17:15 2011 +0300
KVM: x86: Raise the hard VCPU count limit
The patch raises the hard limit of VCPU count to 254.
This will allow developers to easily work on scalability
and will allow users to test high VCPU setups easily without
patching the kernel.
To prevent possible issues with current setups, KVM_CAP_NR_VCPUS
now returns the recommended VCPU limit (which is still 64) - this
should be a safe value for everybody, while a new KVM_CAP_MAX_VCPUS
returns the hard limit which is now 254.
$ git desc 8c3ba334f
v3.1-rc7-48-g8c3ba33
This commit is contained in:
parent
27cf98e2d1
commit
3b94239ffb
|
@ -1122,9 +1122,11 @@ kvmGetMaxVCPUs(void) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef KVM_CAP_MAX_VCPUS
|
||||
/* at first try KVM_CAP_MAX_VCPUS to determine the maximum count */
|
||||
if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS)) > 0)
|
||||
goto cleanup;
|
||||
#endif /* KVM_CAP_MAX_VCPUS */
|
||||
|
||||
/* as a fallback get KVM_CAP_NR_VCPUS (the recommended maximum number of
|
||||
* vcpus). Note that on most machines this is set to 160. */
|
||||
|
|
Loading…
Reference in New Issue