/usr/share/openvswitch/scripts/ovn-ctl is in ovn-common 2.9.0-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | #!/bin/sh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
case $0 in
*/*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;;
*) dir0=./ ;;
esac
. "$dir0/ovs-lib" || exit 1
for dir in "$sbindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do
case :$PATH: in
*:$dir:*) ;;
*) PATH=$PATH:$dir ;;
esac
done
ovnnb_active_conf_file="$etcdir/ovnnb-active.conf"
ovnsb_active_conf_file="$etcdir/ovnsb-active.conf"
ovn_northd_db_conf_file="$etcdir/ovn-northd-db-params.conf"
## ----- ##
## start ##
## ----- ##
pidfile_is_running () {
pidfile=$1
test -e "$pidfile" && pid=`cat "$pidfile"` && pid_exists "$pid"
} >/dev/null 2>&1
stop_nb_ovsdb() {
if pidfile_is_running $DB_NB_PID; then
ovs-appctl -t $rundir/ovnnb_db.ctl exit
fi
}
stop_sb_ovsdb() {
if pidfile_is_running $DB_SB_PID; then
ovs-appctl -t $rundir/ovnsb_db.ctl exit
fi
}
stop_ovsdb () {
stop_nb_ovsdb
stop_sb_ovsdb
}
demote_ovnnb() {
if test ! -z "$DB_NB_SYNC_FROM_ADDR"; then
echo "$DB_NB_SYNC_FROM_PROTO:$DB_NB_SYNC_FROM_ADDR:$DB_NB_SYNC_FROM_PORT" > $ovnnb_active_conf_file
fi
if test -e $ovnnb_active_conf_file; then
ovs-appctl -t $rundir/ovnnb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnnb_active_conf_file`
ovs-appctl -t $rundir/ovnnb_db.ctl ovsdb-server/connect-active-ovsdb-server
else
echo >&2 "$0: active server details not set"
exit 1
fi
}
demote_ovnsb() {
if test ! -z "$DB_SB_SYNC_FROM_ADDR"; then
echo "$DB_SB_SYNC_FROM_PROTO:$DB_SB_SYNC_FROM_ADDR:$DB_SB_SYNC_FROM_PORT" > $ovnsb_active_conf_file
fi
if test -e $ovnsb_active_conf_file; then
ovs-appctl -t $rundir/ovnsb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnsb_active_conf_file`
ovs-appctl -t $rundir/ovnsb_db.ctl ovsdb-server/connect-active-ovsdb-server
else
echo >&2 "$0: active server details not set"
exit 1
fi
}
promote_ovnnb() {
rm -f $ovnnb_active_conf_file
ovs-appctl -t $rundir/ovnnb_db.ctl ovsdb-server/disconnect-active-ovsdb-server
}
promote_ovnsb() {
rm -f $ovnsb_active_conf_file
ovs-appctl -t $rundir/ovnsb_db.ctl ovsdb-server/disconnect-active-ovsdb-server
}
start_nb_ovsdb() {
# Check and eventually start ovsdb-server for Northbound DB
if ! pidfile_is_running $DB_NB_PID; then
upgrade_db "$DB_NB_FILE" "$DB_NB_SCHEMA" 1>/dev/null 2>/dev/null
set ovsdb-server
if test X"$DB_NB_DETACH" != Xno; then
set "$@" --detach --monitor
else
set exec "$@"
fi
set "$@" $OVN_NB_LOG --log-file=$OVN_NB_LOGFILE
set "$@" --remote=punix:$DB_NB_SOCK --pidfile=$DB_NB_PID
set "$@" --remote=db:OVN_Northbound,NB_Global,connections
set "$@" --unixctl=ovnnb_db.ctl
set "$@" --private-key=db:OVN_Northbound,SSL,private_key
set "$@" --certificate=db:OVN_Northbound,SSL,certificate
set "$@" --ca-cert=db:OVN_Northbound,SSL,ca_cert
set "$@" --ssl-protocols=db:OVN_Northbound,SSL,ssl_protocols
set "$@" --ssl-ciphers=db:OVN_Northbound,SSL,ssl_ciphers
if test X"$DB_NB_CREATE_INSECURE_REMOTE" = Xyes; then
set "$@" --remote=ptcp:$DB_NB_PORT:$DB_NB_ADDR
fi
if test ! -z "$DB_NB_SYNC_FROM_ADDR"; then
echo "$DB_NB_SYNC_FROM_PROTO:$DB_NB_SYNC_FROM_ADDR:$DB_NB_SYNC_FROM_PORT" > $ovnnb_active_conf_file
fi
if test -e $ovnnb_active_conf_file; then
set "$@" --sync-from=`cat $ovnnb_active_conf_file`
fi
$@ $DB_NB_FILE
ovn-nbctl init
fi
}
start_sb_ovsdb() {
# Check and eventually start ovsdb-server for Southbound DB
if ! pidfile_is_running $DB_SB_PID; then
upgrade_db "$DB_SB_FILE" "$DB_SB_SCHEMA" 1>/dev/null 2>/dev/null
set ovsdb-server
if test X"$DB_SB_DETACH" != Xno; then
set "$@" --detach --monitor
else
set exec "$@"
fi
set "$@" $OVN_SB_LOG --log-file=$OVN_SB_LOGFILE
set "$@" --remote=punix:$DB_SB_SOCK --pidfile=$DB_SB_PID
set "$@" --remote=db:OVN_Southbound,SB_Global,connections
set "$@" --unixctl=ovnsb_db.ctl
set "$@" --private-key=db:OVN_Southbound,SSL,private_key
set "$@" --certificate=db:OVN_Southbound,SSL,certificate
set "$@" --ca-cert=db:OVN_Southbound,SSL,ca_cert
set "$@" --ssl-protocols=db:OVN_Southbound,SSL,ssl_protocols
set "$@" --ssl-ciphers=db:OVN_Southbound,SSL,ssl_ciphers
if test X"$DB_SB_CREATE_INSECURE_REMOTE" = Xyes; then
set "$@" --remote=ptcp:$DB_SB_PORT:$DB_SB_ADDR
fi
if test ! -z "$DB_SB_SYNC_FROM_ADDR"; then
echo "$DB_SB_SYNC_FROM_PROTO:$DB_SB_SYNC_FROM_ADDR:$DB_SB_SYNC_FROM_PORT" > $ovnsb_active_conf_file
fi
if test -e $ovnsb_active_conf_file; then
set "$@" --sync-from=`cat $ovnsb_active_conf_file`
fi
$@ $DB_SB_FILE
ovn-sbctl init
fi
}
start_ovsdb () {
start_nb_ovsdb
start_sb_ovsdb
}
sync_status() {
ovs-appctl -t $rundir/ovn${1}_db.ctl ovsdb-server/sync-status | awk '{if(NR==1) print $2}'
}
status_ovnnb() {
if ! pidfile_is_running $DB_NB_PID; then
echo "not-running"
else
echo "running/$(sync_status nb)"
fi
}
status_ovnsb() {
if ! pidfile_is_running $DB_SB_PID; then
echo "not-running"
else
echo "running/$(sync_status sb)"
fi
}
status_ovsdb () {
if ! pidfile_is_running $DB_NB_PID; then
log_success_msg "OVN Northbound DB is not running"
else
log_success_msg "OVN Northbound DB is running"
fi
if ! pidfile_is_running $DB_SB_PID; then
log_success_msg "OVN Southbound DB is not running"
else
log_success_msg "OVN Southbound DB is running"
fi
}
run_nb_ovsdb() {
DB_NB_DETACH=no
start_nb_ovsdb
}
run_sb_ovsdb() {
DB_SB_DETACH=no
start_sb_ovsdb
}
start_northd () {
if [ ! -e $ovn_northd_db_conf_file ]; then
if test X"$OVN_MANAGE_OVSDB" = Xyes; then
start_ovsdb
if ! pidfile_is_running $DB_NB_PID; then
log_failure_msg "OVN Northbound DB is not running"
exit
fi
if ! pidfile_is_running $DB_SB_PID; then
log_failure_msg "OVN Southbound DB is not running"
exit
fi
fi
ovn_northd_params="--ovnnb-db=unix:$DB_NB_SOCK --ovnsb-db=unix:$DB_SB_SOCK"
else
ovn_northd_params="`cat $ovn_northd_db_conf_file`"
fi
if daemon_is_running ovn-northd; then
log_success_msg "ovn-northd is already running"
else
set ovn-northd
if test X"$OVN_NORTHD_LOGFILE" != X; then
set "$@" --log-file=$OVN_NORTHD_LOGFILE
fi
set "$@" $OVN_NORTHD_LOG $ovn_northd_params
OVS_RUNDIR=${OVN_RUNDIR} start_daemon "$OVN_NORTHD_PRIORITY" "$OVN_NORTHD_WRAPPER" "$@"
fi
}
start_controller () {
set ovn-controller "unix:$DB_SOCK"
set "$@" $OVN_CONTROLLER_LOG
if test X"$OVN_CONTROLLER_SSL_KEY" != X; then
set "$@" --private-key=$OVN_CONTROLLER_SSL_KEY
fi
if test X"$OVN_CONTROLLER_SSL_CERT" != X; then
set "$@" --certificate=$OVN_CONTROLLER_SSL_CERT
fi
if test X"$OVN_CONTROLLER_SSL_CA_CERT" != X; then
set "$@" --ca-cert=$OVN_CONTROLLER_SSL_CA_CERT
fi
if test X"$OVN_CONTROLLER_SSL_BOOTSTRAP_CA_CERT" != X; then
set "$@" --bootstrap-ca-cert=$OVN_CONTROLLER_SSL_BOOTSTRAP_CA_CERT
fi
OVS_RUNDIR=${OVN_RUNDIR} start_daemon "$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
}
start_controller_vtep () {
set ovn-controller-vtep "unix:$DB_SOCK"
set "$@" -vconsole:emer -vsyslog:err -vfile:info
if test X"$OVN_CONTROLLER_SSL_KEY" != X; then
set "$@" --private-key=$OVN_CONTROLLER_SSL_KEY
fi
if test X"$OVN_CONTROLLER_SSL_CERT" != X; then
set "$@" --certificate=$OVN_CONTROLLER_SSL_CERT
fi
if test X"$OVN_CONTROLLER_SSL_CA_CERT" != X; then
set "$@" --ca-cert=$OVN_CONTROLLER_SSL_CA_CERT
fi
if test X"$OVN_CONTROLLER_SSL_BOOTSTRAP_CA_CERT" != X; then
set "$@" --bootstrap-ca-cert=$OVN_CONTROLLER_SSL_BOOTSTRAP_CA_CERT
fi
OVS_RUNDIR=${OVN_RUNDIR} start_daemon "$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
}
## ---- ##
## stop ##
## ---- ##
stop_northd () {
OVS_RUNDIR=${OVN_RUNDIR} stop_daemon ovn-northd
if [ ! -e $ovn_northd_db_conf_file ]; then
if test X"$OVN_MANAGE_OVSDB" = Xyes; then
stop_ovsdb
fi
fi
}
stop_controller () {
OVS_RUNDIR=${OVN_RUNDIR} stop_daemon ovn-controller
}
stop_controller_vtep () {
OVS_RUNDIR=${OVN_RUNDIR} stop_daemon ovn-controller-vtep
}
## ------- ##
## restart ##
## ------- ##
restart_northd () {
stop_northd
start_northd
}
restart_controller () {
stop_controller
start_controller
}
restart_controller_vtep () {
stop_controller_vtep
start_controller_vtep
}
restart_ovsdb () {
stop_ovsdb
start_ovsdb
}
restart_nb_ovsdb () {
stop_nb_ovsdb
start_nb_ovsdb
}
restart_sb_ovsdb () {
stop_sb_ovsdb
start_sb_ovsdb
}
## ---- ##
## main ##
## ---- ##
set_defaults () {
OVN_MANAGE_OVSDB=yes
DB_NB_SOCK=$rundir/ovnnb_db.sock
DB_NB_PID=$rundir/ovnnb_db.pid
DB_NB_FILE=$dbdir/ovnnb_db.db
DB_NB_ADDR=0.0.0.0
DB_NB_PORT=6641
DB_NB_SYNC_FROM_PROTO=tcp
DB_NB_SYNC_FROM_ADDR=
DB_NB_SYNC_FROM_PORT=6641
DB_SB_SOCK=$rundir/ovnsb_db.sock
DB_SB_PID=$rundir/ovnsb_db.pid
DB_SB_FILE=$dbdir/ovnsb_db.db
DB_SB_ADDR=0.0.0.0
DB_SB_PORT=6642
DB_SB_SYNC_FROM_PROTO=tcp
DB_SB_SYNC_FROM_ADDR=
DB_SB_SYNC_FROM_PORT=6642
DB_NB_SCHEMA=$datadir/ovn-nb.ovsschema
DB_SB_SCHEMA=$datadir/ovn-sb.ovsschema
DB_SOCK=$rundir/db.sock
DB_CONF_FILE=$dbdir/conf.db
OVN_NORTHD_PRIORITY=-10
OVN_NORTHD_WRAPPER=
OVN_CONTROLLER_PRIORITY=-10
OVN_CONTROLLER_WRAPPER=
OVS_RUNDIR=${OVS_RUNDIR:-${rundir}}
OVN_RUNDIR=${OVN_RUNDIR:-${OVS_RUNDIR}}
OVN_CONTROLLER_LOG="-vconsole:emer -vsyslog:err -vfile:info"
OVN_NORTHD_LOG="-vconsole:emer -vsyslog:err -vfile:info"
OVN_NORTHD_LOGFILE=""
OVN_NB_LOG="-vconsole:off -vfile:info"
OVN_SB_LOG="-vconsole:off -vfile:info"
OVN_NB_LOGFILE="$logdir/ovsdb-server-nb.log"
OVN_SB_LOGFILE="$logdir/ovsdb-server-sb.log"
OVN_CONTROLLER_SSL_KEY=""
OVN_CONTROLLER_SSL_CERT=""
OVN_CONTROLLER_SSL_CA_CERT=""
OVN_CONTROLLER_SSL_BOOTSTRAP_CA_CERT=""
DB_SB_CREATE_INSECURE_REMOTE="no"
DB_NB_CREATE_INSECURE_REMOTE="no"
MONITOR="yes"
DB_NB_DETACH="yes"
DB_SB_DETACH="yes"
}
set_option () {
var=`echo "$option" | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
eval set=\${$var+yes}
eval old_value=\$$var
if test X$set = X || \
(test $type = bool && \
test X"$old_value" != Xno && test X"$old_value" != Xyes); then
echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
return
fi
eval $var=\$value
}
usage () {
set_defaults
cat << EOF
$0: controls Open Virtual Network daemons
usage: $0 [OPTIONS] COMMAND
This program is intended to be invoked internally by Open Virtual Network
startup scripts. System administrators should not normally invoke it directly.
Commands:
start_northd start ovn-northd
start_ovsdb start ovn related ovsdb-server processes
start_nb_ovsdb start ovn northbound db ovsdb-server process
start_sb_ovsdb start ovn southbound db ovsdb-server process
start_controller start ovn-controller
start_controller_vtep start ovn-controller-vtep
stop_northd stop ovn-northd
stop_ovsdb stop ovn related ovsdb-server processes
stop_nb_ovsdb stop ovn northbound db ovsdb-server process
stop_sb_ovsdb stop ovn southbound db ovsdb-server process
stop_controller stop ovn-controller
stop_controller_vtep stop ovn-controller-vtep
restart_northd restart ovn-northd
restart_ovsdb restart ovn related ovsdb-server processes
restart_nb_ovsdb restart ovn northbound db ovsdb-server process
restart_sb_ovsdb restart ovn southbound db ovsdb-server process
restart_controller restart ovn-controller
restart_controller_vtep restart ovn-controller-vtep
run_nb_ovsdb run ovn northbound db ovsdb-server process
run_sb_ovsdb run ovn southbound db ovsdb-server process
Options:
--ovn-northd-priority=NICE set ovn-northd's niceness (default: $OVN_NORTHD_PRIORITY)
--ovn-northd-wrapper=WRAPPER run with a wrapper like valgrind for debugging
--ovn-controller-priority=NICE set ovn-controller's niceness (default: $OVN_CONTROLLER_PRIORITY)
--ovn-controller-wrapper=WRAPPER run with a wrapper like valgrind for debugging
--ovn-controller-ssl-key=KEY OVN Southbound SSL private key file
--ovn-controller-ssl-cert=CERT OVN Southbound SSL certificate file
--ovn-controller-ssl-ca-cert=CERT OVN Southbound SSL CA certificate file
--ovn-controller-ssl-bootstrap-ca-cert=CERT Bootstrapped OVN Southbound SSL CA certificate file
--ovn-manage-ovsdb=yes|no Whether or not the OVN databases should be
automatically started and stopped along
with ovn-northd. The default is "yes". If
this is set to "no", the "start_ovsdb" and
"stop_ovsdb" commands must be used to start
and stop the OVN databases.
--ovn-controller-log=STRING ovn controller process logging params (default: $OVN_CONTROLLER_LOG)
--ovn-northd-log=STRING ovn northd process logging params (default: $OVN_NORTHD_LOG)
--ovn-northd-logfile=STRING ovn northd process log file (default: $OVN_NORTHD_LOGFILE)
--ovn-nb-log=STRING ovn NB ovsdb-server processes logging params (default: $OVN_NB_LOG)
--ovn-sb-log=STRING ovn SB ovsdb-server processes logging params (default: $OVN_SB_LOG)
-h, --help display this help message
File location options:
--db-sock=SOCKET JSON-RPC socket name (default: $DB_SOCK)
--db-nb-file=FILE OVN_Northbound db file (default: $DB_NB_FILE)
--db-sb-file=FILE OVN_Southbound db file (default: $DB_SB_FILE)
--db-nb-schema=FILE OVN_Northbound db file (default: $DB_NB_SCHEMA)
--db-sb-schema=FILE OVN_Southbound db file (default: $DB_SB_SCHEMA)
--db-nb-addr=ADDR OVN Northbound db ptcp address (default: $DB_NB_ADDR)
--db-nb-port=PORT OVN Northbound db ptcp port (default: $DB_NB_PORT)
--db-sb-addr=ADDR OVN Southbound db ptcp address (default: $DB_SB_ADDR)
--db-sb-port=PORT OVN Southbound db ptcp port (default: $DB_SB_PORT)
--ovn-nb-logfile=FILE OVN Northbound log file (default: $OVN_NB_LOGFILE)
--ovn-sb-logfile=FILE OVN Southbound log file (default: $OVN_SB_LOGFILE)
--db-nb-sync-from-addr=ADDR OVN Northbound active db tcp address (default: $DB_NB_SYNC_FROM_ADDR)
--db-nb-sync-from-port=PORT OVN Northbound active db tcp port (default: $DB_NB_SYNC_FROM_PORT)
--db-nb-sync-from-proto=PROTO OVN Northbound active db transport (default: $DB_NB_SYNC_FROM_PROTO)
--db-nb-create-insecure-remote=yes|no Create ptcp OVN Northbound remote (default: $DB_NB_CREATE_INSECURE_REMOTE)
--db-sb-sync-from-addr=ADDR OVN Southbound active db tcp address (default: $DB_SB_SYNC_FROM_ADDR)
--db-sb-sync-from-port=ADDR OVN Southbound active db tcp port (default: $DB_SB_SYNC_FROM_PORT)
--db-sb-sync-from-proto=PROTO OVN Southbound active db transport (default: $DB_SB_SYNC_FROM_PROTO)
--db-sb-create-insecure-remote=yes|no Create ptcp OVN Southbound remote (default: $DB_SB_CREATE_INSECURE_REMOTE)
Default directories with "configure" option and environment variable override:
logs: /usr/local/var/log/openvswitch (--with-logdir, OVS_LOGDIR)
pidfiles and sockets: /usr/local/var/run/openvswitch (--with-rundir, OVS_RUNDIR)
ovn-nb.db: /usr/local/etc/openvswitch (--with-dbdir, OVS_DBDIR)
ovn-sb.db: /usr/local/etc/openvswitch (--with-dbdir, OVS_DBDIR)
system configuration: /usr/local/etc (--sysconfdir, OVS_SYSCONFDIR)
data files: /usr/local/share/openvswitch (--pkgdatadir, OVS_PKGDATADIR)
user binaries: /usr/local/bin (--bindir, OVS_BINDIR)
system binaries: /usr/local/sbin (--sbindir, OVS_SBINDIR)
EOF
}
set_defaults
command=
for arg
do
case $arg in
-h | --help)
usage
;;
--[a-z]*=*)
option=`expr X"$arg" : 'X--\([^=]*\)'`
value=`expr X"$arg" : 'X[^=]*=\(.*\)'`
type=string
set_option
;;
--no-[a-z]*)
option=`expr X"$arg" : 'X--no-\(.*\)'`
value=no
type=bool
set_option
;;
--[a-z]*)
option=`expr X"$arg" : 'X--\(.*\)'`
value=yes
type=bool
set_option
;;
-*)
echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
exit 1
;;
*)
if test X"$command" = X; then
command=$arg
else
echo >&2 "$0: exactly one non-option argument required (use --help for help)"
exit 1
fi
;;
esac
done
case $command in
start_northd)
start_northd
;;
start_ovsdb)
start_ovsdb
;;
start_nb_ovsdb)
start_nb_ovsdb
;;
start_sb_ovsdb)
start_sb_ovsdb
;;
start_controller)
start_controller
;;
start_controller_vtep)
start_controller_vtep
;;
stop_northd)
stop_northd
;;
stop_ovsdb)
stop_ovsdb
;;
stop_nb_ovsdb)
stop_nb_ovsdb
;;
stop_sb_ovsdb)
stop_sb_ovsdb
;;
stop_controller)
stop_controller
;;
stop_controller)
stop_controller
;;
stop_controller_vtep)
stop_controller_vtep
;;
restart_northd)
restart_northd
;;
restart_ovsdb)
restart_ovsdb
;;
restart_nb_ovsdb)
restart_nb_ovsdb
;;
restart_sb_ovsdb)
restart_sb_ovsdb
;;
restart_controller)
restart_controller
;;
restart_controller_vtep)
restart_controller_vtep
;;
status_northd)
daemon_status ovn-northd || exit 1
;;
status_ovsdb)
status_ovsdb
;;
status_controller)
daemon_status ovn-controller || exit 1
;;
status_controller_vtep)
daemon_status ovn-controller-vtep || exit 1
;;
promote_ovnnb)
promote_ovnnb
;;
promote_ovnsb)
promote_ovnsb
;;
demote_ovnnb)
demote_ovnnb
;;
demote_ovnsb)
demote_ovnsb
;;
status_ovnnb)
status_ovnnb
;;
status_ovnsb)
status_ovnsb
;;
run_nb_ovsdb)
run_nb_ovsdb
;;
run_sb_ovsdb)
run_sb_ovsdb
;;
help)
usage
;;
preheat)
echo >&2 "$0: preheating ovn to 350 degrees F."
exit 1
;;
'')
echo >&2 "$0: missing command name (use --help for help)"
exit 1
;;
*)
echo >&2 "$0: unknown command \"$command\" (use --help for help)"
exit 1
;;
esac
|