2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
14 # usage() - Prints the usage of the program
17 usage: $0 [-v volumes]
19 -v List of key pair values for volumes and mount points ( e. g. sda=/var/lib/docker/,sdb=/var/lib/libvirt/ )
23 # mount_external_partition() - Create partition and mount the external volume
24 function mount_external_partition {
25 local dev_name="/dev/$1"
28 sfdisk $dev_name --no-reread << EOF
31 mkfs -t ext4 ${dev_name}1
33 mount ${dev_name}1 $mount_dir
34 echo "${dev_name}1 $mount_dir ext4 errors=remount-ro,noatime,barrier=0 0 1" >> /etc/fstab
37 while getopts "h?v:" opt; do
40 dict_volumes="$OPTARG"
50 if [[ -n "${dict_volumes+x}" ]]; then
51 for kv in ${dict_volumes//,/ } ;do
52 mount_external_partition ${kv%=*} ${kv#*=}
56 vendor_id=$(lscpu|grep "Vendor ID")
57 if [[ $vendor_id == *GenuineIntel* ]]; then
58 kvm_ok=$(cat /sys/module/kvm_intel/parameters/nested)
59 if [[ $kvm_ok == 'N' ]]; then
60 echo "Enable Intel Nested-Virtualization"
62 echo 'options kvm-intel nested=y' >> /etc/modprobe.d/dist.conf
64 echo kvm-intel >> /etc/modules
67 kvm_ok=$(cat /sys/module/kvm_amd/parameters/nested)
68 if [[ $kvm_ok == '0' ]]; then
69 echo "Enable AMD Nested-Virtualization"
71 sh -c "echo 'options kvm-amd nested=1' >> /etc/modprobe.d/dist.conf"
73 echo kvm-amd >> /etc/modules
77 echo vhost_net >> /etc/modules
78 source /etc/os-release || source /usr/lib/os-release
83 apt-get install -y cpu-checker