Blame SOURCES/kvm-all.c-max_cpus-should-not-exceed-KVM-vcpu-limit.patch

218e99
From fbbdbb9f62c7239d8e299b17be82e5ac3b5eca09 Mon Sep 17 00:00:00 2001
218e99
From: Marcelo Tosatti <mtosatti@redhat.com>
218e99
Date: Tue, 20 Aug 2013 21:45:54 +0200
218e99
Subject: [PATCH 26/28] kvm-all.c: max_cpus should not exceed KVM vcpu limit
218e99
218e99
RH-Author: Marcelo Tosatti <mtosatti@redhat.com>
218e99
Message-id: <20130820214554.GB9334@amt.cnet>
218e99
Patchwork-id: 53621
218e99
O-Subject: [RHEL7 qemu-kvm PATCH] kvm-all.c: max_cpus should not exceed KVM vcpu limit
218e99
Bugzilla: 996258
218e99
RH-Acked-by: Andrew Jones <drjones@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
218e99
218e99
commit 7dc52526850849e8e0fe56ced809d0798481a2f6 of uq/master branch
218e99
of qemu-kvm.git repository
218e99
218e99
maxcpus, which specifies the maximum number of hotpluggable CPUs,
218e99
should not exceed KVM's vcpu limit.
218e99
218e99
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
218e99
[Reword message. - Paolo]
218e99
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
BZ: 996258
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 kvm-all.c |    7 +++++++
218e99
 1 files changed, 7 insertions(+), 0 deletions(-)
218e99
218e99
diff --git a/kvm-all.c b/kvm-all.c
218e99
index 6c9d51e..545b470 100644
218e99
--- a/kvm-all.c
218e99
+++ b/kvm-all.c
218e99
@@ -1358,6 +1358,13 @@ int kvm_init(void)
218e99
         goto err;
218e99
     }
218e99
 
218e99
+    if (max_cpus > max_vcpus) {
218e99
+        ret = -EINVAL;
218e99
+        fprintf(stderr, "Number of hotpluggable cpus requested (%d) exceeds max cpus "
218e99
+                "supported by KVM (%d)\n", max_cpus, max_vcpus);
218e99
+        goto err;
218e99
+    }
218e99
+
218e99
     s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
218e99
     if (s->vmfd < 0) {
218e99
 #ifdef TARGET_S390X
218e99
-- 
218e99
1.7.1
218e99