diff options
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/deploy.sh | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh index ae6366f3..0ee7ac0d 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -26,6 +26,7 @@ ha_enabled="TRUE" ping_site="8.8.8.8" ntp_server="pool.ntp.org" net_isolation_enabled="TRUE" +post_config="TRUE" declare -i CNT declare UNDERCLOUD @@ -391,7 +392,7 @@ function configure_deps { elif [ "$virtual" == "FALSE" ]; then virsh_enabled_networks="admin_network public_network" else - virsh_enabled_neworks=$enabled_network_list + virsh_enabled_networks=$enabled_network_list fi for network in ${OPNFV_NETWORK_TYPES}; do @@ -735,8 +736,13 @@ if [[ "$net_isolation_enabled" == "TRUE" ]]; then openstack-config --set undercloud.conf DEFAULT dhcp_end ${admin_network_dhcp_range##*,} openstack-config --set undercloud.conf DEFAULT inspection_iprange ${admin_network_introspection_range} openstack-config --set undercloud.conf DEFAULT undercloud_debug false + fi +sudo sed -i '/CephClusterFSID:/c\\ CephClusterFSID: \\x27$(cat /proc/sys/kernel/random/uuid)\\x27' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml +sudo sed -i '/CephMonKey:/c\\ CephMonKey: \\x27'"\$(ceph-authtool --gen-print-key)"'\\x27' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml +sudo sed -i '/CephAdminKey:/c\\ CephAdminKey: \\x27'"\$(ceph-authtool --gen-print-key)"'\\x27' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml + openstack undercloud install &> apex-undercloud-install.log sleep 30 sudo systemctl restart openstack-glance-api @@ -766,6 +772,9 @@ function undercloud_prep_overcloud_deploy { exit 1 fi + # make sure ceph is installed + DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" + # check if HA is enabled if [[ "$ha_enabled" == "TRUE" ]]; then DEPLOY_OPTIONS+=" --control-scale 3 --compute-scale 2" @@ -812,11 +821,56 @@ echo "Configuring nameserver on ctlplane network" neutron subnet-update \$(neutron subnet-list | grep -v id | grep -v \\\\-\\\\- | awk {'print \$2'}) --dns-nameserver 8.8.8.8 echo "Executing overcloud deployment, this should run for an extended period without output." sleep 60 #wait for Hypervisor stats to check-in to nova +# save deploy command so it can be used for debugging +cat > deploy_command << EOF +openstack overcloud deploy --templates $DEPLOY_OPTIONS +EOF openstack overcloud deploy --templates $DEPLOY_OPTIONS EOI } +##Post configuration after install +##params: none +function configure_post_install { + local opnfv_attach_networks ovs_ip ip_range net_cidr tmp_ip + opnfv_attach_networks="admin_network public_network" + + echo -e "${blue}INFO: Post Install Configuration Running...${reset}" + + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI +source overcloudrc +set -o errexit +echo "Configuring Neutron external network" +neutron net-create external --router:external=True +neutron subnet-create --name external-net --disable-dhcp external --gateway ${public_network_gateway} --allocation-pool start=${public_network_floating_ip_range%%,*},end=${public_network_floating_ip_range##*,} ${public_network_cidr} +EOI + + echo -e "${blue}INFO: Checking if OVS bridges have IP addresses...${reset}" + for network in ${opnfv_attach_networks}; do + ovs_ip=$(find_ip ${NET_MAP[$network]}) + tmp_ip='' + if [ -n "$ovs_ip" ]; then + echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} has IP address ${ovs_ip}${reset}" + else + echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} missing IP, will configure${reset}" + # use last IP of allocation pool + eval "ip_range=\${${network}_usable_ip_range}" + ovs_ip=${ip_range##*,} + eval "net_cidr=\${${network}_cidr}" + sudo ip addr add ${ovs_ip}/${net_cidr##*/} dev ${NET_MAP[$network]} + tmp_ip=$(find_ip ${NET_MAP[$network]}) + if [ -n "$tmp_ip" ]; then + echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} IP set: ${tmp_ip}${reset}" + continue + else + echo -e "${red}ERROR: Unable to set OVS Bridge ${NET_MAP[$network]} with IP: ${ovs_ip}${reset}" + return 1 + fi + fi + done +} + display_usage() { echo -e "Usage:\n$0 [arguments] \n" echo -e " -c|--config : Directory to configuration files. Optional. Defaults to /var/opt/opnfv/ \n" @@ -827,7 +881,8 @@ display_usage() { echo -e " -r|--resources : Directory to deployment resources. Optional. Defaults to /var/opt/opnfv/stack \n" echo -e " -v|--virtual : Virtualize overcloud nodes instead of using baremetal. \n" echo -e " --no-ha : disable High Availability deployment scheme, this assumes a single controller and single compute node \n" - echo -e " --flat : disable Network Isolation and use a single flat network for the underlay network." + echo -e " --flat : disable Network Isolation and use a single flat network for the underlay network.\n" + echo -e " --no-post-config : disable Post Install configuration." } ##translates the command line parameters into variables @@ -889,6 +944,11 @@ parse_cmdline() { echo "Underlay Network Isolation Disabled: using flat configuration" shift 1 ;; + --no-post-config ) + post_config="FALSE" + echo "Post install configuration disabled" + shift 1 + ;; *) display_usage exit 1 @@ -951,6 +1011,14 @@ main() { fi configure_undercloud undercloud_prep_overcloud_deploy + if [ "$post_config" == "TRUE" ]; then + if ! configure_post_install; then + echo -e "${red}ERROR:Post Install Configuration Failed, Exiting.${reset}" + exit 1 + else + echo -e "${blue}INFO: Post Install Configuration Complete${reset}" + fi + fi } main "$@" |