summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-10-03 11:02:51 -0700
committerVictor Morales <victor.morales@intel.com>2018-10-04 15:37:12 +0000
commit471a20c23e836f667224152b3ac45f648e213525 (patch)
tree52d05be1540cbb468572ec90342971fff76729fa
parent373ab2024543a1d3c0d025715e80c3755995d6b5 (diff)
Improve Nested-Virtualization enablement
The I61d13ebbdbc0abc208042dde56d4d6b498570955 enables Intel Nested-Virtualization on Kubernetes Nodes without considering the current status and/or architecture. This change consider those values during the enablement process. Change-Id: I3544e73a61ce98c159b4496f0fba35f9795ba89a Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
-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