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 kubernates/fetch-charms.sh ./fetch-charms.sh
22 jujuver=`juju --version`
24 #modify the ubuntu series wants to deploy
25 sed -i -- "s|distro=trusty|distro=$opnfvdistro|g" ./fetch-charms.sh
27 ./fetch-charms.sh $opnfvdistro
29 if [[ "$opnfvmodel" = "openstack" ]]; then
30 tar xvf common/scaleio.tar -C ./$opnfvdistro/ --strip=2 juju-scaleio/trusty/
34 #check whether charms are still executing the code even juju-deployer says installed.
38 while [ $retval -eq 0 ]; do
40 juju status > status.txt
41 if [ "$(grep -c "waiting" status.txt )" -ge 4 ]; then
42 echo " still waiting for machines ..."
43 if [ $timeoutiter -ge 360 ]; then
46 timeoutiter=$((timeoutiter+1))
51 echo "...... deployment finishing ......."
54 #read the value from deployment.yaml
56 if [[ "$opnfvmodel" = "openstack" ]]; then
57 if [ -e ./deployment.yaml ]; then
58 if [ -e ./deployconfig.yaml ]; then
59 extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '`
60 datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
61 admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
62 cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
63 osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
66 workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
68 for v in ${workmutiple[@]}; do
69 if (( $v > $max )); then max=$v; fi;
73 if [ "$max" -lt 4 ];then
75 elif [ "$max" -lt 33 ]; then
77 elif [ "$max" -lt 73 ]; then
82 sed -i "s/worker_multiplier: 1.0/worker_multiplier: ${workmutiple}/g" default_deployment_config.yaml
88 sed -i -- 's/10.4.1.1/172.16.50.1/g' ./bundles.yaml
89 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
92 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
96 # lets put the if seperateor as "," as this will save me from world.
99 for feature in $opnfvfeature; do
100 if [ "$fea" == "" ]; then
107 if [[ "$opnfvmodel" = "openstack" ]]; then
108 #update source if trusty is target distribution
109 var=os-$opnfvsdn-$fea-$opnfvtype"-"$opnfvdistro"_"$openstack
111 if [ "$osdomname" != "None" ]; then
116 if [[ "$opnfvmodel" = "openstack" ]]; then
117 #lets generate the bundle for all target using genBundle.py
118 python genBundle.py -l deployconfig.yaml -s $var > bundles.yaml
120 #lets generate the bundle for k8 target using genK8Bundle.py
121 python genK8Bundle.py -l deployconfig.yaml -s $var > bundles.yaml
124 #keep the back in cloud for later debugging.
125 pastebinit bundles.yaml || true
127 if [[ "$jujuver" < "2" ]]; then
128 echo "... Deployment Started ...."
129 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack"-nodes
130 count=`juju status nodes --format=short | grep nodes | wc -l`
132 while [ $c -lt $count ]; do
133 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
134 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
135 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
136 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
140 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack" || true
142 # with JUJU 2.0 bundles has to be deployed only once.
143 juju deploy bundles.yaml --debug
146 # seeing issue related to number of open files.
147 count=`juju status nodes --format=short | grep nodes | wc -l`
149 while [ $c -lt $count ]; do
150 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
151 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
152 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
153 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
158 #lets gather the status of deployment once juju-deployer completed.
159 juju status --format=tabular