summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xvagrant/node.sh34
1 files changed, 30 insertions, 4 deletions
diff --git a/vagrant/node.sh b/vagrant/node.sh
index 5edc3a3c..3bf704b1 100755
--- a/vagrant/node.sh
+++ b/vagrant/node.sh
@@ -53,7 +53,33 @@ if [[ -n "${dict_volumes+x}" ]]; then
mount_external_partition ${kv%=*} ${kv#*=}
done
fi
-rmmod kvm-intel
-echo 'options kvm-intel nested=y' >> /etc/modprobe.d/dist.conf
-modprobe kvm-intel
-grep -q -i ^Y$ /sys/module/kvm_intel/parameters/nested || { echo "Nested virtualization is not enabled"; exit 1; }
+
+vendor_id=$(lscpu|grep "Vendor ID")
+if [[ $vendor_id == *GenuineIntel* ]]; then
+ kvm_ok=$(cat /sys/module/kvm_intel/parameters/nested)
+ if [[ $kvm_ok == 'N' ]]; then
+ echo "Enable Intel Nested-Virtualization"
+ rmmod kvm-intel
+ echo 'options kvm-intel nested=y' >> /etc/modprobe.d/dist.conf
+ modprobe kvm-intel
+ fi
+else
+ kvm_ok=$(cat /sys/module/kvm_amd/parameters/nested)
+ if [[ $kvm_ok == '0' ]]; then
+ echo "Enable AMD Nested-Virtualization"
+ rmmod kvm-amd
+ sh -c "echo 'options kvm-amd nested=1' >> /etc/modprobe.d/dist.conf"
+ modprobe kvm-amd
+ fi
+fi
+source /etc/os-release || source /usr/lib/os-release
+case ${ID,,} in
+ *suse)
+ ;;
+ ubuntu|debian)
+ apt-get install -y cpu-checker
+ kvm-ok
+ ;;
+ rhel|centos|fedora)
+ ;;
+esac