diff mbox

[V2,06/23] kvm tools: Don't die if KVM_CAP_NR_VCPUS isn't available

Message ID 4EE1B089.8060509@ozlabs.org
State New, archived
Headers show

Commit Message

Matt Evans Dec. 9, 2011, 6:54 a.m. UTC
We die() if we can't read KVM_CAP_NR_VCPUS, but the API docs suggest to assume
the value 4 in this case.  This is pertinent to PPC KVM, which currently
does not support this CAP.

Signed-off-by: Matt Evans <matt@ozlabs.org>
---
 tools/kvm/kvm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index 0356d74..0bbe9ba 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -266,7 +266,11 @@  int kvm__recommended_cpus(struct kvm *kvm)
 
 	ret = ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS);
 	if (ret <= 0)
-		die_perror("KVM_CAP_NR_VCPUS");
+		/*
+		 * api.txt states that if KVM_CAP_NR_VCPUS does not exist,
+		 * assume 4.
+		 */
+		return 4;
 
 	return ret;
 }