2 #placeholder for deployment script.
5 # ./02-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro
15 jujuver=`juju --version`
16 maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'`
18 if [[ "$opnfvmodel" = "openstack" ]]; then
19 #copy and download charms
20 ./$opnfvsdn/fetch-charms.sh $opnfvdistro
23 ./kubernetes/fetch-charms.sh $opnfvdistro
26 #check whether charms are still executing the code even juju-deployer says installed.
30 while [ $retval -eq 0 ]; do
32 juju status > status.txt
33 if [ "$(grep -c "waiting" status.txt )" -ge 2 ]; then
34 echo " still waiting for machines ..."
35 if [ $timeoutiter -ge 240 ]; then
38 timeoutiter=$((timeoutiter+1))
43 echo "...... deployment finishing ......."
46 #read the value from deployconfig.yaml
49 MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //')
50 API_SERVERMAAS="http://$MAAS_IP/MAAS/"
51 if [[ "$maasver" > "2" ]]; then
52 API_KEY=`sudo maas-region apikey --username=ubuntu || true`
54 API_KEY=`sudo maas-region-admin apikey --username=ubuntu || true`
58 if [[ "$API_KEY" = "" ]]; then
59 if [[ "$maasver" > "2" ]]; then
60 API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region apikey --username=ubuntu'`
62 API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region-admin apikey --username=ubuntu'`
66 maas login $PROFILE $API_SERVERMAAS $API_KEY
68 if [[ "$opnfvmodel" = "openstack" ]]; then
69 if [ -e ./deployconfig.yaml ]; then
70 extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '`
71 datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
72 admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
73 cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
74 osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
77 if [[ "$maasver" > "2" ]]; then
78 workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
80 workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
83 for v in ${workmutiple[@]}; do
84 if (( $v > $max )); then max=$v; fi;
88 if [ "$max" -lt 4 ];then
90 elif [ "$max" -lt 33 ]; then
92 elif [ "$max" -lt 73 ]; then
97 sed -i "s/worker_multiplier: 1.0/worker_multiplier: ${workmutiple}/g" default_deployment_config.yaml
99 if [ "$opnfvlab" != "default" ]; then
100 sed -i "s/cpu_pin_set: all/cpu_pin_set: 2-${max},^${max}/g" default_deployment_config.yaml
102 sed -i "s/cpu_pin_set: all/cpu_pin_set: 1/g" default_deployment_config.yaml
108 sed -i -- 's/10.4.1.1/172.16.50.1/g' ./bundles.yaml
109 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
112 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
116 # lets put the if seperateor as "," as this will save me from world.
119 for feature in $opnfvfeature; do
120 if [ "$fea" == "" ]; then
127 if [[ "$opnfvmodel" = "openstack" ]]; then
128 #update source if trusty is target distribution
129 var=os-$opnfvsdn-$fea-$opnfvtype"-"$opnfvdistro"_"$openstack
131 if [ "$osdomname" != "None" ]; then
135 var=k8-$opnfvsdn-$fea-baremetal-core
138 if [[ "$opnfvmodel" = "openstack" ]]; then
139 #lets generate the bundle for all target using genBundle.py
140 python genBundle.py -l deployconfig.yaml -s $var > bundles.yaml
142 #lets generate the bundle for k8 target using genK8Bundle.py
143 python genK8Bundle.py -l deployconfig.yaml -s $var > bundles.yaml
146 #keep the back in cloud for later debugging.
147 pastebinit bundles.yaml || true
149 if [[ "$jujuver" < "2" ]]; then
150 echo "... Deployment Started ...."
151 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack"-nodes
152 count=`juju status nodes --format=short | grep nodes | wc -l`
154 while [ $c -lt $count ]; do
155 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
156 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
157 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
158 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
162 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack" || true
164 # with JUJU 2.0 bundles has to be deployed only once.
165 juju deploy bundles.yaml --debug
168 # seeing issue related to number of open files.
169 count=`juju status nodes --format=short | grep nodes | wc -l`
171 while [ $c -lt $count ]; do
172 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
173 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
174 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
175 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
180 #lets gather the status of deployment once juju-deployer completed.
181 juju status --format=tabular