summaryrefslogtreecommitdiffstats
path: root/vagrant/setup.sh
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-10-15 10:10:54 -0700
committerVictor Morales <victor.morales@intel.com>2018-10-15 10:10:54 -0700
commit1e2311043ead1e07b3f22d4704959faa08edfb87 (patch)
tree0823b85be39b75237ce2ade8cef07bffbbc342b8 /vagrant/setup.sh
parentafe7621e5e9289464e9e9e48eef231179ba23d69 (diff)
Improve setup.sh script
The setup.sh script contains instructions to configure and install dependencies for this project. This change includes instructions to enable nested-virtualization. Change-Id: I35b66d08f0e3813d18e661f73edc04fd2cf585fe Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-301
Diffstat (limited to 'vagrant/setup.sh')
-rwxr-xr-xvagrant/setup.sh24
1 files changed, 23 insertions, 1 deletions
diff --git a/vagrant/setup.sh b/vagrant/setup.sh
index 85900fda..2dfae83b 100755
--- a/vagrant/setup.sh
+++ b/vagrant/setup.sh
@@ -114,7 +114,7 @@ case ${ID,,} in
;;
libvirt)
# vagrant-libvirt dependencies
- packages+=(qemu libvirt-bin ebtables dnsmasq libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev)
+ packages+=(qemu libvirt-bin ebtables dnsmasq libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev cpu-checker)
# NFS
packages+=(nfs-kernel-server)
;;
@@ -153,6 +153,27 @@ case ${ID,,} in
esac
+# Enable Nested-Virtualization
+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
+modprobe vhost_net
+
${INSTALLER_CMD} ${packages[@]}
if ! which pip; then
curl -sL https://bootstrap.pypa.io/get-pip.py | sudo python
@@ -166,4 +187,5 @@ if [ $VAGRANT_DEFAULT_PROVIDER == libvirt ]; then
vagrant plugin install vagrant-libvirt
sudo usermod -a -G $libvirt_group $USER # This might require to reload user's group assigments
sudo systemctl restart libvirtd
+ kvm-ok
fi