3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 */*) dir0
=`echo "$0" | sed 's,/[^/]*$,,'` ;;
19 .
"$dir0/ovs-lib" ||
exit 1
21 for dir
in "$sbindir" "$bindir" /sbin
/bin
/usr
/sbin
/usr
/bin
; do
33 pidfile_is_running
() {
35 test -e "$pidfile" && pid
=`cat "$pidfile"` && pid_exists
"$pid"
39 if pidfile_is_running
$DB_NB_PID; then
40 ovs-appctl
-t $rundir/ovnnb_db.ctl
exit
43 if pidfile_is_running
$DB_SB_PID; then
44 ovs-appctl
-t $rundir/ovnsb_db.ctl
exit
49 # Check and eventually start ovsdb-server for Northbound DB
50 if ! pidfile_is_running
$DB_NB_PID; then
51 upgrade_db
"$DB_NB_FILE" "$DB_NB_SCHEMA" 1>/dev
/null
2>/dev
/null
55 set "$@" --detach $OVN_NB_LOG --log-file=$OVN_NB_LOGFILE --remote=punix
:$DB_NB_SOCK --remote=ptcp
:$DB_NB_PORT:$DB_NB_ADDR --pidfile=$DB_NB_PID --unixctl=ovnnb_db.ctl
60 # Check and eventually start ovsdb-server for Southbound DB
61 if ! pidfile_is_running
$DB_SB_PID; then
62 upgrade_db
"$DB_SB_FILE" "$DB_SB_SCHEMA" 1>/dev
/null
2>/dev
/null
66 set "$@" --detach $OVN_SB_LOG --log-file=$OVN_SB_LOGFILE --remote=punix
:$DB_SB_SOCK --remote=ptcp
:$DB_SB_PORT:$DB_SB_ADDR --pidfile=$DB_SB_PID --unixctl=ovnsb_db.ctl
72 if ! pidfile_is_running
$DB_NB_PID; then
73 log_success_msg
"OVN Northbound DB is not running"
75 log_success_msg
"OVN Northbound DB is running"
78 if ! pidfile_is_running
$DB_SB_PID; then
79 log_success_msg
"OVN Southbound DB is not running"
81 log_success_msg
"OVN Southbound DB is running"
86 if test X
"$OVN_MANAGE_OVSDB" = Xyes
; then
90 if ! pidfile_is_running
$DB_NB_PID; then
91 log_failure_msg
"OVN Northbound DB is not running"
94 if ! pidfile_is_running
$DB_SB_PID; then
95 log_failure_msg
"OVN Southbound DB is not running"
99 if daemon_is_running ovn-northd
; then
100 log_success_msg
"ovn-northd is already running"
103 if test X
"$OVN_NORTHD_LOGFILE" != X
; then
104 set "$@" --log-file=$OVN_NORTHD_LOGFILE
106 set "$@" $OVN_NORTHD_LOG --ovnnb-db=unix
:$DB_NB_SOCK --ovnsb-db=unix
:$DB_SB_SOCK
107 OVS_RUNDIR
=${OVN_RUNDIR} start_daemon
"$OVN_NORTHD_PRIORITY" "$OVN_NORTHD_WRAPPER" "$@"
111 start_controller
() {
112 set ovn-controller
"unix:$DB_SOCK"
113 set "$@" -vconsole:emer
-vsyslog:err
-vfile:info
114 OVS_RUNDIR
=${OVN_RUNDIR} start_daemon
"$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
117 start_controller_vtep
() {
118 set ovn-controller-vtep
"unix:$DB_SOCK"
119 set "$@" -vconsole:emer
-vsyslog:err
-vfile:info
120 OVS_RUNDIR
=${OVN_RUNDIR} start_daemon
"$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
128 OVS_RUNDIR
=${OVN_RUNDIR} stop_daemon ovn-northd
130 if test X
"$OVN_MANAGE_OVSDB" = Xyes
; then
136 OVS_RUNDIR
=${OVN_RUNDIR} stop_daemon ovn-controller
139 stop_controller_vtep
() {
140 OVS_RUNDIR
=${OVN_RUNDIR} stop_daemon ovn-controller-vtep
152 restart_controller
() {
157 restart_controller_vtep
() {
159 start_controller_vtep
174 DB_NB_SOCK
=$rundir/ovnnb_db.sock
175 DB_NB_PID
=$rundir/ovnnb_db.pid
176 DB_NB_FILE
=$dbdir/ovnnb_db.db
180 DB_SB_SOCK
=$rundir/ovnsb_db.sock
181 DB_SB_PID
=$rundir/ovnsb_db.pid
182 DB_SB_FILE
=$dbdir/ovnsb_db.db
186 DB_NB_SCHEMA
=$datadir/ovn-nb.ovsschema
187 DB_SB_SCHEMA
=$datadir/ovn-sb.ovsschema
189 DB_SOCK
=$rundir/db.sock
190 DB_CONF_FILE
=$dbdir/conf.db
192 OVN_NORTHD_PRIORITY
=-10
194 OVN_CONTROLLER_PRIORITY
=-10
195 OVN_CONTROLLER_WRAPPER
=
197 OVS_RUNDIR
=${OVS_RUNDIR:-${rundir}}
198 OVN_RUNDIR
=${OVN_RUNDIR:-${OVS_RUNDIR}}
200 OVN_CONTROLLER_LOG
="-vconsole:emer -vsyslog:err -vfile:info"
201 OVN_NORTHD_LOG
="-vconsole:emer -vsyslog:err -vfile:info"
202 OVN_NORTHD_LOGFILE
=""
203 OVN_NB_LOG
="-vconsole:off"
204 OVN_SB_LOG
="-vconsole:off"
205 OVN_NB_LOGFILE
="$logdir/ovsdb-server-nb.log"
206 OVN_SB_LOGFILE
="$logdir/ovsdb-server-sb.log"
210 var
=`echo "$option" | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
211 eval set=\
${$var+yes}
212 eval old_value
=\$
$var
213 if test X
$set = X || \
214 (test $type = bool
&& \
215 test X
"$old_value" != Xno
&& test X
"$old_value" != Xyes
); then
216 echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
225 $0: controls Open Virtual Network daemons
226 usage: $0 [OPTIONS] COMMAND
228 This program is intended to be invoked internally by Open Virtual Network
229 startup scripts. System administrators should not normally invoke it directly.
232 start_northd start ovn-northd
233 start_ovsdb start ovn related ovsdb-server processes
234 start_controller start ovn-controller
235 start_controller_vtep start ovn-controller-vtep
236 stop_northd stop ovn-northd
237 stop_ovsdb stop ovn related ovsdb-server processes
238 stop_controller stop ovn-controller
239 stop_controller_vtep stop ovn-controller-vtep
240 restart_northd restart ovn-northd
241 restart_ovsdb restart ovn related ovsdb-server processes
242 restart_controller restart ovn-controller
243 restart_controller_vtep restart ovn-controller-vtep
246 --ovn-northd-priority=NICE set ovn-northd's niceness (default: $OVN_NORTHD_PRIORITY)
247 --ovn-northd-wrapper=WRAPPER run with a wrapper like valgrind for debugging
248 --ovn-controller-priority=NICE set ovn-northd's niceness (default: $OVN_CONTROLLER_PRIORITY)
249 --ovn-controller-wrapper=WRAPPER run with a wrapper like valgrind for debugging
250 --ovn-manage-ovsdb=yes|no Whether or not the OVN databases should be
251 automatically started and stopped along
252 with ovn-northd. The default is "yes". If
253 this is set to "no", the "start_ovsdb" and
254 "stop_ovsdb" commands must be used to start
255 and stop the OVN databases.
256 --ovn-controller-log=STRING ovn controller process logging params (default: $OVN_CONTROLLER_LOG)
257 --ovn-northd-log=STRING ovn northd process logging params (default: $OVN_NORTHD_LOG)
258 --ovn-northd-logfile=STRING ovn northd process log file (default: $OVN_NORTHD_LOGFILE)
259 --ovn-nb-log=STRING ovn NB ovsdb-server processes logging params (default: $OVN_NB_LOG)
260 --ovn-sb-log=STRING ovn SB ovsdb-server processes logging params (default: $OVN_SB_LOG)
261 -h, --help display this help message
263 File location options:
264 --db-sock=SOCKET JSON-RPC socket name (default: $DB_SOCK)
265 --db-nb-file=FILE OVN_Northbound db file (default: $DB_NB_FILE)
266 --db-sb-file=FILE OVN_Southbound db file (default: $DB_SB_FILE)
267 --db-nb-schema=FILE OVN_Northbound db file (default: $DB_NB_SCHEMA)
268 --db-sb-schema=FILE OVN_Southbound db file (default: $DB_SB_SCHEMA)
269 --db-nb-addr=ADDR OVN Northbound db ptcp address (default: $DB_NB_ADDR)
270 --db-nb-port=PORT OVN Northbound db ptcp port (default: $DB_NB_PORT)
271 --db-sb-addr=ADDR OVN Southbound db ptcp address (default: $DB_SB_ADDR)
272 --db-sb-port=PORT OVN Southbound db ptcp port (default: $DB_SB_PORT)
273 --ovn-nb-logfile=FILE OVN Northbound log file (default: $OVN_NB_LOGFILE)
274 --ovn-sb-logfile=FILE OVN Southbound log file (default: $OVN_SB_LOGFILE)
276 Default directories with "configure" option and environment variable override:
277 logs: /usr/local/var/log/openvswitch (--with-logdir, OVS_LOGDIR)
278 pidfiles and sockets: /usr/local/var/run/openvswitch (--with-rundir, OVS_RUNDIR)
279 ovn-nb.db: /usr/local/etc/openvswitch (--with-dbdir, OVS_DBDIR)
280 ovn-sb.db: /usr/local/etc/openvswitch (--with-dbdir, OVS_DBDIR)
281 system configuration: /usr/local/etc (--sysconfdir, OVS_SYSCONFDIR)
282 data files: /usr/local/share/openvswitch (--pkgdatadir, OVS_PKGDATADIR)
283 user binaries: /usr/local/bin (--bindir, OVS_BINDIR)
284 system binaries: /usr/local/sbin (--sbindir, OVS_SBINDIR)
297 option
=`expr X"$arg" : 'X--\([^=]*\)'`
298 value
=`expr X"$arg" : 'X[^=]*=\(.*\)'`
303 option
=`expr X"$arg" : 'X--no-\(.*\)'`
309 option
=`expr X"$arg" : 'X--\(.*\)'`
315 echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
319 if test X
"$command" = X
; then
322 echo >&2 "$0: exactly one non-option argument required (use --help for help)"
338 start_controller_vtep
)
339 start_controller_vtep
353 stop_controller_vtep
)
365 restart_controller_vtep
)
366 restart_controller_vtep
369 daemon_status ovn-northd ||
exit 1
375 daemon_status ovn-controller ||
exit 1
377 status_controller_vtep
)
378 daemon_status ovn-controller-vtep ||
exit 1
384 echo >&2 "$0: preheating ovn to 350 degrees F."
388 echo >&2 "$0: missing command name (use --help for help)"
392 echo >&2 "$0: unknown command \"$command\" (use --help for help)"