diff options
-rw-r--r-- | build/opnfv-apex-undercloud.spec | 8 | ||||
-rw-r--r-- | ci/PR_revision.log | 2 | ||||
-rwxr-xr-x | ci/clean.sh | 8 | ||||
-rwxr-xr-x | ci/deploy.sh | 63 | ||||
-rwxr-xr-x | ci/dev_deploy_check.sh | 37 | ||||
-rw-r--r-- | lib/common-functions.sh | 2 | ||||
-rw-r--r-- | lib/python/apex/deploy_env.py | 2 |
7 files changed, 90 insertions, 32 deletions
diff --git a/build/opnfv-apex-undercloud.spec b/build/opnfv-apex-undercloud.spec index 0e4798b3..55e152ff 100644 --- a/build/opnfv-apex-undercloud.spec +++ b/build/opnfv-apex-undercloud.spec @@ -25,17 +25,13 @@ mkdir -p %{buildroot}%{_var}/opt/opnfv/nics/ install build/undercloud.qcow2 %{buildroot}%{_var}/opt/opnfv/images/ install build/network-environment.yaml %{buildroot}%{_var}/opt/opnfv/ -install build/nics-controller.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-controller.yaml.template -install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-compute.yaml.template -install build/nics-controller.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-controller.yaml.jinja2 -install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-compute.yaml.jinja2 +install build/nics-controller.yaml.jinja2 %{buildroot}%{_var}/opt/opnfv/ +install build/nics-compute.yaml.jinja2 %{buildroot}%{_var}/opt/opnfv/ %files %defattr(644, root, root, -) %{_var}/opt/opnfv/images/undercloud.qcow2 %{_var}/opt/opnfv/network-environment.yaml -%{_var}/opt/opnfv/nics-controller.yaml.template -%{_var}/opt/opnfv/nics-compute.yaml.template %{_var}/opt/opnfv/nics-controller.yaml.jinja2 %{_var}/opt/opnfv/nics-compute.yaml.jinja2 diff --git a/ci/PR_revision.log b/ci/PR_revision.log index edd42986..122063e4 100644 --- a/ci/PR_revision.log +++ b/ci/PR_revision.log @@ -2,4 +2,4 @@ #Note this is only needed for triggering commits with no code change in #Apex, but changes do occur in opnfv-tht #PR number, PR Title -14,Adds ODL DLUX GUI to L2/L3 deployments +15,Add sleep to galera and mongodb service start diff --git a/ci/clean.sh b/ci/clean.sh index 08c0d53f..e5b2f91c 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -22,6 +22,7 @@ source $LIB/common-functions.sh vm_index=4 ovs_bridges="br-admin br-private br-public br-storage" +OPNFV_NETWORK_TYPES="admin_network private_network public_network storage_network" # Clean off instack/undercloud VM for vm in instack undercloud; do @@ -41,10 +42,13 @@ for i in $(seq 0 $vm_index); do rm -f /var/lib/libvirt/images/baremetal${i}.qcow2 2> /dev/null done +for network in ${OPNFV_NETWORK_TYPES}; do + virsh net-destroy ${network} 2> /dev/null + virsh net-undefine ${network} 2> /dev/null +done + # Clean off created bridges for bridge in ${ovs_bridges}; do - virsh net-destroy ${bridge} 2> /dev/null | xargs echo -n - virsh net-undefine ${bridge} 2> /dev/null | xargs echo -n if detach_interface_from_ovs ${bridge} 2> /dev/null; then ovs-vsctl del-br ${bridge} 2> /dev/null fi diff --git a/ci/deploy.sh b/ci/deploy.sh index 1bbe5147..639fd0f6 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -165,7 +165,7 @@ parse_inventory_file() { node_total=$node_count - if [[ "$node_total" -lt 5 && ( ha_enabled == "TRUE" || "$ha_enabled" == "true" ) ]]; then + if [[ "$node_total" -lt 5 && "$ha_enabled" == "True" ]]; then echo -e "${red}ERROR: You must provide at least 5 nodes for HA baremetal deployment${reset}" exit 1 elif [[ "$node_total" -lt 2 ]]; then @@ -281,10 +281,11 @@ function configure_deps { virsh net-list --all | grep -E "default\s+active" > /dev/null || virsh net-start default virsh net-list --all | grep -E "default\s+active\s+yes" > /dev/null || virsh net-autostart --network default - for network in ${OPNFV_NETWORK_TYPES}; 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 + if [[ -z "$virtual" || "$virtual" == "FALSE" ]]; then + for network in ${OPNFV_NETWORK_TYPES}; 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 <network> <name>$network</name> <forward mode='bridge'/> @@ -292,21 +293,18 @@ function configure_deps { <virtualport type='openvswitch'/> </network> EOF - if ! (virsh net-list --all | grep $network > /dev/null); then - echo "${red}ERROR: unable to create network: ${network}${reset}" - exit 1; - fi - rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null; - virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network - virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network - done + if ! (virsh net-list --all | grep $network > /dev/null); then + echo "${red}ERROR: unable to create network: ${network}${reset}" + exit 1; + fi + rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null; + virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network + virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network + done - echo -e "${blue}INFO: Bridges set: ${reset}" - ovs-vsctl list-br - echo -e "${blue}INFO: virsh networks set: ${reset}" - virsh net-list + echo -e "${blue}INFO: Bridges set: ${reset}" + ovs-vsctl list-br - if [[ -z "$virtual" || "$virtual" == "FALSE" ]]; then # bridge interfaces to correct OVS instances for baremetal deployment for network in ${enabled_network_list}; do if [[ "$network" != "admin_network" && "$network" != "public_network" ]]; then @@ -326,8 +324,31 @@ EOF exit 1 fi done + else + for network in ${OPNFV_NETWORK_TYPES}; do + 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 +<network ipv6='yes'> +<name>$network</name> +<bridge name='${NET_MAP[$network]}'/> +</network> +EOF + if ! (virsh net-list --all | grep $network > /dev/null); then + echo "${red}ERROR: unable to create network: ${network}${reset}" + exit 1; + fi + rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null; + virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network + virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network + done + + echo -e "${blue}INFO: Bridges set: ${reset}" + brctl show fi + echo -e "${blue}INFO: virsh networks set: ${reset}" + virsh net-list + # ensure storage pool exists and is started virsh pool-list --all | grep default > /dev/null || virsh pool-define-as --name default dir --target /var/lib/libvirt/images virsh pool-list | grep -Eo "default\s+active" > /dev/null || (virsh pool-autostart default; virsh pool-start default) @@ -821,7 +842,7 @@ function undercloud_prep_overcloud_deploy { total_nodes=$(ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/instackenv.json | grep -c memory") # check if HA is enabled - if [[ "$ha_enabled" == "TRUE" || "$ha_enabled" == "true" ]]; then + if [[ "$ha_enabled" == "True" ]]; then DEPLOY_OPTIONS+=" --control-scale 3" compute_nodes=$((total_nodes - 3)) DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml" @@ -842,7 +863,7 @@ function undercloud_prep_overcloud_deploy { DEPLOY_OPTIONS+=" -e network-environment.yaml" fi - if [[ "$ha_enabled" == "TRUE" || "$ha_enabled" == "true" ]] || [[ "$net_isolation_enabled" == "TRUE" ]]; then + if [[ "$ha_enabled" == "True" ]] || [[ "$net_isolation_enabled" == "TRUE" ]]; then DEPLOY_OPTIONS+=" --ntp-server $ntp_server" fi @@ -1082,7 +1103,7 @@ parse_cmdline() { shift 1 ;; --no-ha ) - ha_enabled="FALSE" + ha_enabled="False" vm_index=1 echo "HA Deployment Disabled" shift 1 diff --git a/ci/dev_deploy_check.sh b/ci/dev_deploy_check.sh new file mode 100755 index 00000000..e93e9f4f --- /dev/null +++ b/ci/dev_deploy_check.sh @@ -0,0 +1,37 @@ +#!/bin/sh +############################################################################## +# Copyright (c) 2016 Dan Radez (Red Hat) and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# This script makes sure deploy deps are installed when not relying on RPM + +set -e + +rdo_action="update" + +# check for rdo-release +if ! rpm -q rdo-release > /dev/null; then + rdo_action="install" +fi + +# make sure rdo release +if ! sudo yum $rdo_action -y https://www.rdoproject.org/repos/rdo-release.rpm; then + echo "Failed to $rdo_action RDO Release package..." + exit 1 +fi + +# check for other packages +for i in epel-release python34-PyYAML openvswitch openstack-tripleo libguestfs libguestfs-tools-c libvirt-python; do +# Make sure deploy deps are installed + if ! rpm -q $i > /dev/null; then + if ! sudo yum install -y $i; then + echo "Failed to install $i package..." + exit 1 + fi + fi +done diff --git a/lib/common-functions.sh b/lib/common-functions.sh index 069b3349..6b259ac1 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -154,7 +154,7 @@ function detach_interface_from_ovs { if_dns2=$(sed -n 's/^DNS2=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge}) if [ -z "$if_mask" ]; then - if_prefix=$(sed -n 's/^PREFIX=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge}) + if_prefix=$(sed -n 's/^PREFIX=[^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1/p' ${net_path}/ifcfg-${bridge}) if_mask=$(prefix2mask ${if_prefix}) fi diff --git a/lib/python/apex/deploy_env.py b/lib/python/apex/deploy_env.py index 5c733248..be8779a9 100644 --- a/lib/python/apex/deploy_env.py +++ b/lib/python/apex/deploy_env.py @@ -129,7 +129,7 @@ class DeploySettings: """ bash_str = '' for key, value in self.deploy_settings['global_params'].items(): - bash_str += "if [ -z \"$(eval echo \$${})\" ]; then\n{}={}\nfi\n".format(key,key, value) + bash_str += "{}={}\n".format(key, value) if 'performance' in self.deploy_settings['deploy_options']: bash_str += self._dump_performance() bash_str += self._dump_deploy_options_array() |