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 --monitor $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
61 # Check and eventually start ovsdb-server for Southbound DB
62 if ! pidfile_is_running
$DB_SB_PID; then
63 upgrade_db
"$DB_SB_FILE" "$DB_SB_SCHEMA" 1>/dev
/null
2>/dev
/null
67 set "$@" --detach --monitor $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
74 if ! pidfile_is_running
$DB_NB_PID; then
75 log_success_msg
"OVN Northbound DB is not running"
77 log_success_msg
"OVN Northbound DB is running"
80 if ! pidfile_is_running
$DB_SB_PID; then
81 log_success_msg
"OVN Southbound DB is not running"
83 log_success_msg
"OVN Southbound DB is running"
88 if test X
"$OVN_MANAGE_OVSDB" = Xyes
; then
92 if ! pidfile_is_running
$DB_NB_PID; then
93 log_failure_msg
"OVN Northbound DB is not running"
96 if ! pidfile_is_running
$DB_SB_PID; then
97 log_failure_msg
"OVN Southbound DB is not running"
101 if daemon_is_running ovn-northd
; then
102 log_success_msg
"ovn-northd is already running"
105 if test X
"$OVN_NORTHD_LOGFILE" != X
; then
106 set "$@" --log-file=$OVN_NORTHD_LOGFILE
108 set "$@" $OVN_NORTHD_LOG --ovnnb-db=unix
:$DB_NB_SOCK --ovnsb-db=unix
:$DB_SB_SOCK
109 OVS_RUNDIR
=${OVN_RUNDIR} start_daemon
"$OVN_NORTHD_PRIORITY" "$OVN_NORTHD_WRAPPER" "$@"
113 start_controller
() {
114 set ovn-controller
"unix:$DB_SOCK"
115 set "$@" -vconsole:emer
-vsyslog:err
-vfile:info
116 OVS_RUNDIR
=${OVN_RUNDIR} start_daemon
"$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
119 start_controller_vtep
() {
120 set ovn-controller-vtep
"unix:$DB_SOCK"
121 set "$@" -vconsole:emer
-vsyslog:err
-vfile:info
122 OVS_RUNDIR
=${OVN_RUNDIR} start_daemon
"$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
130 OVS_RUNDIR
=${OVN_RUNDIR} stop_daemon ovn-northd
132 if test X
"$OVN_MANAGE_OVSDB" = Xyes
; then
138 OVS_RUNDIR
=${OVN_RUNDIR} stop_daemon ovn-controller
141 stop_controller_vtep
() {
142 OVS_RUNDIR
=${OVN_RUNDIR} stop_daemon ovn-controller-vtep
154 restart_controller
() {
159 restart_controller_vtep
() {
161 start_controller_vtep
176 DB_NB_SOCK
=$rundir/ovnnb_db.sock
177 DB_NB_PID
=$rundir/ovnnb_db.pid
178 DB_NB_FILE
=$dbdir/ovnnb_db.db
182 DB_SB_SOCK
=$rundir/ovnsb_db.sock
183 DB_SB_PID
=$rundir/ovnsb_db.pid
184 DB_SB_FILE
=$dbdir/ovnsb_db.db
188 DB_NB_SCHEMA
=$datadir/ovn-nb.ovsschema
189 DB_SB_SCHEMA
=$datadir/ovn-sb.ovsschema
191 DB_SOCK
=$rundir/db.sock
192 DB_CONF_FILE
=$dbdir/conf.db
194 OVN_NORTHD_PRIORITY
=-10
196 OVN_CONTROLLER_PRIORITY
=-10
197 OVN_CONTROLLER_WRAPPER
=
199 OVS_RUNDIR
=${OVS_RUNDIR:-${rundir}}
200 OVN_RUNDIR
=${OVN_RUNDIR:-${OVS_RUNDIR}}
202 OVN_CONTROLLER_LOG
="-vconsole:emer -vsyslog:err -vfile:info"
203 OVN_NORTHD_LOG
="-vconsole:emer -vsyslog:err -vfile:info"
204 OVN_NORTHD_LOGFILE
=""
205 OVN_NB_LOG
="-vconsole:off"
206 OVN_SB_LOG
="-vconsole:off"
207 OVN_NB_LOGFILE
="$logdir/ovsdb-server-nb.log"
208 OVN_SB_LOGFILE
="$logdir/ovsdb-server-sb.log"
212 var
=`echo "$option" | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
213 eval set=\
${$var+yes}
214 eval old_value
=\$
$var
215 if test X
$set = X || \
216 (test $type = bool
&& \
217 test X
"$old_value" != Xno
&& test X
"$old_value" != Xyes
); then
218 echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
227 $0: controls Open Virtual Network daemons
228 usage: $0 [OPTIONS] COMMAND
230 This program is intended to be invoked internally by Open Virtual Network
231 startup scripts. System administrators should not normally invoke it directly.
234 start_northd start ovn-northd
235 start_ovsdb start ovn related ovsdb-server processes
236 start_controller start ovn-controller
237 start_controller_vtep start ovn-controller-vtep
238 stop_northd stop ovn-northd
239 stop_ovsdb stop ovn related ovsdb-server processes
240 stop_controller stop ovn-controller
241 stop_controller_vtep stop ovn-controller-vtep
242 restart_northd restart ovn-northd
243 restart_ovsdb restart ovn related ovsdb-server processes
244 restart_controller restart ovn-controller
245 restart_controller_vtep restart ovn-controller-vtep
248 --ovn-northd-priority=NICE set ovn-northd's niceness (default: $OVN_NORTHD_PRIORITY)
249 --ovn-northd-wrapper=WRAPPER run with a wrapper like valgrind for debugging
250 --ovn-controller-priority=NICE set ovn-northd's niceness (default: $OVN_CONTROLLER_PRIORITY)
251 --ovn-controller-wrapper=WRAPPER run with a wrapper like valgrind for debugging
252 --ovn-manage-ovsdb=yes|no Whether or not the OVN databases should be
253 automatically started and stopped along
254 with ovn-northd. The default is "yes". If
255 this is set to "no", the "start_ovsdb" and
256 "stop_ovsdb" commands must be used to start
257 and stop the OVN databases.
258 --ovn-controller-log=STRING ovn controller process logging params (default: $OVN_CONTROLLER_LOG)
259 --ovn-northd-log=STRING ovn northd process logging params (default: $OVN_NORTHD_LOG)
260 --ovn-northd-logfile=STRING ovn northd process log file (default: $OVN_NORTHD_LOGFILE)
261 --ovn-nb-log=STRING ovn NB ovsdb-server processes logging params (default: $OVN_NB_LOG)
262 --ovn-sb-log=STRING ovn SB ovsdb-server processes logging params (default: $OVN_SB_LOG)
263 -h, --help display this help message
265 File location options:
266 --db-sock=SOCKET JSON-RPC socket name (default: $DB_SOCK)
267 --db-nb-file=FILE OVN_Northbound db file (default: $DB_NB_FILE)
268 --db-sb-file=FILE OVN_Southbound db file (default: $DB_SB_FILE)
269 --db-nb-schema=FILE OVN_Northbound db file (default: $DB_NB_SCHEMA)
270 --db-sb-schema=FILE OVN_Southbound db file (default: $DB_SB_SCHEMA)
271 --db-nb-addr=ADDR OVN Northbound db ptcp address (default: $DB_NB_ADDR)
272 --db-nb-port=PORT OVN Northbound db ptcp port (default: $DB_NB_PORT)
273 --db-sb-addr=ADDR OVN Southbound db ptcp address (default: $DB_SB_ADDR)
274 --db-sb-port=PORT OVN Southbound db ptcp port (default: $DB_SB_PORT)
275 --ovn-nb-logfile=FILE OVN Northbound log file (default: $OVN_NB_LOGFILE)
276 --ovn-sb-logfile=FILE OVN Southbound log file (default: $OVN_SB_LOGFILE)
278 Default directories with "configure" option and environment variable override:
279 logs: /usr/local/var/log/openvswitch (--with-logdir, OVS_LOGDIR)
280 pidfiles and sockets: /usr/local/var/run/openvswitch (--with-rundir, OVS_RUNDIR)
281 ovn-nb.db: /usr/local/etc/openvswitch (--with-dbdir, OVS_DBDIR)
282 ovn-sb.db: /usr/local/etc/openvswitch (--with-dbdir, OVS_DBDIR)
283 system configuration: /usr/local/etc (--sysconfdir, OVS_SYSCONFDIR)
284 data files: /usr/local/share/openvswitch (--pkgdatadir, OVS_PKGDATADIR)
285 user binaries: /usr/local/bin (--bindir, OVS_BINDIR)
286 system binaries: /usr/local/sbin (--sbindir, OVS_SBINDIR)
299 option
=`expr X"$arg" : 'X--\([^=]*\)'`
300 value
=`expr X"$arg" : 'X[^=]*=\(.*\)'`
305 option
=`expr X"$arg" : 'X--no-\(.*\)'`
311 option
=`expr X"$arg" : 'X--\(.*\)'`
317 echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
321 if test X
"$command" = X
; then
324 echo >&2 "$0: exactly one non-option argument required (use --help for help)"
340 start_controller_vtep
)
341 start_controller_vtep
355 stop_controller_vtep
)
367 restart_controller_vtep
)
368 restart_controller_vtep
371 daemon_status ovn-northd ||
exit 1
377 daemon_status ovn-controller ||
exit 1
379 status_controller_vtep
)
380 daemon_status ovn-controller-vtep ||
exit 1
386 echo >&2 "$0: preheating ovn to 350 degrees F."
390 echo >&2 "$0: missing command name (use --help for help)"
394 echo >&2 "$0: unknown command \"$command\" (use --help for help)"