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 <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Matt Evans
2015-06-01 16:39:49 +01:00
committed by Will Deacon
parent 341ee0d495
commit 3b9b691d82
+5 -1
View File
@@ -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;
}