提交 7dc52526 编写于 作者: M Marcelo Tosatti 提交者: Paolo Bonzini

kvm-all.c: max_cpus should not exceed KVM vcpu limit

maxcpus, which specifies the maximum number of hotpluggable CPUs,
should not exceed KVM's vcpu limit.
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
[Reword message. - Paolo]
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 354678c5
...@@ -1400,6 +1400,13 @@ int kvm_init(void) ...@@ -1400,6 +1400,13 @@ int kvm_init(void)
goto err; goto err;
} }
if (max_cpus > max_vcpus) {
ret = -EINVAL;
fprintf(stderr, "Number of hotpluggable cpus requested (%d) exceeds max cpus "
"supported by KVM (%d)\n", max_cpus, max_vcpus);
goto err;
}
s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0); s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
if (s->vmfd < 0) { if (s->vmfd < 0) {
#ifdef TARGET_S390X #ifdef TARGET_S390X
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册