diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common-functions.sh | 23 | ||||
-rwxr-xr-x | lib/overcloud-deploy-functions.sh | 12 | ||||
-rwxr-xr-x | lib/post-install-functions.sh | 31 | ||||
-rw-r--r-- | lib/python/apex/network_settings.py | 4 | ||||
-rwxr-xr-x | lib/virtual-setup-functions.sh | 18 |
5 files changed, 71 insertions, 17 deletions
diff --git a/lib/common-functions.sh b/lib/common-functions.sh index 2ace9970..6941093c 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -21,13 +21,19 @@ function prefix2mask { } ##find ip of interface -##params: interface name +##params: interface name, address family function find_ip { + local af if [[ -z "$1" ]]; then return 1 fi + if [[ -z "$2" ]]; then + af=4 + else + af=$2 + fi - python3.4 -B $LIB/python/apex_python_utils.py find-ip -i $1 + python3.4 -B $LIB/python/apex_python_utils.py find-ip -i $1 -af $af } ##attach interface to OVS and set the network config correctly @@ -287,3 +293,16 @@ function verify_internet { return 1 fi } + +##tests if overcloud nodes have external connectivity +#params:none +function test_overcloud_connectivity { + for node in $(undercloud_connect stack ". stackrc && nova list" | grep -Eo "controller-[0-9]+|compute-[0-9]+" | tr -d -) ; do + if ! overcloud_connect $node "ping -c 2 $ping_site > /dev/null"; then + echo "${blue}Node ${node} was unable to ping site ${ping_site}${reset}" + return 1 + fi + done + echo "${blue}Overcloud external connectivity OK${reset}" +} + diff --git a/lib/overcloud-deploy-functions.sh b/lib/overcloud-deploy-functions.sh index 5b0e1aca..e613dae0 100755 --- a/lib/overcloud-deploy-functions.sh +++ b/lib/overcloud-deploy-functions.sh @@ -212,10 +212,18 @@ if [ "$debug" == 'TRUE' ]; then LIBGUESTFS_BACKEND=direct virt-customize -a overcloud-full.qcow2 --root-password password:opnfvapex fi -if [ "${deploy_options_array['tacker']}" == 'True' ]; then - sed -i '/EnableTacker/\\c EnableTacker: true' opnfv-environment.yaml +if [ "${deploy_options_array['tacker']}" == 'False' ]; then + sed -i '/EnableTacker:/c\ EnableTacker: false' opnfv-environment.yaml fi +# Create a key for use by nova for live migration +echo "Creating nova SSH key for nova resize support" +ssh-keygen -f nova_id_rsa -b 1024 -P "" +public_key=\'\$(cat nova_id_rsa.pub | cut -d ' ' -f 2)\' +sed -i "s#replace_public_key:#key: \$public_key#g" opnfv-environment.yaml +python -c 'open("opnfv-environment-new.yaml", "w").write((open("opnfv-environment.yaml").read().replace("replace_private_key:", "key: \"" + "".join(open("nova_id_rsa").readlines()).replace("\\n","\\\n") + "\"")))' +mv -f opnfv-environment-new.yaml opnfv-environment.yaml + source stackrc set -o errexit # Workaround for APEX-207 where sometimes swift proxy is down diff --git a/lib/post-install-functions.sh b/lib/post-install-functions.sh index af72d8f9..a7499feb 100755 --- a/lib/post-install-functions.sh +++ b/lib/post-install-functions.sh @@ -11,7 +11,8 @@ ##Post configuration after install ##params: none function configure_post_install { - local opnfv_attach_networks ovs_ip ip_range net_cidr tmp_ip + local opnfv_attach_networks ovs_ip ip_range net_cidr tmp_ip af public_network_ipv6 + public_network_ipv6=False opnfv_attach_networks="admin_network public_network" echo -e "${blue}INFO: Post Install Configuration Running...${reset}" @@ -41,9 +42,19 @@ EOI eval "ip_range=\${${network}_usable_ip_range}" ovs_ip=${ip_range##*,} eval "net_cidr=\${${network}_cidr}" + if [[ $ovs_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + af=4 + else + af=6 + if [ "$network" == "public_network" ]; then + public_network_ipv6=True + fi + #enable ipv6 on bridge interface + echo 0 > /proc/sys/net/ipv6/conf/${NET_MAP[$network]}/disable_ipv6 + fi sudo ip addr add ${ovs_ip}/${net_cidr##*/} dev ${NET_MAP[$network]} sudo ip link set up ${NET_MAP[$network]} - tmp_ip=$(find_ip ${NET_MAP[$network]}) + tmp_ip=$(find_ip ${NET_MAP[$network]} $af) if [ -n "$tmp_ip" ]; then echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} IP set: ${tmp_ip}${reset}" continue @@ -81,7 +92,11 @@ if [[ -n "$public_network_vlan" && "$public_network_vlan" != 'native' ]]; then else neutron net-create external --router:external=True --tenant-id \$(openstack project show service | grep id | awk '{ print \$4 }') fi -neutron subnet-create --name external-net --tenant-id \$(openstack project show service | grep id | awk '{ print \$4 }') --disable-dhcp external --gateway ${public_network_gateway} --allocation-pool start=${public_network_floating_ip_range%%,*},end=${public_network_floating_ip_range##*,} ${public_network_cidr} +if [ "$public_network_ipv6" == "True" ]; then + neutron subnet-create --name external-net --tenant-id \$(openstack project show service | grep id | awk '{ print \$4 }') external --ip_version 6 --ipv6_ra_mode slaac --ipv6_address_mode slaac --gateway ${public_network_gateway} --allocation-pool start=${public_network_floating_ip_range%%,*},end=${public_network_floating_ip_range##*,} ${public_network_cidr} +else + neutron subnet-create --name external-net --tenant-id \$(openstack project show service | grep id | awk '{ print \$4 }') --disable-dhcp external --gateway ${public_network_gateway} --allocation-pool start=${public_network_floating_ip_range%%,*},end=${public_network_floating_ip_range##*,} ${public_network_cidr} +fi echo "Removing sahara endpoint and service" sahara_service_id=\$(openstack service list | grep sahara | cut -d ' ' -f 2) @@ -108,7 +123,8 @@ fi EOI # for virtual, we NAT public network through Undercloud - if [ "$virtual" == "TRUE" ]; then + # same goes for baremetal if only jumphost has external connectivity + if [ "$virtual" == "TRUE" ] || ! test_overcloud_connectivity && [ "$public_network_ipv6" != "True" ]; then if ! configure_undercloud_nat ${public_network_cidr}; then echo -e "${red}ERROR: Unable to NAT undercloud with external net: ${public_network_cidr}${reset}" exit 1 @@ -174,4 +190,11 @@ source stackrc echo "Undercloud IP: $UNDERCLOUD, please connect by doing 'opnfv-util undercloud'" echo "Overcloud dashboard available at http://\$(heat output-show overcloud PublicVip | sed 's/"//g')/dashboard" EOI + +if [[ "$ha_enabled" == 'True' ]]; then + if [ "$debug" == "TRUE" ]; then + echo "${blue}\nChecking pacemaker service status\n${reset}" + fi + overcloud_connect "controller0" "for i in \$(sudo pcs status | grep '^* ' | cut -d ' ' -f 2 | cut -d '_' -f 1 | uniq); do echo \"WARNING: Service: \$i not running\"; done" +fi } diff --git a/lib/python/apex/network_settings.py b/lib/python/apex/network_settings.py index f2807664..c81256eb 100644 --- a/lib/python/apex/network_settings.py +++ b/lib/python/apex/network_settings.py @@ -223,7 +223,7 @@ class NetworkSettings: - introspection_range - public_network: - provisioner_ip - - floating_ip + - floating_ip_range - gateway """ if network == constants.ADMIN_NETWORK: @@ -236,7 +236,7 @@ class NetworkSettings: elif network == constants.PUBLIC_NETWORK: self._config_ip(network, 'provisioner_ip', 1) self._config_ip_range(network=network, - setting='floating_ip', + setting='floating_ip_range', end_offset=2, count=20) self._config_gateway(network) diff --git a/lib/virtual-setup-functions.sh b/lib/virtual-setup-functions.sh index e7410da7..ed4d4dfd 100755 --- a/lib/virtual-setup-functions.sh +++ b/lib/virtual-setup-functions.sh @@ -40,6 +40,17 @@ EOF fi for i in $(seq 0 $vm_index); do + if [ "$VM_COMPUTES" -gt 0 ]; then + capability="profile:compute" + VM_COMPUTES=$((VM_COMPUTES - 1)) + else + capability="profile:control" + if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' && "$ha_enabled" == "True" && "$ramsize" -lt 10240 ]]; then + echo "WARN: RAM per controller too low. OpenDaylight specified in HA deployment requires at least 10GB" + echo "INFO: Increasing RAM per controller to 10GB" + ramsize=10240 + fi + fi if ! virsh list --all | grep baremetal${i} > /dev/null; then define_vm baremetal${i} network 41 'admin_network' $vcpus $ramsize for n in private_network public_network storage_network api_network; do @@ -54,13 +65,6 @@ EOF #virsh vol-list default | grep baremetal${i} 2>&1> /dev/null || virsh vol-create-as default baremetal${i}.qcow2 41G --format qcow2 mac=$(virsh domiflist baremetal${i} | grep admin_network | awk '{ print $5 }') - if [ "$VM_COMPUTES" -gt 0 ]; then - capability="profile:compute" - VM_COMPUTES=$((VM_COMPUTES - 1)) - else - capability="profile:control" - fi - cat >> $CONFIG/instackenv-virt.json << EOF { "pm_addr": "192.168.122.1", |