File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,6 +229,7 @@ deploy_zone() {
229229 cmk set username admin
230230 cmk set password password
231231 cmk set display json
232+ cmk set asyncblock true
232233 cmk sync
233234
234235 zone_id=$( cmk create zone dns1=8.8.8.8 internaldns1=$GATEWAY name=AdvZone1 networktype=Advanced | jq ' .zone.id' )
@@ -261,9 +262,35 @@ deploy_zone() {
261262
262263 # TODO: use nmap to scan for free IPs in the range
263264 # sudo nmap -v -sn -n 192.168.1.0/24 -oG - | awk '/Status: Down/{print $2}'
265+ # FIXME: prompt for IP range?
264266 RANGE=$( echo $GATEWAY | sed ' s/\..$//g' )
265- pod_id=$( cmk create pod name=AdvPod1 zoneid=$zone_id gateway=$GATEWAY netmask=255.255.255.0 startip=$pod_start endip=$pod_end | jq ' .pod.id' )
267+ pod_start=
268+ pod_end=
269+ pod_gw=$GATEWAY
270+ pod_mask=255.255.255.0
271+ ip_start=
272+ ip_end=
273+ ip_gw=$GATEWAY
274+ ip_mask=255.255.255.0
266275
276+ pod_id=$( cmk create pod name=AdvPod1 zoneid=$zone_id gateway=$pod_gw netmask=$pod_mask startip=$pod_start endip=$pod_end | jq ' .pod.id' )
277+
278+ cmk create vlaniprange zoneid=$zone_id vlan=untagged gateway=$ip_gw netmask=$ip_mask startip=$ip_start endip=$ip_end forvirtualnetwork=true
279+
280+ cmk update physicalnetwork id=$phy_id vlan=100-200
281+
282+ cluster_id=$( cmk add cluster zoneid=$zone_id hypervisor=KVM clustertype=CloudManaged podid=$pod_id clustername=Cluster1 | jq ' .cluster[0].id' )
283+
284+ # Add by CloudStack Management Server's public key
285+ mkdir -p /root/.ssh
286+ cat /var/lib/cloudstack/management/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
287+ cmk add host zoneid=$zone_id podid=$pod_id clusterid=$cluster_id clustertype=CloudManaged hypervisor=KVM username=root url=http://$HOST_IP
288+
289+ cmk create storagepool zoneid=$zone_id podid=$pod_id clusterid=$cluster_id name=Primary-StoragePool1 scope=zone hypervisor=KVM url=nfs://$HOST_IP /export/primary
290+
291+ cmk add imagestore provider=NFS zoneid=$zone_id name=Secondary-StoragePool1 url=nfs://$HOST_IP /export/secondary
292+
293+ cmk update zone allocationstate=Enabled id=$zone_id
267294}
268295
269296display_url () {
You can’t perform that action at this time.
0 commit comments