diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-06-22 14:06:15 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-06-22 14:06:15 -0300 |
commit | 35156f763a84ec40327a21a5b99894e3e6e4bd36 (patch) | |
tree | 32b79f960e87a81023c84d339ef3bff00ba11066 | |
parent | b07485ac391ddbf17df921d78e98dd61d46477be (diff) | |
download | kvmx-35156f763a84ec40327a21a5b99894e3e6e4bd36.tar.gz kvmx-35156f763a84ec40327a21a5b99894e3e6e4bd36.tar.bz2 |
Check for virtualization flag and kvm group
-rwxr-xr-x | kvmx | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -200,12 +200,24 @@ function __kvmx_initialize { mkdir -p $STATE_DIR $LOG_DIR - if [ ! -e "$image" ] && [ "$ACTION" != "up" ] && [ "$ACTION" != "provision" ] && [ "$ACTION" != "purge" ] \ - && [ "$ACTION" != "destroy" ] && [ "$ACTION" != "install" ] && [ "$ACTION" != "config" ] \ - && [ "$ACTION" != "config_unset" ] && [ "$ACTION" != "create" ] && [ "$ACTION" != "shell" ] \ - && [ "$ACTION" != "boot" ]; then - echo "$BASENAME: file not found: $image" - exit 1 + # Additional checks + if [ "$ACTION" != "up" ] && [ "$ACTION" != "provision" ] && [ "$ACTION" != "purge" ] && \ + [ "$ACTION" != "destroy" ] && [ "$ACTION" != "install" ] && [ "$ACTION" != "config" ] && \ + [ "$ACTION" != "config_unset" ] && [ "$ACTION" != "create" ] && [ "$ACTION" != "shell" ] && \ + [ "$ACTION" != "boot" ]; then + if [ ! -e "$image" ]; then + echo "$BASENAME: file not found: $image" + exit 1 + fi + + # See http://www.linux-kvm.org/page/FAQ + if ! egrep -q '^flags.*(vmx|svm)' /proc/cpuinfo; then + echo "$BASENAME: WARNING: Intel VT or AMD-V not present at /proc/cpuinfo, expect slow performance" + fi + + if ! groups `whoami` | grep -q 'kvm'; then + echo "$BASENAME: WARNING: user `whoami` not in kvm group, expect slow performance" + fi fi fi } |