1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
|
#!/bin/sh
set -e
#set -x
if ! [ -r /etc/oci-poc/oci-poc.conf ] ; then
echo "Cannot read /etc/oci-poc/oci-poc.conf"
fi
. /etc/oci-poc/oci-poc.conf
# Check that we really have NUMBER_OF_GUESTS machines available
# before starting anything
check_enough_vms_available () {
EXPECTED_NUM_OF_SLAVES=${1}
NUM_VM=$(ocicli -csv machine-list | q -d , -H "SELECT COUNT(*) AS count FROM -")
if [ ${NUM_VM} -lt ${EXPECTED_NUM_OF_SLAVES} ] ; then
echo "Num of VM too low... exiting"
exit 1
fi
}
check_enough_vms_available $((${NUMBER_OF_GUESTS} - 1))
echo "===> Setting-up IPMI ports on VMs"
for i in $(seq 2 $((${NUMBER_OF_GUESTS} + 1))) ; do
VM_SERIAL=$(printf "%X\n" $((0xBF + ${i})))
VNC_PORT=$((9000 + $i))
echo "Setting IPMI for VM with serial: $VM_SERIAL and VNC port: $VNC_PORT"
ocicli machine-set-ipmi ${VM_SERIAL} yes 192.168.200.1 ${VNC_PORT} ipmiusr test
done
echo "===> Creating regions and locations"
ocicli swift-region-create swift-region1
ocicli swift-region-create swift-region2
ocicli swift-region-create swift-region3
ocicli swift-region-create l2
ocicli swift-region-create pub-region
ocicli location-create reg-1-zone-1 swift-region1
ocicli location-create reg-2-zone-1 swift-region2
ocicli location-create reg-3-zone-1 swift-region3
ocicli location-create reg-l2-zone-1 l2
ocicli location-create pub-zone pub-region
echo "===> Creating networks"
ocicli network-create reg1-zone1-net1 192.168.101.0 26 reg-1-zone-1 no
ocicli network-create reg2-zone1-net1 192.168.101.64 26 reg-2-zone-1 no
ocicli network-create reg3-zone1-net1 192.168.101.128 26 reg-3-zone-1 no
# We use the L2 used for booting-up servesr in rack 3...
ocicli network-create reg-l2 192.168.113.0 24 reg-l2-zone-1 no
# ...though to avoid conclifts, we use the last IPs of the range.
ocicli network-set reg-l2 --ip 192.168.113.0 --first-ip 192.168.113.200 --last-ip 192.168.113.220 --vlan 11 --iface1 ens5 --iface2 none
#ocicli network-create br-lb 0.0.0.0 24 reg-1-zone-1 no
ocicli network-create pub-net 192.168.106.1 32 pub-zone yes
# Set the IPMI network
if [ "${USE_AUTOMATIC_IPMI_SETUP}" = "yes" ] ; then
echo "===> Setting-up automatic IPMI assignation"
ocicli network-create ipmi 192.168.200.0 24 reg-1-zone-1 no
ocicli network-set ipmi --role ipmi --ipmi-match-addr 192.168.0.0 --ipmi-match-cidr 16
ssh ${HOST_NETWORK_PREFIX}.2 "sed -i s/automatic_ipmi_numbering=no/automatic_ipmi_numbering=yes/ /etc/openstack-cluster-installer/openstack-cluster-installer.conf" 1>/dev/null 2>/dev/null
ssh ${HOST_NETWORK_PREFIX}.2 "mkdir -p /var/www/.ssh" 1>/dev/null 2>/dev/null
ssh ${HOST_NETWORK_PREFIX}.2 "chown www-data:www-data /var/www/.ssh" 1>/dev/null 2>/dev/null
fi
echo "===> Creating cluster cl1"
ocicli cluster-create cl1 infomaniak.ch
echo "===> Setting BGP-to-host in cl1"
ocicli cluster-set cl1 --bgp-to-the-host yes --asn 65499 --neutron-use-dvr no --region-name cluster1
# This is necessary, otherwise we may have TCP connectivity issues.
# In real life, we could setup MTU to 9050 everywhere in our ikvswitch setups,
# but it currently doesn't work well enough, and it's not so important, as long
# as the internal OpenStack connectivity works.
ocicli cluster-set cl1 --neutron-global-physnet-mtu 1450 --neutron-path-mtu 1500
echo "===> Setting-up messaging VIP"
ocicli network-create messaging-vip 192.168.106.2 32 pub-zone no
ocicli network-add messaging-vip cl1 vip 1g1 none
ocicli network-set messaging-vip --role vip --vip-usage messaging
echo "===> Adding networks to cl1"
ocicli network-add reg1-zone1-net1 cl1 all 1g1 1g2
ocicli network-add reg2-zone1-net1 cl1 all 1g1 1g2
ocicli network-add reg3-zone1-net1 cl1 all 1g1 1g2
ocicli network-add reg-l2 cl1 all 1g2 none
ocicli network-add pub-net cl1 all ens5 none
ocicli network-set pub-net --role vip
ocicli network-set reg1-zone1-net1 --vlan 10
echo "===> Adding controller nodes to cl1"
# 3x Controller machines (includes Swift proxies)
ocicli machine-add C1 cl1 controller reg-1-zone-1
ocicli machine-add C2 cl1 controller reg-2-zone-1
ocicli machine-add C3 cl1 controller reg-3-zone-1
echo "===> Adding compute nodes to cl1"
# 2x Compute (with Ceph OSD hyperconverged)
ocicli machine-add C4 cl1 compute reg-1-zone-1
ocicli machine-add C5 cl1 compute reg-2-zone-1
ocicli machine-add E1 cl1 compute reg-1-zone-1
ocicli machine-add E2 cl1 compute reg-2-zone-1
ocicli machine-add E3 cl1 compute reg-3-zone-1
ocicli machine-add E4 cl1 compute reg-1-zone-1
ocicli machine-add E5 cl1 compute reg-2-zone-1
ocicli machine-add E6 cl1 compute reg-3-zone-1
echo "===> Setting nova memory (8G reserved) and disk (5G reserved) limits for compute hosts"
for i in 1 2 3 4 5 6 7 8 ; do
ocicli machine-set cl1-compute-$i.infomaniak.ch --nova-reserved-host-memory-mb 8192 --nova-reserved-host-disk-mb 5120
done
echo "===> Setting compute nodes to use Ceph and nova-reserved-host-memory-mb to 8192"
ocicli machine-set C4 --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set C5 --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set E1 --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set E2 --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set E3 --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set E4 --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set E5 --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set E6 --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
#echo "===> Addig Ceph OSD feature to compute nodes"
#ocicli machine-set C4 --compute-is-cephosd yes
#ocicli machine-set C5 --compute-is-cephosd yes
echo "===> Adding network nodes to cl1"
# 2x Network
ocicli machine-add C6 cl1 network reg-l2-zone-1
ocicli machine-add C7 cl1 network reg-l2-zone-1
echo "===> Disabling BGP-to-host on network nodes, and adding DRAgent"
ocicli machine-set C6 --force-no-bgp2host yes --neutron-install-dragent yes
ocicli machine-set C7 --force-no-bgp2host yes --neutron-install-dragent yes
echo "===> Adding swiftproxy nodes to cl1"
# 1x Swift proxy
ocicli machine-add C8 cl1 swiftproxy reg-2-zone-1
echo "===> Adding a tempest node to cl1"
# 1x tempest
ocicli machine-add C9 cl1 tempest reg-3-zone-1
echo "===> Adding DNS nodes"
ocicli machine-add CA cl1 dns reg-2-zone-1
ocicli machine-add CB cl1 dns reg-3-zone-1
echo "===> Adding cephmon nodes to cl1"
# 3x Ceph Mon
ocicli machine-add CC cl1 cephmon reg-1-zone-1
ocicli machine-add CD cl1 cephmon reg-2-zone-1
ocicli machine-add CE cl1 cephmon reg-3-zone-1
echo "===> Adding swiftstore nodes to cl1"
# 5x Swift Store
ocicli machine-add CF cl1 swiftstore reg-1-zone-1
ocicli machine-add D0 cl1 swiftstore reg-2-zone-1
ocicli machine-add D1 cl1 swiftstore reg-3-zone-1
echo "===> Setting reserved space limit for swift"
ocicli cluster-set cl1 --swiftstore-fallocate-reserved-space 5 --swiftstore-reserved-space 10 --swiftproxy-fallocate-reserved-space 5 --swiftproxy-reserved-space 10
echo "===> Adding volume nodes to cl1"
# 2x Volume
ocicli machine-add D2 cl1 volume reg-1-zone-1
ocicli machine-add D3 cl1 volume reg-2-zone-1
ocicli machine-add D4 cl1 volume reg-3-zone-1
echo "===> Adding messaging nodes to cl1"
# 3x Messaging
ocicli machine-add D5 cl1 messaging reg-1-zone-1
ocicli machine-add D6 cl1 messaging reg-2-zone-1
ocicli machine-add D7 cl1 messaging reg-3-zone-1
echo "===> Adding billmon nodes"
ocicli machine-add D8 cl1 billmon reg-1-zone-1
ocicli machine-add D9 cl1 billmon reg-2-zone-1
ocicli machine-add DA cl1 billmon reg-3-zone-1
echo "===> Adding billosd nodes"
ocicli machine-add DB cl1 billosd reg-1-zone-1
ocicli machine-add DC cl1 billosd reg-2-zone-1
ocicli machine-add DD cl1 billosd reg-3-zone-1
echo "===> Adding cephosd nodes"
ocicli machine-add DE cl1 cephosd reg-1-zone-1
ocicli machine-add DF cl1 cephosd reg-2-zone-1
ocicli machine-add E0 cl1 cephosd reg-3-zone-1
echo "===> Creating the SQL VIP"
ocicli network-create cl1-vpi-sql 192.168.106.7 32 pub-zone
ocicli network-add cl1-vpi-sql cl1 all 1g1 none
ocicli network-set cl1-vpi-sql --role vip --vip-usage sql
echo "===> Creating the SQL MSG VIP"
ocicli network-create cl1-vpi-sql-msg 192.168.106.8 32 pub-zone
ocicli network-add cl1-vpi-sql-msg cl1 all 1g1 none
ocicli network-set cl1-vpi-sql-msg --role vip --vip-usage sqlmsg
echo "===> Adding SQL nodes"
ocicli machine-add F0 cl1 sql reg-1-zone-1
ocicli machine-add F1 cl1 sql reg-2-zone-1
ocicli machine-add F2 cl1 sql reg-3-zone-1
echo "===> Adding SQL MSG nodes"
ocicli machine-add F3 cl1 sqlmsg reg-1-zone-1
ocicli machine-add F4 cl1 sqlmsg reg-2-zone-1
ocicli machine-add F5 cl1 sqlmsg reg-3-zone-1
echo "===> Adding elasticsearch node"
ocicli machine-add F6 cl1 elastic reg-1-zone-1
echo "===> Setting-up incoming-sacks-use-redis for cl1"
ocicli cluster-set cl1 --gnocchi-incoming-sacks-use-redis yes
# Trixie does not have support for HA queue, so
# we use quorum queues.
if [ "${debian_release}" != "buster" ] && [ "${debian_release}" != "bullseye" ] && [ "${debian_release}" != "bookworm" ] ; then
ocicli cluster-set cl1 --rabbitmq-enable-quorum-queues yes
fi
echo "===> Set elastic node as host for billing"
PASS_ID=$(ocicli -csv password-list --filter service=cloudkitty,passtype=monitoring,cluster=1 | q -H -d, "SELECT id FROM -")
PASS=$(ocicli password-show ${PASS_ID} | grep "Pass:" | cut -d' ' -f2)
ocicli cluster-set cl1 --cloudkitty-use-storage-v2 yes --cloudkitty-storage-v2-host https://cloudkitty:${PASS}@cl1-elastic-1.infomaniak.ch:9200 --cloudkitty-storage-v2-index-name cloudkitty --cloudkitty-storage-v2-backend elasticsearch
echo "===> Reduce the (default) number of fragment in swift"
ocicli cluster-set cl1 --swift-ec-num-data-fragments 6 --swift-ec-num-parity-fragments 2 --swift-ec-enable no --install-designate yes --disable-notifications yes --glance-prefer-ceph-over-swift no
echo "===> Setting-up cl1-swiftproxy-1.infomaniak.ch as swift-proxy-hostname"
ocicli cluster-set cl1 --swift-proxy-hostname cl1-swiftproxy-1.infomaniak.ch --swift-public-cloud-middlewares yes --cinder-default-volume-type CEPH_1
echo "===> Set a more reasonable value for number of gnocchi and cloudkitty workers"
ocicli cluster-set cl1 --cloudkitty-processor-workers 2 --gnocchi-api-workers 4
if [ "${USE_IKVSWITCH}" = yes ] ; then
echo "===> Setting-up BGP and VLAN"
ocicli cluster-set cl1 --bgp-to-the-host yes
ocicli network-set reg1-zone1-net1 --vlan ${BGP_TO_HOST_VLAN}
ocicli network-set reg2-zone1-net1 --vlan ${BGP_TO_HOST_VLAN}
ocicli network-set reg3-zone1-net1 --vlan ${BGP_TO_HOST_VLAN}
fi
echo "===> Calculating swift ring"
# Calculate ring
ocicli swift-calculate-ring cl1 100 100 100
echo "===> Creating Keystone cluster cl2"
ocicli cluster-create cl2 infomaniak.ch
# We create the 2nd cluster with region-name cluster1, to avoid having
# 3 regions from the customer point of view, even though we really have
# 3 regions...
ocicli cluster-set cl2 --bgp-to-the-host yes --asn 65499 --neutron-use-dvr no --install-barbican no --install-heat no --install-rabbit no --region-name cluster1 --disable-notifications yes
echo "===> Creating cl2 network"
ocicli swift-region-create swift-region-cl2
ocicli location-create location-cl2 swift-region-cl2
ocicli network-create cl2-net1 192.168.121.0 26 location-cl2 no
ocicli network-add cl2-net1 cl2 all 1g1 1g2
ocicli network-set cl2-net1 --vlan 10
echo "===> Creating cl2 VIP"
ocicli swift-region-create cl2-vip-swift-region
ocicli location-create cl2-vip-location cl2-vip-swift-region
ocicli network-create cl2-vip-net 192.168.106.10 32 pub-zone yes
ocicli network-add cl2-vip-net cl2 all ens5 none
ocicli network-set cl2-vip-net --role vip --vlan 10
ocicli cluster-set cl2 --bgp-to-the-host yes
echo "===> Adding Keystone nodes to cl2"
ocicli machine-add E8 cl2 controller location-cl2
ocicli machine-add E9 cl2 controller location-cl2
ocicli machine-add EB cl2 controller location-cl2
echo "===> Creating Compute cluster cl3"
ocicli cluster-create cl3 infomaniak.ch
ocicli cluster-set cl3 --bgp-to-the-host yes --asn 65499 --neutron-use-dvr no --region-name cluster3
# Same reason as above.
ocicli cluster-set cl3 --neutron-global-physnet-mtu 1450 --neutron-path-mtu 1500
if [ "${debian_release}" != "buster" ] && [ "${debian_release}" != "bullseye" ] && [ "${debian_release}" != "bookworm" ] ; then
ocicli cluster-set cl3 --rabbitmq-enable-quorum-queues yes
fi
echo "===> Creating cl3 network"
ocicli swift-region-create swift-region-cl3
ocicli location-create location-cl3 swift-region-cl3
ocicli network-create cl3-net1 192.168.122.0 26 location-cl3 no
ocicli network-add cl3-net1 cl3 all 1g1 1g2
ocicli network-set cl3-net1 --vlan 10
echo "===> Creating l2 connected controller networks"
ocicli swift-region-create l2-cl3
ocicli location-create l2-cl3 l2-cl3
ocicli network-create l2-ctrls 192.168.118.0 24 l2-cl3 no
ocicli network-set l2-ctrls --ip 192.168.118.0 --first-ip 192.168.118.200 --last-ip 192.168.118.220 --vlan 16 --iface1 1g2 --iface2 none
ocicli network-add l2-ctrls cl3 all 1g2 none
echo "===> Creating cl3 VIP"
ocicli swift-region-create cl3-vip-swift-region
ocicli location-create cl3-vip-location cl3-vip-swift-region
ocicli network-create cl3-vip-net 192.168.118.0 24 pub-zone yes
ocicli network-add cl3-vip-net cl3 all ens5 none
ocicli network-set cl3-vip-net --role vip --first-ip 192.168.118.100 --last-ip 192.168.118.109 --iface1 ens5.16 --vlan 16
ocicli cluster-set cl3 --bgp-to-the-host yes
echo "===> Adding Controller nodes to cl3"
ocicli machine-add E7 cl3 controller l2-cl3
ocicli machine-add EA cl3 controller l2-cl3
ocicli machine-add ED cl3 controller l2-cl3
ocicli machine-set E7 --force-no-bgp2host yes
ocicli machine-set EA --force-no-bgp2host yes
ocicli machine-set ED --force-no-bgp2host yes
echo "===> Adding Compute nodes to cl3"
ocicli machine-add EC cl3 compute location-cl3
ocicli machine-add EE cl3 compute location-cl3
ocicli machine-add EF cl3 compute location-cl3
ocicli machine-set EC --compute-is-cephosd yes --ceph-osd-initial-setup yes --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set EE --compute-is-cephosd yes --ceph-osd-initial-setup yes --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
ocicli machine-set EF --compute-is-cephosd yes --ceph-osd-initial-setup yes --use_ceph_if_available yes --nova-reserved-host-memory-mb 8192
exit 0
|