Test 1: VT Enabled in BIOS(On a machine that supports VT):
$ kvm-ok
INFO: Your CPU supports KVM extensions
INFO: /dev/kvm exists
KVM acceleration can be used
Test 2a: (run this on a system that does not support VT)
joe@jts-ubuntu:/etc/apt$ kvm-ok
INFO: Your CPU does not support KVM extensions
INFO: /dev/kvm does not exist
HINT: sudo modprobe kvm
KVM acceleration can NOT be used
Test 2b: (sudo modprobe -r kvm, and then re-run kvm-ok and see that /dev/kvm is gone)
Note: I had to remove the kvm_intel module on my system before I could remove kvm.
$ kvm-ok
INFO: Your CPU supports KVM extensions
INFO: /dev/kvm does not exist
HINT: sudo modprobe kvm
KVM acceleration can NOT be used
Test 2c: (reboot into BIOS, disable VT, and re-run kvm-ok)
$ kvm-ok
INFO: Your CPU supports KVM extensions
INFO: /dev/kvm does not exist
HINT: sudo modprobe kvm
INFO: KVM is disable by your BIOS
HINT: Enter your BIOS setup and enable Virtualization Technology (VT)
KVM acceleration can NOT be used
All of the tests worked as expected. Only two minor things that could be changed:
1. The text when VT Extensions are disabled in the bios could be updated to say "KVM is disabled" instead of "KVM is disable".
2. Maybe not print the text "HINT: sudo modprobe kvm in the cases" in the cases when it would not work anyway, such as in test 2a and 2c.
Here are the results from my testing:
Test 1: VT Enabled in BIOS(On a machine that supports VT):
$ kvm-ok
INFO: Your CPU supports KVM extensions
INFO: /dev/kvm exists
KVM acceleration can be used
Test 2a: (run this on a system that does not support VT)
joe@jts- ubuntu: /etc/apt$ kvm-ok
INFO: Your CPU does not support KVM extensions
INFO: /dev/kvm does not exist
HINT: sudo modprobe kvm
KVM acceleration can NOT be used
Test 2b: (sudo modprobe -r kvm, and then re-run kvm-ok and see that /dev/kvm is gone)
Note: I had to remove the kvm_intel module on my system before I could remove kvm.
$ kvm-ok
INFO: Your CPU supports KVM extensions
INFO: /dev/kvm does not exist
HINT: sudo modprobe kvm
KVM acceleration can NOT be used
Test 2c: (reboot into BIOS, disable VT, and re-run kvm-ok)
$ kvm-ok
INFO: Your CPU supports KVM extensions
INFO: /dev/kvm does not exist
HINT: sudo modprobe kvm
INFO: KVM is disable by your BIOS
HINT: Enter your BIOS setup and enable Virtualization Technology (VT)
KVM acceleration can NOT be used
All of the tests worked as expected. Only two minor things that could be changed:
1. The text when VT Extensions are disabled in the bios could be updated to say "KVM is disabled" instead of "KVM is disable".
2. Maybe not print the text "HINT: sudo modprobe kvm in the cases" in the cases when it would not work anyway, such as in test 2a and 2c.