Skip to content

Commit

Permalink
ovs-ctl: Handle start up errors.
Browse files Browse the repository at this point in the history
Make sure we take the return values into consideration so we can
break early in case of failures. This makes the ovs-ctl helper more
accurate in reporting the real status of its managing processes.

Signed-off-by: Markos Chandras <mchandras@suse.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
  • Loading branch information
Markos Chandras authored and blp committed Oct 4, 2016
1 parent 39f9a32 commit 452a1f5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions utilities/ovs-ctl.in
Expand Up @@ -190,8 +190,9 @@ do_start_ovsdb () {

start_ovsdb() {
if test X"$OVSDB_SERVER" = Xyes; then
do_start_ovsdb
do_start_ovsdb || return 1
fi
return 0
}

add_managers () {
Expand Down Expand Up @@ -238,14 +239,16 @@ do_start_forwarding () {
if test X"$SELF_CONFINEMENT" = Xno; then
set "$@" --no-self-confinement
fi
start_daemon "$OVS_VSWITCHD_PRIORITY" "$OVS_VSWITCHD_WRAPPER" "$@"
start_daemon "$OVS_VSWITCHD_PRIORITY" "$OVS_VSWITCHD_WRAPPER" "$@" ||
return 1
fi
}

start_forwarding () {
if test X"$OVS_VSWITCHD" = Xyes; then
do_start_forwarding
do_start_forwarding || return 1
fi
return 0
}

## ---- ##
Expand Down Expand Up @@ -364,7 +367,7 @@ force_reload_kmod () {
# Restart the database first, since a large database may take a
# while to load, and we want to minimize forwarding disruption.
stop_ovsdb
start_ovsdb
start_ovsdb || return 1

stop_forwarding

Expand Down Expand Up @@ -395,7 +398,7 @@ force_reload_kmod () {

# Start vswitchd by asking it to wait till flow restore is finished.
flow_restore_wait
start_forwarding
start_forwarding || return 1

# Restore saved flows and inform vswitchd that we are done.
restore_flows
Expand All @@ -422,13 +425,13 @@ restart () {
# Restart the database first, since a large database may take a
# while to load, and we want to minimize forwarding disruption.
stop_ovsdb
start_ovsdb
start_ovsdb || return 1

stop_forwarding

# Start vswitchd by asking it to wait till flow restore is finished.
flow_restore_wait
start_forwarding
start_forwarding || return 1

# Restore saved flows and inform vswitchd that we are done.
restore_flows
Expand Down Expand Up @@ -686,7 +689,7 @@ done
case $command in
start)
start_ovsdb || exit 1
start_forwarding
start_forwarding || exit 1
add_managers
;;
stop)
Expand Down

0 comments on commit 452a1f5

Please sign in to comment.