summaryrefslogtreecommitdiffstats
path: root/lib/configure-deps-functions.sh
diff options
context:
space:
mode:
authorFeng Pan <fpan@redhat.com>2016-08-03 09:40:04 -0400
committerFeng Pan <fpan@redhat.com>2016-08-03 09:40:04 -0400
commitc6884bd8035e8d605ed6e3f702d009491b6712de (patch)
treed8aee03dec1697f085c5c8258211693dbb36f494 /lib/configure-deps-functions.sh
parentb6f3736872b6c06a345da2f16e82d8688c469dd7 (diff)
Enable nested kvm for virtual deployment
For virtual deployment, we will attempt to enable nested kvm, if that is not possible, qemu will be used instead. Only support Intel for now. Change-Id: I951835c3e3faedfc698a4c879366d6c96249e5c1 Signed-off-by: Feng Pan <fpan@redhat.com>
Diffstat (limited to 'lib/configure-deps-functions.sh')
-rwxr-xr-xlib/configure-deps-functions.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/configure-deps-functions.sh b/lib/configure-deps-functions.sh
index 06a4c72c..2c5411e3 100755
--- a/lib/configure-deps-functions.sh
+++ b/lib/configure-deps-functions.sh
@@ -135,6 +135,25 @@ Are you sure you have enabled vmx in your bios or hypervisor?${reset}"
return 1
fi
+ # try to enabled nested kvm
+ if [ "$virtual" == "TRUE" ]; then
+ nested_kvm=`cat /sys/module/kvm_intel/parameters/nested`
+ if [ "$nested_kvm" != "Y" ]; then
+ # try to enable nested kvm
+ echo 'options kvm-intel nested=1' > /etc/modprobe.d/kvm_intel.conf
+ if rmmod kvm_intel; then
+ modprobe kvm_intel
+ fi
+ nested_kvm=`cat /sys/module/kvm_intel/parameters/nested`
+ fi
+ if [ "$nested_kvm" != "Y" ]; then
+ echo "${red}Cannot enable nested kvm, falling back to qemu for deployment${reset}"
+ DEPLOY_OPTIONS+=" --libvirt-type qemu"
+ else
+ echo "${blue}Nested kvm enabled, deploying with kvm acceleration${reset}"
+ fi
+ fi
+
##sshkeygen for root
if [ ! -e ~/.ssh/id_rsa.pub ]; then
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa