aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-06-22 14:06:15 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-06-22 14:06:15 -0300
commit35156f763a84ec40327a21a5b99894e3e6e4bd36 (patch)
tree32b79f960e87a81023c84d339ef3bff00ba11066
parentb07485ac391ddbf17df921d78e98dd61d46477be (diff)
downloadkvmx-35156f763a84ec40327a21a5b99894e3e6e4bd36.tar.gz
kvmx-35156f763a84ec40327a21a5b99894e3e6e4bd36.tar.bz2
Check for virtualization flag and kvm group
-rwxr-xr-xkvmx24
1 files changed, 18 insertions, 6 deletions
diff --git a/kvmx b/kvmx
index e639879..1718ac5 100755
--- a/kvmx
+++ b/kvmx
@@ -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
}