From patchwork Fri Dec 9 06:54:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [V2,06/23] kvm tools: Don't die if KVM_CAP_NR_VCPUS isn't available From: Matt Evans X-Patchwork-Id: 130289 Message-Id: <4EE1B089.8060509@ozlabs.org> To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Cc: penberg@kernel.org, asias.hejun@gmail.com, levinsasha928@gmail.com, gorcunov@gmail.com Date: Fri, 09 Dec 2011 17:54:01 +1100 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 --- 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 --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; }