Skip to content

Commit dca13a7

Browse files
authored
Improve IPs lookup for public and pod, fix issue with cmk error logging (#5)
1 parent a64443c commit dca13a7

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ One-liners installer automates and simplifies the installation and configuration
3838
| **Privileges** | Root / `sudo` |
3939
| **Virtualization** | Hardware virtualization (Intel VT-x / AMD-V) |
4040

41+
> ⚠️ **Important:** During zone deployment, the installer will connect to KVM hosts via SSH.
42+
> Make sure **root SSH login with password** is enabled on any KVM host you want to add.
43+
4144
---
4245

4346
## ✅ Validated Operating Systems
@@ -80,7 +83,7 @@ To install and deploy [CloudStack](https://cloudstack.apache.org), just copy and
8083
### Quick Install
8184

8285
```bash
83-
curl -sSfL https://c8k.in/stall.sh | bash
86+
curl -sSfL https://c8k.in/stall.sh | sudo bash
8487
```
8588

8689
### Download and Run

install.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)