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: Marcelo Tosatti <mtosatti@redhat.com>
[Reword message. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Marcelo Tosatti 2013-08-12 16:56:31 -03:00 committed by Paolo Bonzini
parent 354678c5ce
commit 7dc5252685
1 changed files with 7 additions and 0 deletions

View File

@ -1400,6 +1400,13 @@ int kvm_init(void)
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);
if (s->vmfd < 0) {
#ifdef TARGET_S390X