|
1 | | -#!/bin/bash |
2 | | - |
3 | | -set -e |
| 1 | +#!/bin/sh |
4 | 2 |
|
5 | 3 | ### Pre-requisite on the host |
6 | 4 | # run a cluster store like etcd or consul |
|
29 | 27 | echo "Loading OVS" >> $BOOTUP_LOGFILE |
30 | 28 | (modprobe openvswitch) || (echo "Load ovs FAILED!!! " >> $BOOTUP_LOGFILE && while true; do sleep 1; done) |
31 | 29 |
|
32 | | -echo "Starting OVS" >> $BOOTUP_LOGFILE |
33 | | -/usr/share/openvswitch/scripts/ovs-ctl restart --system-id=random --with-logdir=/var/run/contiv/log |
| 30 | +echo " Cleaning up ovsdb files" >> $BOOTUP_LOGFILE |
| 31 | +rm -rf /var/run/openvswitch/* |
| 32 | +rm -rf /etc/openvswitch/conf.db |
| 33 | +rm -rf /etc/openvswitch/.conf.db.~lock~ |
| 34 | + |
| 35 | +echo " Creating OVS DB" >> $BOOTUP_LOGFILE |
| 36 | +(ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema) || (while true; do sleep 1; done) |
| 37 | + |
| 38 | +echo " Starting OVSBD server " >> $BOOTUP_LOGFILE |
| 39 | +ovsdb-server --remote=punix:/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --log-file=/var/run/contiv/log/ovs-db.log -vsyslog:dbg -vfile:dbg --pidfile --detach /etc/openvswitch/conf.db >> $BOOTUP_LOGFILE |
| 40 | +echo " Starting ovs-vswitchd " >> $BOOTUP_LOGFILE |
| 41 | +ovs-vswitchd -v --pidfile --detach --log-file=/var/run/contiv/log/ovs-vswitchd.log -vconsole:err -vsyslog:info -vfile:info & |
| 42 | +ovs-vsctl set-manager tcp:127.0.0.1:6640 |
| 43 | +ovs-vsctl set-manager ptcp:6640 |
| 44 | + |
| 45 | +echo "Started OVS" >> $BOOTUP_LOGFILE |
34 | 46 |
|
35 | 47 | echo "Starting Netplugin " >> $BOOTUP_LOGFILE |
36 | | -netplugin_retry="0" |
37 | | -while [ true ]; do |
| 48 | +while true ; do |
38 | 49 | echo "/netplugin $dbg_flag -plugin-mode docker -vlan-if $iflist -cluster-store $cluster_store $ctrl_ip_cfg $vtep_ip_cfg" >> $BOOTUP_LOGFILE |
39 | | - /netplugin $dbg_flag -plugin-mode docker -vlan-if $iflist -cluster-store $cluster_store $ctrl_ip_cfg $vtep_ip_cfg &>> /var/run/contiv/log/netplugin.log |
40 | | - ((netplugin_retry++)) |
41 | | - if [ $netplugin_retry == "10" ] ; then |
42 | | - echo "Giving up after $netplugin_retry retries" >> $BOOTUP_LOGFILE |
43 | | - exit |
44 | | - fi |
45 | | - echo "CRITICAL : Net Plugin has exited, Respawn in 5" >> $BOOTUP_LOGFILE |
| 50 | + /netplugin $dbg_flag -plugin-mode docker -vlan-if $iflist -cluster-store $cluster_store $ctrl_ip_cfg $vtep_ip_cfg &> /var/run/contiv/log/netplugin.log |
| 51 | + echo "CRITICAL : Net Plugin has exited, Respawn in 5s" >> $BOOTUP_LOGFILE |
46 | 52 | sleep 5 |
47 | 53 | echo "Restarting Netplugin " >> $BOOTUP_LOGFILE |
48 | 54 | done & |
49 | 55 |
|
50 | 56 | if [ $plugin_role == "master" ]; then |
51 | 57 | echo "Starting Netmaster " >> $BOOTUP_LOGFILE |
52 | | - netmaster_retry=0 |
53 | | - while [ true ]; do |
| 58 | + while true ; do |
54 | 59 | echo "/netmaster $dbg_flag -plugin-name=$plugin_name -cluster-store=$cluster_store $listen_url_cfg " >> $BOOTUP_LOGFILE |
55 | | - /netmaster $dbg_flag -plugin-name=$plugin_name -cluster-store=$cluster_store $listen_url_cfg &>> /var/run/contiv/log/netmaster.log |
56 | | - ((netmaster_retry++)) |
57 | | - if [ $netmaster_retry == "10" ] ; then |
58 | | - echo "Giving up after $netmaster_retry retries" >> $BOOTUP_LOGFILE |
59 | | - exit |
60 | | - fi |
61 | | - echo "CRITICAL : Net Master has exited, Respawn in 5" >> $BOOTUP_LOGFILE |
| 60 | + /netmaster $dbg_flag -plugin-name=$plugin_name -cluster-store=$cluster_store $listen_url_cfg &> /var/run/contiv/log/netmaster.log |
| 61 | + echo "CRITICAL : Net Master has exited, Respawn in 5s" >> $BOOTUP_LOGFILE |
62 | 62 | echo "Restarting Netmaster " >> $BOOTUP_LOGFILE |
63 | 63 | sleep 5 |
64 | 64 | done & |
|
0 commit comments