-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2plugin set forward mode when netmaster up #1058
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,19 @@ | |
### Pre-requisite on the host | ||
# run a cluster store like etcd or consul | ||
|
||
set -eu | ||
|
||
if [ $log_dir == "" ]; then | ||
log_dir="/var/log/contiv" | ||
fi | ||
BOOTUP_LOGFILE="$log_dir/plugin_bootup.log" | ||
|
||
# Redirect stdout and stdin to BOOTUP_LOGFILE | ||
exec 1<&- # Close stdout | ||
exec 2<&- # Close stderr | ||
exec 1<>$BOOTUP_LOGFILE # stdout read and write to logfile instead of console | ||
exec 2>&1 # redirect stderr to where stdout is (logfile) | ||
|
||
mkdir -p $log_dir | ||
mkdir -p /var/run/openvswitch | ||
mkdir -p /etc/openvswitch | ||
|
@@ -33,8 +41,6 @@ if [ $vxlan_port != "4789" ]; then | |
vxlan_port_cfg="-vxlan-port=$vxlan_port" | ||
fi | ||
|
||
set -e | ||
|
||
echo "Loading OVS" >> $BOOTUP_LOGFILE | ||
(modprobe openvswitch) || (echo "Load ovs FAILED!!! " >> $BOOTUP_LOGFILE) | ||
|
||
|
@@ -50,7 +56,7 @@ echo " Starting OVSBD server " >> $BOOTUP_LOGFILE | |
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=$log_dir/ovs-db.log -vsyslog:dbg -vfile:dbg --pidfile --detach /etc/openvswitch/conf.db >> $BOOTUP_LOGFILE | ||
echo " Starting ovs-vswitchd " >> $BOOTUP_LOGFILE | ||
ovs-vswitchd -v --pidfile --detach --log-file=$log_dir/ovs-vswitchd.log -vconsole:err -vsyslog:info -vfile:info & | ||
ovs-vsctl set-manager tcp:127.0.0.1:6640 | ||
ovs-vsctl set-manager tcp:127.0.0.1:6640 | ||
ovs-vsctl set-manager ptcp:6640 | ||
|
||
echo "Started OVS, logs in $log_dir" >> $BOOTUP_LOGFILE | ||
|
@@ -77,9 +83,24 @@ if [ $plugin_role == "master" ]; then | |
sleep 5 | ||
echo "Restarting Netmaster " >> $BOOTUP_LOGFILE | ||
done & | ||
|
||
echo "Waiting for netmaster to be ready for connections" | ||
# wait till netmaster starts to listen | ||
for i in $(seq 1 10); do | ||
[ "$(curl -s -o /dev/null -w '%{http_code}' $control_url)" != "000" ] \ | ||
&& break | ||
sleep 1 | ||
done | ||
if [ "$i" -ge "10" ]; then | ||
echo "Failed to set forwarding mode, plugin will fail to enable" | ||
exit 1 | ||
fi | ||
sleep 1 | ||
echo "Netmaster ready for connections, setting forward mode to $fwd_mode" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a nit, could we exit 1 when |
||
/netctl --netmaster http://$control_url global set --fwd-mode "$fwd_mode" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we need to check if fwd mode has been set or if it's allowed to update, or we can check the return code, if it's 5xx then retry, if it's 2xx or 4xx, it might be good to move on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i did testing, the request is idempotent , as long as it's not changing the mode when there's network, we should be good |
||
echo "Forward mode is set" | ||
else | ||
echo "Not starting netmaster as plugin role is" $plugin_role >> $BOOTUP_LOGFILE | ||
fi | ||
|
||
while true; do sleep 1; done | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update docs https://github.com/contiv/netplugin/tree/master/install/v2plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if you need to configure Fabric mode(ACI/default) also here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's fine for now about fabric mode