2 #placeholder for deployment script.
5 # ./02-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro
15 if [[ "$opnfvmodel" = "openstack" ]]; then
16 #copy and download charms
17 cp $opnfvsdn/fetch-charms.sh ./fetch-charms.sh
19 cp kubernetes/fetch-charms.sh ./fetch-charms.sh
22 jujuver=`juju --version`
23 maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'`
25 #modify the ubuntu series wants to deploy
26 sed -i -- "s|distro=trusty|distro=$opnfvdistro|g" ./fetch-charms.sh
28 ./fetch-charms.sh $opnfvdistro
30 if [[ "$opnfvmodel" = "openstack" ]]; then
31 tar xvf common/scaleio.tar -C ./$opnfvdistro/ --strip=2 juju-scaleio/trusty/
35 #check whether charms are still executing the code even juju-deployer says installed.
39 while [ $retval -eq 0 ]; do
41 juju status > status.txt
42 if [ "$(grep -c "waiting" status.txt )" -ge 4 ]; then
43 echo " still waiting for machines ..."
44 if [ $timeoutiter -ge 240 ]; then
47 timeoutiter=$((timeoutiter+1))
52 echo "...... deployment finishing ......."
55 #read the value from deployconfig.yaml
58 MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //')
59 API_SERVERMAAS="http://$MAAS_IP/MAAS/"
60 if [ "$maasver" > "2" ]; then
61 API_KEY=`sudo maas-region apikey --username=ubuntu || true`
63 API_KEY=`sudo maas-region-admin apikey --username=ubuntu || true`
67 if [[ "$API_KEY" = "" ]]; then
68 if [ "$maasver" > "2" ]; then
69 API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region apikey --username=ubuntu'`
71 API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region-admin apikey --username=ubuntu'`
75 maas login $PROFILE $API_SERVERMAAS $API_KEY
77 if [[ "$opnfvmodel" = "openstack" ]]; then
78 if [ -e ./deployconfig.yaml ]; then
79 extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '`
80 datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
81 admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
82 cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
83 osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
86 if [ "$maasver" > "2" ]; then
87 workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
89 workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
92 for v in ${workmutiple[@]}; do
93 if (( $v > $max )); then max=$v; fi;
97 if [ "$max" -lt 4 ];then
99 elif [ "$max" -lt 33 ]; then
101 elif [ "$max" -lt 73 ]; then
106 sed -i "s/worker_multiplier: 1.0/worker_multiplier: ${workmutiple}/g" default_deployment_config.yaml
111 sed -i -- 's/10.4.1.1/172.16.50.1/g' ./bundles.yaml
112 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
115 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
119 # lets put the if seperateor as "," as this will save me from world.
122 for feature in $opnfvfeature; do
123 if [ "$fea" == "" ]; then
130 if [[ "$opnfvmodel" = "openstack" ]]; then
131 #update source if trusty is target distribution
132 var=os-$opnfvsdn-$fea-$opnfvtype"-"$opnfvdistro"_"$openstack
134 if [ "$osdomname" != "None" ]; then
138 var=k8-$opnfvsdn-$fea-baremetal-core
141 if [[ "$opnfvmodel" = "openstack" ]]; then
142 #lets generate the bundle for all target using genBundle.py
143 python genBundle.py -l deployconfig.yaml -s $var > bundles.yaml
145 #lets generate the bundle for k8 target using genK8Bundle.py
146 python genK8Bundle.py -l deployconfig.yaml -s $var > bundles.yaml
149 #keep the back in cloud for later debugging.
150 pastebinit bundles.yaml || true
152 if [[ "$jujuver" < "2" ]]; then
153 echo "... Deployment Started ...."
154 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack"-nodes
155 count=`juju status nodes --format=short | grep nodes | wc -l`
157 while [ $c -lt $count ]; do
158 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
159 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
160 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
161 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
165 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack" || true
167 # with JUJU 2.0 bundles has to be deployed only once.
168 juju deploy bundles.yaml --debug
171 # seeing issue related to number of open files.
172 count=`juju status nodes --format=short | grep nodes | wc -l`
174 while [ $c -lt $count ]; do
175 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
176 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
177 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
178 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
183 #lets gather the status of deployment once juju-deployer completed.
184 juju status --format=tabular