diff options
author | Dan Radez <dradez@redhat.com> | 2016-01-13 12:59:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-01-13 12:59:55 +0000 |
commit | e5bb2981e1c467938a65668e4ebe5a3371e6289e (patch) | |
tree | eb4bb7d51ba52bcd1c5be65037245106bc075ed4 /ci/deploy.sh | |
parent | ab108df51abd4b9e9f075d6123fc343abeadf64b (diff) | |
parent | e8231a61f36ce55465890d681fe1c1dfcbd5b6e9 (diff) |
Merge "Enables private and storage networks"
Diffstat (limited to 'ci/deploy.sh')
-rwxr-xr-x | ci/deploy.sh | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh index 6f36371f..0ee7ac0d 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -156,14 +156,25 @@ for Auto-detection${reset}" for setting in ${common_optional_network_settings}; do eval "setting_value=\${${enabled_network}_${setting}}" if [ -z "${setting_value}" ]; then - setting_value=$(eval find_${setting} ${nic_value}) + if [ -n "$nic_value" ]; then + setting_value=$(eval find_${setting} ${nic_value}) + else + setting_value='' + echo -e "${blue}INFO: Skipping Auto-detection, NIC not specified for ${enabled_network}. Attempting Auto-generation...${reset}" + fi if [ -n "$setting_value" ]; then eval "${enabled_network}_${setting}=${setting_value}" echo -e "${blue}INFO: Auto-detection: ${enabled_network}_${setting}: ${setting_value}${reset}" else # if Auto-detection fails we can auto-generate with CIDR eval "cidr=\${${enabled_network}_cidr}" - setting_value=$(eval generate_${setting} ${cidr}) + if [ -n "$cidr" ]; then + echo -e "${blue}INFO: Auto-generating: ${setting}${reset}" + setting_value=$(eval generate_${setting} ${cidr}) + else + setting_value='' + echo -e "${red}ERROR: Auto-generation failed: required parameter CIDR missing for network ${enabled_network}${reset}" + fi if [ -n "$setting_value" ]; then eval "${enabled_network}_${setting}=${setting_value}" echo -e "${blue}INFO: Auto-generated: ${enabled_network}_${setting}: ${setting_value}${reset}" @@ -183,13 +194,23 @@ for Auto-detection${reset}" for setting in ${network_specific_settings}; do eval "setting_value=\${${enabled_network}_${setting}}" if [ -z "${setting_value}" ]; then - setting_value=$(eval find_${setting} ${nic_value}) + if [ -n "$nic_value" ]; then + setting_value=$(eval find_${setting} ${nic_value}) + else + setting_value='' + echo -e "${blue}INFO: Skipping Auto-detection, NIC not specified for ${enabled_network}. Attempting Auto-generation...${reset}" + fi if [ -n "$setting_value" ]; then eval "${enabled_network}_${setting}=${setting_value}" echo -e "${blue}INFO: Auto-detection: ${enabled_network}_${setting}: ${setting_value}${reset}" else eval "cidr=\${${enabled_network}_cidr}" - setting_value=$(eval generate_${setting} ${cidr}) + if [ -n "$cidr" ]; then + setting_value=$(eval generate_${setting} ${cidr}) + else + setting_value='' + echo -e "${red}ERROR: Auto-generation failed: required parameter CIDR missing for network ${enabled_network}${reset}" + fi if [ -n "$setting_value" ]; then eval "${enabled_network}_${setting}=${setting_value}" echo -e "${blue}INFO: Auto-generated: ${enabled_network}_${setting}: ${setting_value}${reset}" @@ -587,12 +608,48 @@ function setup_virtual_baremetal { ##Set network-environment settings ##params: network-environment file to edit function configure_network_environment { + local tht_dir nic_ext + tht_dir=/usr/share/openstack-tripleo-heat-templates/network + nic_ext='' + sed -i '/ControlPlaneSubnetCidr/c\\ ControlPlaneSubnetCidr: "'${admin_network_cidr##*/}'"' $1 sed -i '/ControlPlaneDefaultRoute/c\\ ControlPlaneDefaultRoute: '${admin_network_provisioner_ip}'' $1 sed -i '/ExternalNetCidr/c\\ ExternalNetCidr: '${public_network_cidr}'' $1 sed -i "/ExternalAllocationPools/c\\ ExternalAllocationPools: [{'start': '${public_network_usable_ip_range%%,*}', 'end': '${public_network_usable_ip_range##*,}'}]" $1 sed -i '/ExternalInterfaceDefaultRoute/c\\ ExternalInterfaceDefaultRoute: '${public_network_gateway}'' $1 sed -i '/EC2MetadataIp/c\\ EC2MetadataIp: '${admin_network_provisioner_ip}'' $1 + + # check for private network + if [[ ! -z "$private_network_enabled" && "$private_network_enabled" == "true" ]]; then + sed -i 's#^.*Network::Tenant.*$# OS::TripleO::Network::Tenant: '${tht_dir}'/tenant.yaml#' $1 + sed -i 's#^.*Controller::Ports::TenantPort:.*$# OS::TripleO::Controller::Ports::TenantPort: '${tht_dir}'/ports/tenant.yaml#' $1 + sed -i 's#^.*Compute::Ports::TenantPort:.*$# OS::TripleO::Compute::Ports::TenantPort: '${tht_dir}'/ports/tenant.yaml#' $1 + sed -i "/TenantAllocationPools/c\\ TenantAllocationPools: [{'start': '${private_network_usable_ip_range%%,*}', 'end': '${private_network_usable_ip_range##*,}'}]" $1 + sed -i '/TenantNetCidr/c\\ TenantNetCidr: '${private_network_cidr}'' $1 + nic_ext+=_private + else + sed -i 's#^.*Network::Tenant.*$# OS::TripleO::Network::Tenant: '${tht_dir}'/noop.yaml#' $1 + sed -i 's#^.*Controller::Ports::TenantPort:.*$# OS::TripleO::Controller::Ports::TenantPort: '${tht_dir}'/ports/noop.yaml#' $1 + sed -i 's#^.*Compute::Ports::TenantPort:.*$# OS::TripleO::Compute::Ports::TenantPort: '${tht_dir}'/ports/noop.yaml#' $1 + fi + + # check for storage network + if [[ ! -z "$storage_network_enabled" && "$storage_network_enabled" == "true" ]]; then + sed -i 's#^.*Network::Storage.*$# OS::TripleO::Network::Storage: '${tht_dir}'/storage.yaml#' $1 + sed -i 's#^.*Controller::Ports::StoragePort:.*$# OS::TripleO::Controller::Ports::StoragePort: '${tht_dir}'/ports/storage.yaml#' $1 + sed -i 's#^.*Compute::Ports::StoragePort:.*$# OS::TripleO::Compute::Ports::StoragePort: '${tht_dir}'/ports/storage.yaml#' $1 + sed -i "/StorageAllocationPools/c\\ StorageAllocationPools: [{'start': '${storage_network_usable_ip_range%%,*}', 'end': '${storage_network_usable_ip_range##*,}'}]" $1 + sed -i '/StorageNetCidr/c\\ StorageNetCidr: '${storage_network_cidr}'' $1 + nic_ext+=_storage + else + sed -i 's#^.*Network::Storage.*$# OS::TripleO::Network::Storage: '${tht_dir}'/noop.yaml#' $1 + sed -i 's#^.*Controller::Ports::StoragePort:.*$# OS::TripleO::Controller::Ports::StoragePort: '${tht_dir}'/ports/noop.yaml#' $1 + sed -i 's#^.*Compute::Ports::StoragePort:.*$# OS::TripleO::Compute::Ports::StoragePort: '${tht_dir}'/ports/noop.yaml#' $1 + fi + + # set nics appropriately + sed -i 's#^.*Compute::Net::SoftwareConfig:.*$# OS::TripleO::Compute::Net::SoftwareConfig: nics/compute'${nic_ext}'.yaml#' $1 + sed -i 's#^.*Controller::Net::SoftwareConfig:.*$# OS::TripleO::Controller::Net::SoftwareConfig: nics/controller'${nic_ext}'.yaml#' $1 } ##Copy over the glance images and instack json file ##params: none @@ -697,7 +754,6 @@ EOI # as well as glance api problem echo -e "${blue}INFO: Sleeping 15 seconds while services come back from restart${reset}" sleep 15 -#TODO Fill in the rest of the network-environment values for other networks } |