From 3b9b691d82297cd91ace28fc5d5a72304e2416e6 Mon Sep 17 00:00:00 2001 From: Matt Evans Date: Fri, 9 Dec 2011 17:54:01 +1100 Subject: [PATCH] kvm tools: Don't die if KVM_CAP_NR_VCPUS isn't available 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 Signed-off-by: Pekka Enberg --- kvm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kvm.c b/kvm.c index 0356d74..0bbe9ba 100644 --- a/kvm.c +++ b/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; }