From fbbdbb9f62c7239d8e299b17be82e5ac3b5eca09 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Tue, 20 Aug 2013 21:45:54 +0200 Subject: [PATCH 26/28] kvm-all.c: max_cpus should not exceed KVM vcpu limit RH-Author: Marcelo Tosatti Message-id: <20130820214554.GB9334@amt.cnet> Patchwork-id: 53621 O-Subject: [RHEL7 qemu-kvm PATCH] kvm-all.c: max_cpus should not exceed KVM vcpu limit Bugzilla: 996258 RH-Acked-by: Andrew Jones RH-Acked-by: Paolo Bonzini RH-Acked-by: Eduardo Habkost commit 7dc52526850849e8e0fe56ced809d0798481a2f6 of uq/master branch of qemu-kvm.git repository maxcpus, which specifies the maximum number of hotpluggable CPUs, should not exceed KVM's vcpu limit. Signed-off-by: Marcelo Tosatti [Reword message. - Paolo] Signed-off-by: Paolo Bonzini BZ: 996258 Signed-off-by: Miroslav Rezanina --- kvm-all.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 6c9d51e..545b470 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1358,6 +1358,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 -- 1.7.1