X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fconfigure-deps-functions.sh;h=3c82c66a9a03f69bcd8789c7b6a0165e3c691ac0;hb=605342b46095341c9301456c81e354c73e2197eb;hp=06a4c72cad9d315d0a6c9dd67e9d6777a9c0a9d4;hpb=1895dcd2fa7d6888b5e451b229b213954f923de5;p=apex.git diff --git a/lib/configure-deps-functions.sh b/lib/configure-deps-functions.sh index 06a4c72c..3c82c66a 100755 --- a/lib/configure-deps-functions.sh +++ b/lib/configure-deps-functions.sh @@ -33,13 +33,9 @@ function configure_deps { systemctl status libvirtd || systemctl start libvirtd systemctl status openvswitch || systemctl start openvswitch - # If flat we only use admin network - if [[ "$net_isolation_enabled" == "FALSE" ]]; then - virsh_enabled_networks="admin_network" - enabled_network_list="admin_network" - # For baremetal we only need to create/attach Undercloud to admin and public - elif [ "$virtual" == "FALSE" ]; then - virsh_enabled_networks="admin_network public_network" + # For baremetal we only need to create/attach Undercloud to admin and external + if [ "$virtual" == "FALSE" ]; then + virsh_enabled_networks="admin external" else virsh_enabled_networks=$enabled_network_list fi @@ -54,15 +50,15 @@ function configure_deps { for network in ${enabled_network_list}; do echo "${blue}INFO: Creating Virsh Network: $network & OVS Bridge: ${NET_MAP[$network]}${reset}" ovs-vsctl list-br | grep "^${NET_MAP[$network]}$" > /dev/null || ovs-vsctl add-br ${NET_MAP[$network]} - virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF - + virsh net-list --all | grep " $network " > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF + $network EOF - if ! (virsh net-list --all | grep $network > /dev/null); then + if ! (virsh net-list --all | grep " $network " > /dev/null); then echo "${red}ERROR: unable to create network: ${network}${reset}" exit 1; fi @@ -76,10 +72,10 @@ EOF # bridge interfaces to correct OVS instances for baremetal deployment for network in ${enabled_network_list}; do - if [[ "$network" != "admin_network" && "$network" != "public_network" ]]; then + if [[ "$network" != "admin" && "$network" != "external" ]]; then continue fi - this_interface=$(eval echo \${${network}_bridged_interface}) + this_interface=$(eval echo \${${network}_installer_vm_members}) # check if this a bridged interface for this network if [[ ! -z "$this_interface" || "$this_interface" != "none" ]]; then if ! attach_interface_to_ovs ${NET_MAP[$network]} ${this_interface} ${network}; then @@ -95,11 +91,17 @@ EOF done else for network in ${OPNFV_NETWORK_TYPES}; do + if ! ovs-vsctl --may-exist add-br ${NET_MAP[$network]}; then + echo -e "${red}ERROR: Failed to create ovs bridge ${NET_MAP[$network]}{$reset}" + exit 1 + fi echo "${blue}INFO: Creating Virsh Network: $network${reset}" - virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF + virsh net-list --all | grep " $network " > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF $network + + EOF if ! (virsh net-list --all | grep $network > /dev/null); then @@ -112,7 +114,7 @@ EOF done echo -e "${blue}INFO: Bridges set: ${reset}" - brctl show + ovs-vsctl list-br fi echo -e "${blue}INFO: virsh networks set: ${reset}" @@ -135,6 +137,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