@@ -1858,14 +1858,26 @@ deploy_zone() {
18581858 local network=" ${HOST_IP% .* } .0/24"
18591859 # Find IPs for different purposes
18601860 local public_ips=($( find_free_ip_range " $network " 11 20) ) # 20 IPs for public
1861- local pod_ips=($( find_free_ip_range " $network " 41 20) ) # 20 IPs for pod
1861+ if [[ ${# public_ips[@]} -eq 0 ]]; then
1862+ error_exit " No free public IPs found in $network "
1863+ fi
1864+ local last_public_ip=" ${public_ips[-1]} "
1865+ local last_public_octet=" ${last_public_ip##* .} "
1866+ local pod_start=$(( last_public_octet + 1 ))
1867+ if (( pod_start >= 255 )) ; then
1868+ error_exit " Not enough IP space to allocate pod IPs"
1869+ fi
1870+ local pod_ips=($( find_free_ip_range " $network " " $pod_start " 20) ) # 20 IPs for pod
1871+ if [[ ${# pod_ips[@]} -eq 0 ]]; then
1872+ error_exit " No free pod IPs found in $network "
1873+ fi
18621874
18631875 # Default values
18641876 local defaults=(
18651877 " Zone Name" " Zone1"
18661878 " Guest CIDR" " 172.16.1.0/24"
18671879 " Public Start IP" " ${public_ips[0]} "
1868- " Public End IP" " ${public_ips[-1]} "
1880+ " Public End IP" " $last_public_ip "
18691881 " Pod Start IP" " ${pod_ips[0]} "
18701882 " Pod End IP" " ${pod_ips[-1]} "
18711883 " VLAN Range" " 100-200"
@@ -2032,7 +2044,7 @@ deploy_zone() {
20322044 startip=" $public_start " \
20332045 endip=" $public_end " \
20342046 forvirtualnetwork=true) || \
2035- fail_with_dialog_msg " Failed to add Public IP range"
2047+ cmk_api_fail_dialog_msg " Failed to add Public IP range"
20362048 set_tracker_field " vlan_ip_range_id" " $vlan_ip_range_id "
20372049 fi
20382050
@@ -2059,7 +2071,7 @@ deploy_zone() {
20592071 netmask=" $NETMASK " \
20602072 startip=" $pod_start " \
20612073 endip=" $pod_end " ) || \
2062- fail_with_dialog_msg " Failed to create Pod"
2074+ cmk_api_fail_dialog_msg " Failed to create Pod"
20632075 set_tracker_field " pod_id" " $pod_id "
20642076 fi
20652077
@@ -2074,7 +2086,7 @@ deploy_zone() {
20742086 clustername=" $cluster_name " \
20752087 clustertype=CloudManaged \
20762088 hypervisor=KVM) || \
2077- fail_with_dialog_msg " Failed to add Cluster"
2089+ cmk_api_fail_dialog_msg " Failed to add Cluster"
20782090 set_tracker_field " cluster_id" " $cluster_id "
20792091 fi
20802092
0 commit comments