yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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