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
34 ovn_dbs=$(ovs-appctl -t ovsdb-server ovsdb-server/list-dbs 2>/dev/null)
35 for db in $ovn_dbs; do
38 action "Removing $db from ovsdb-server" \
39 ovs-appctl -t ovsdb-server ovsdb-server/remove-db $db
43 upgrade_db "$DB_NB_FILE" "$DB_NB_SCHEMA"
44 upgrade_db "$DB_SB_FILE" "$DB_SB_SCHEMA"
45 for db in $DB_NB_FILE $DB_SB_FILE; do
46 action "Adding $db to ovsdb-server" \
47 ovs-appctl -t ovsdb-server ovsdb-server/add-db $db || exit 1
52 # We expect ovn-northd to be co-located with ovsdb-server handling both the
53 # OVN_Northbound and OVN_Southbound dbs.
57 set "$@" -vconsole:emer -vsyslog:err -vfile:info
58 OVS_RUNDIR=${OVN_RUNDIR} start_daemon "$OVN_NORTHD_PRIORITY" "$OVN_NORTHD_WRAPPER" "$@"
62 set ovn-controller "unix:$DB_SOCK"
63 set "$@" -vconsole:emer -vsyslog:err -vfile:info
64 OVS_RUNDIR=${OVN_RUNDIR} start_daemon "$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
72 OVS_RUNDIR=${OVN_RUNDIR} stop_daemon ovn-northd
76 OVS_RUNDIR=${OVN_RUNDIR} stop_daemon ovn-controller
88 restart_controller () {
98 DB_SOCK=$rundir/db.sock
99 DB_NB_FILE=$dbdir/ovnnb.db
100 DB_SB_FILE=$dbdir/ovnsb.db
101 DB_NB_SCHEMA=$datadir/ovn-nb.ovsschema
102 DB_SB_SCHEMA=$datadir/ovn-sb.ovsschema
104 OVN_NORTHD_PRIORITY=-10
106 OVN_CONTROLLER_PRIORITY=-10
107 OVN_CONTROLLER_WRAPPER=
109 OVS_RUNDIR=${OVS_RUNDIR:-${rundir}}
110 OVN_RUNDIR=${OVN_RUNDIR:-${OVS_RUNDIR}}
114 var=`echo "$option" | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
115 eval set=\${$var+yes}
116 eval old_value=\$$var
117 if test X$set = X || \
118 (test $type = bool && \
119 test X"$old_value" != Xno && test X"$old_value" != Xyes); then
120 echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
129 $0: controls Open Virtual Network daemons
130 usage: $0 [OPTIONS] COMMAND
132 This program is intended to be invoked internally by Open Virtual Network
133 startup scripts. System administrators should not normally invoke it directly.
136 start_northd start ovn-northd
137 start_controller start ovn-controller
138 stop_northd stop ovn-northd
139 stop_controller stop ovn-controller
140 restart_northd restart ovn-northd
141 restart_controller restart ovn-controller
144 --ovn-northd-priority=NICE set ovn-northd's niceness (default: $OVN_NORTHD_PRIORITY)
145 --ovn-northd-wrapper=WRAPPER run with a wrapper like valgrind for debugging
146 --ovn-controller-priority=NICE set ovn-northd's niceness (default: $OVN_CONTROLLER_PRIORITY)
147 --ovn-controller-wrapper=WRAPPER run with a wrapper like valgrind for debugging
148 -h, --help display this help message
150 File location options:
151 --db-sock=SOCKET JSON-RPC socket name (default: $DB_SOCK)
152 --db-nb-file=FILE OVN_Northbound db file (default: $DB_NB_FILE)
153 --db-sb-file=FILE OVN_Southbound db file (default: $DB_SB_FILE)
154 --db-nb-schema=FILE OVN_Northbound db file (default: $DB_NB_SCHEMA)
155 --db-sb-schema=FILE OVN_Southbound db file (default: $DB_SB_SCHEMA)
157 Default directories with "configure" option and environment variable override:
158 logs: /usr/local/var/log/openvswitch (--with-logdir, OVS_LOGDIR)
159 pidfiles and sockets: /usr/local/var/run/openvswitch (--with-rundir, OVS_RUNDIR)
160 ovn-nb.db: /usr/local/etc/openvswitch (--with-dbdir, OVS_DBDIR)
161 ovn-sb.db: /usr/local/etc/openvswitch (--with-dbdir, OVS_DBDIR)
162 system configuration: /usr/local/etc (--sysconfdir, OVS_SYSCONFDIR)
163 data files: /usr/local/share/openvswitch (--pkgdatadir, OVS_PKGDATADIR)
164 user binaries: /usr/local/bin (--bindir, OVS_BINDIR)
165 system binaries: /usr/local/sbin (--sbindir, OVS_SBINDIR)
178 option=`expr X"$arg" : 'X--\([^=]*\)'`
179 value=`expr X"$arg" : 'X[^=]*=\(.*\)'`
184 option=`expr X"$arg" : 'X--no-\(.*\)'`
190 option=`expr X"$arg" : 'X--\(.*\)'`
196 echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
200 if test X"$command" = X; then
203 echo >&2 "$0: exactly one non-option argument required (use --help for help)"
229 daemon_status ovn-northd || exit 1
232 daemon_status ovn-controller || exit 1
238 echo >&2 "$0: preheating ovn to 350 degrees F."
242 echo >&2 "$0: missing command name (use --help for help)"
246 echo >&2 "$0: unknown command \"$command\" (use --help for help)"