Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preflight check for hardware-assisted virtualization
This is pretty quick and dirty, but I hope should not be unreasonable. https://help.ubuntu.com/community/KVM/Installation tells us that we need to run `egrep -c '(vmx|svm)' /proc/cpuinfo` to check for hardware-assisted virtualization on x86_64 systems, but I think we can short-circuit that. I reviewed the kvm-ok script (https://bazaar.launchpad.net/~cpu-checker-dev/cpu-checker/trunk/view/head:/kvm-ok) and it first checks for those CPU flags, and then next checks for the existence of /dev/kvm. If both succeed, we're good. But I don't think we actually need the CPU flag check, at least on SUSE distros. I did some testing, and AFAICT if the CPU supports hardware virtualization, the appropriate kvm kernel module (e.g. kvm_intel) is loaded automatically, so /dev/kvm will exist. If not, the module doesn't get loaded and /dev/kvm doesn't exist. More recent changes to kvm-ok in Debian-based distros (see https://sources.debian.org/patches/cpu-checker/0.7-1.3/) add support for other architectures (aarch64, ppc*, s390x, riscv64), but in all those cases, the only thing that happens is a check for the existence of /dev/kvm. Signed-off-by: Tim Serong <[email protected]>
- Loading branch information