diff options
Diffstat (limited to 'ci')
-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 9d5d9d28..ae6366f3 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -155,14 +155,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}" @@ -182,13 +193,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}" @@ -586,12 +607,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 @@ -691,7 +748,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 } |