Skip to content

Commit

Permalink
fix v2plugin startcontiv.sh for netplugin updates (#1086)
Browse files Browse the repository at this point in the history
run startcontiv.sh with bash

start netplugin after netmaster

set network and forward modes for v2plugin
netplugin will not start without setting the network and forward modes

Signed-off-by: Chris Plock <chrisplo@cisco.com>
  • Loading branch information
chrisplo committed Nov 29, 2017
1 parent 6fcec36 commit 915bd8e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
3 changes: 2 additions & 1 deletion install/v2plugin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ LABEL maintainer "Cisco Contiv (https://contiv.github.io)"

RUN mkdir -p /run/docker/plugins /etc/openvswitch /var/run/contiv/log \
&& echo 'http://dl-cdn.alpinelinux.org/alpine/v3.4/main' >> /etc/apk/repositories \
&& apk --no-cache add openvswitch=2.5.0-r0 iptables ca-certificates openssl curl
&& apk --no-cache add \
openvswitch=2.5.0-r0 iptables ca-certificates openssl curl bash

# copy in binaries and scripts
ARG TAR_FILE
Expand Down
31 changes: 20 additions & 11 deletions install/v2plugin/startcontiv.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

### Pre-requisite on the host
# run a cluster store like etcd or consul
Expand Down Expand Up @@ -71,16 +71,6 @@ echo "Started OVS, logs in $log_dir" >> $BOOTUP_LOGFILE

set +e

echo "Starting Netplugin " >> $BOOTUP_LOGFILE
while true ; do
echo "/netplugin $dbg_flag --plugin-mode=$plugin_mode $vxlan_port_cfg --vlan-if=$iflist $store_arg $ctrl_ip_cfg $vtep_ip_cfg" >> $BOOTUP_LOGFILE
/netplugin $dbg_flag --plugin-mode=$plugin_mode $vxlan_port_cfg --vlan-if=$iflist $store_arg $ctrl_ip_cfg $vtep_ip_cfg &> $log_dir/netplugin.log
echo "CRITICAL : Net Plugin has exited, Respawn in 5" >> $BOOTUP_LOGFILE
mv $log_dir/netplugin.log $log_dir/netplugin.log.lastrun
sleep 5
echo "Restarting Netplugin " >> $BOOTUP_LOGFILE
done &

if [ $plugin_role == "master" ]; then
if [ -z "$fwd_mode" ]; then
echo "fwd_mode is not set, plugin cannot be enabled"
Expand Down Expand Up @@ -116,4 +106,23 @@ else
echo "Not starting netmaster as plugin role is" $plugin_role >> $BOOTUP_LOGFILE
fi

if [[ "$fwd_mode" == "bridge" ]]; then
network_mode=vlan
else
network_mode=vxlan
fi

echo "Starting Netplugin"
while true ; do
set -x
/netplugin $dbg_flag --plugin-mode=$plugin_mode $vxlan_port_cfg \
--vlan-if=$iflist $store_arg $ctrl_ip_cfg $vtep_ip_cfg \
--netmode $network_mode --fwdmode $fwd_mode &> $log_dir/netplugin.log
set +x
echo "CRITICAL : Net Plugin has exited, Respawn in 5"
mv $log_dir/netplugin.log $log_dir/netplugin.log.lastrun
sleep 5
echo "Restarting Netplugin"
done &

while true; do sleep 1; done

0 comments on commit 915bd8e

Please sign in to comment.