]> git.proxmox.com Git - qemu.git/commitdiff
kvm-all.c: max_cpus should not exceed KVM vcpu limit
authorMarcelo Tosatti <mtosatti@redhat.com>
Mon, 12 Aug 2013 19:56:31 +0000 (16:56 -0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 20 Aug 2013 16:38:35 +0000 (18:38 +0200)
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>
kvm-all.c

index ef52a0f9669066017a082939c35d3270c171346a..a2d49786365e3a9d25f8ac91c3d628f5a1f0b1f7 100644 (file)
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -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