X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=xenserver%2Fetc_init.d_vswitch;h=789ec7398decfed839d9388d8a6601b301d04340;hb=6f61c75b17a9906f88aae4b4a8fbdc12070cf34f;hp=10625289fa4d0e7119e5fd9d92927856c21fc8bc;hpb=70feacd5320c141c6f81d9557c0e608326b4d169;p=openvswitch diff --git a/xenserver/etc_init.d_vswitch b/xenserver/etc_init.d_vswitch index 10625289..789ec739 100755 --- a/xenserver/etc_init.d_vswitch +++ b/xenserver/etc_init.d_vswitch @@ -5,7 +5,7 @@ # chkconfig: 2345 09 91 # description: Manage vswitch kernel modules and user-space daemon -# Copyright (C) 2009 Nicira Networks, Inc. +# Copyright (C) 2009, 2010 Nicira Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,8 +29,7 @@ test -e /etc/sysconfig/vswitch && . /etc/sysconfig/vswitch : ${FORCE_COREFILES:=y} # Config variables specific to ovsdb-server -: ${OVSDB_SERVER_LISTEN:=punix:/var/run/ovsdb-server} -: ${OVSDB_SERVER_CONNECT:=} +: ${OVSDB_SERVER_REMOTES:=punix:/var/run/ovsdb-server db:Open_vSwitch,managers} : ${OVSDB_SERVER_DB:=/etc/ovs-vswitchd.conf.db} : ${OVSDB_SERVER_PIDFILE:=/var/run/ovsdb-server.pid} : ${OVSDB_SERVER_RUN_DIR:=/var/xen/vswitch} @@ -129,18 +128,6 @@ function remove_modules { fi } -function reload_vswitchd { - if [ -f "$VSWITCHD_PIDFILE" ]; then - "$appctl" --target=/var/run/ovs-vswitchd.`cat $VSWITCHD_PIDFILE`.ctl vswitchd/reload - fi -} - -function reload_brcompatd { - if [ -f "$BRCOMPATD_PIDFILE" ]; then - "$appctl" --target=/var/run/ovs-brcompatd.`cat $BRCOMPATD_PIDFILE`.ctl vlog/reopen - fi -} - function start_ovsdb_server { local syslog_opt="-vANY:SYSLOG:${OVSDB_SERVER_SYSLOG_LOGLEVEL}" local logfile_file_opt="" @@ -149,14 +136,10 @@ function start_ovsdb_server { mkdir -p "$OVSDB_SERVER_RUN_DIR" fi cd "$OVSDB_SERVER_RUN_DIR" - local listen_method="" - if [ -n "$OVSDB_SERVER_LISTEN" ]; then - listen_method="--listen=$OVSDB_SERVER_LISTEN" - fi - local connect_method="" - if [ -n "$OVSDB_SERVER_CONNECT" ]; then - connect_method="--connect=$OVSDB_SERVER_CONNECT" - fi + local remotes= + for remote in "$OVSDB_SERVER_REMOTES"; do + remotes="$remotes --remote=$OVSDB_SERVER_REMOTES" + done if [ -n "$OVSDB_SERVER_FILE_LOGLEVEL" ]; then logfile_level_opt="-vANY:FILE:${OVSDB_SERVER_FILE_LOGLEVEL}" logfile_file_opt="--log-file=$OVSDB_SERVER_LOGFILE" @@ -185,9 +168,9 @@ function start_ovsdb_server { if [ "$daemonize" != "y" ]; then # Start in background and force a "success" message action "Starting ovsdb_server ($strace_opt$valgrind_opt)" true - (nice -n "$OVSDB_SERVER_PRIORITY" $strace_opt $valgrind_opt "$ovsdb_server" "$OVSDB_SERVER_DB" --pidfile="$OVSDB_SERVER_PIDFILE" --detach --no-chdir -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $connect_method $listen_method) & + (nice -n "$OVSDB_SERVER_PRIORITY" $strace_opt $valgrind_opt "$ovsdb_server" "$OVSDB_SERVER_DB" --pidfile="$OVSDB_SERVER_PIDFILE" --detach --no-chdir -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $remotes) & else - action "Starting ovsdb-server" nice -n "$OVSDB_SERVER_PRIORITY" "$ovsdb_server" "$OVSDB_SERVER_DB" --pidfile="$OVSDB_SERVER_PIDFILE" --detach --no-chdir -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $connect_method $listen_method + action "Starting ovsdb-server" nice -n "$OVSDB_SERVER_PRIORITY" "$ovsdb_server" "$OVSDB_SERVER_DB" --pidfile="$OVSDB_SERVER_PIDFILE" --detach --no-chdir -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $remotes fi } @@ -315,8 +298,6 @@ WARNING!!! Restarting vswitch on a live server is not guaranteed to work. It is provided as a convenience for those situations in which it does work. -If you just want to reload the configuration file, use "reload" -instead of restart. EOF read -s -r -n 1 -p "Countinue with restart (y/N): " response @@ -347,11 +328,13 @@ function start { if [ ! -e "$OVSDB_SERVER_DB" ]; then warning "$OVSDB_SERVER_DB does not exist" - action "Creating empty $OVSDB_SERVER_DB" $ovsdb_tool create "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA" - action "Creating initial table in $OVSDB_SERVER_DB" $ovsdb_tool transact "$OVSDB_SERVER_DB" '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' + + action "Creating empty database $OVSDB_SERVER_DB" true + $ovsdb_tool -vANY:console:emer create "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA" fi start_ovsdb_server + $vsctl --no-wait init if [ ! -e /var/run/vswitch.booted ]; then touch /var/run/vswitch.booted for bridge in $($vsctl list-br); do @@ -361,7 +344,6 @@ function start { start_vswitchd start_brcompatd - reload_vswitchd # ensures ovs-vswitchd has fully read config. touch /var/lock/subsys/vswitch } @@ -389,10 +371,6 @@ case "$1" in restart) restart ;; - reload) - reload_vswitchd - reload_brcompatd - ;; strace-vswitchd) shift strace -p $(cat "$VSWITCHD_PIDFILE") "$@" @@ -412,7 +390,7 @@ case "$1" in /usr/sbin/ovs-brcompatd -V ;; help) - printf "vswitch [start|stop|restart|reload|unload|status|version]\n" + printf "vswitch [start|stop|restart|unload|status|version]\n" ;; *) printf "Unknown command: $1\n"