2 #placeholder for deployment script.
5 # ./02-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro
14 #copy and download charms
15 cp $opnfvsdn/fetch-charms.sh ./fetch-charms.sh
17 jujuver=`juju --version`
19 #modify the ubuntu series wants to deploy
20 sed -i -- "s|distro=trusty|distro=$opnfvdistro|g" ./fetch-charms.sh
22 ./fetch-charms.sh $opnfvdistro
24 tar xvf common/scaleio.tar -C ./$opnfvdistro/ --strip=2 juju-scaleio/trusty/
28 #check whether charms are still executing the code even juju-deployer says installed.
32 while [ $retval -eq 0 ]; do
34 juju status > status.txt
35 if [ "$(grep -c "waiting" status.txt )" -ge 4 ]; then
36 echo " still waiting for machines ..."
37 if [ $timeoutiter -ge 360 ]; then
40 timeoutiter=$((timeoutiter+1))
45 echo "...... deployment finishing ......."
48 #read the value from deployment.yaml
50 if [ -e ./deployment.yaml ]; then
51 if [ -e ./deployconfig.yaml ]; then
52 extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '`
53 datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
54 admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
55 cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
56 osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
59 workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
61 for v in ${workmutiple[@]}; do
62 if (( $v > $max )); then max=$v; fi;
66 if [ "$max" -lt 4 ];then
68 elif [ "$max" -lt 33 ]; then
70 elif [ "$max" -lt 73 ]; then
75 sed -i "s/worker_multiplier: 1.0/worker_multiplier: ${workmutiple}/g" default_deployment_config.yaml
80 sed -i -- 's/10.4.1.1/172.16.50.1/g' ./bundles.yaml
81 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
84 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
88 # lets put the if seperateor as "," as this will save me from world.
91 for feature in $opnfvfeature; do
92 if [ "$fea" == "" ]; then
99 #update source if trusty is target distribution
100 var=os-$opnfvsdn-$fea-$opnfvtype"-"$opnfvdistro"_"$openstack
102 if [ "$osdomname" != "None" ]; then
106 #lets generate the bundle for all target using genBundle.py
107 python genBundle.py -l deployconfig.yaml -s $var > bundles.yaml
108 #keep the back in cloud for later debugging.
109 pastebinit bundles.yaml || true
111 if [[ "$jujuver" < "2" ]]; then
112 echo "... Deployment Started ...."
113 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack"-nodes
114 count=`juju status nodes --format=short | grep nodes | wc -l`
116 while [ $c -lt $count ]; do
117 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
118 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
119 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
120 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
124 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack" || true
126 # with JUJU 2.0 bundles has to be deployed only once.
127 juju deploy bundles.yaml --debug
130 # seeing issue related to number of open files.
131 count=`juju status nodes --format=short | grep nodes | wc -l`
133 while [ $c -lt $count ]; do
134 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
135 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
136 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
137 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
142 #lets gather the status of deployment once juju-deployer completed.
143 juju status --format=tabular