From: Keith Amidon Date: Tue, 14 Apr 2009 23:41:17 +0000 (-0700) Subject: Be more conservative about bringing up interfaces when vswitchd started X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a0032405b0765343bcfefdb24fc5848d454c243;p=openvswitch Be more conservative about bringing up interfaces when vswitchd started Previously we were starting all bridge interfaces when vswitchd started to help resolve issues in Xen environemnts. However, only starting the management interface seems to be required. The information about which interface is the management interface is available in /etc/xensource-inventory on Xen machines, so use that to limit the interfaces we bring up. --- diff --git a/vswitchd/etc/init.d/vswitch b/vswitchd/etc/init.d/vswitch index c6614721..8b7d53da 100755 --- a/vswitchd/etc/init.d/vswitch +++ b/vswitchd/etc/init.d/vswitch @@ -8,6 +8,11 @@ . /etc/init.d/functions +MANAGEMENT_INTERFACE="" +if [ -f /etc/xensource-inventory ]; then + . /etc/xensource-inventory +fi + test -e /etc/sysconfig/vswitch && . /etc/sysconfig/vswitch VSWITCH_BASE="${VSWITCH_BASE:-/root/vswitch}" VSWITCHD_CONF="${VSWITCHD_CONF:-/etc/vswitchd.conf}" @@ -76,15 +81,23 @@ function start { valgrind_opt="valgrind --log-file=$VALGRIND_LOG $VALGRIND_OPT" daemonize_opt="" fi - #[ "$1" = "update-modules" ] || [ "$1" = "restart" ] || clear_old_bridge_ports action "Starting vswitchd" nice -n "$VSWITCHD_PRIORITY" $strace_opt $valgrind_opt $VSWITCH_BASE/sbin/vswitchd -P"$VSWITCHD_PIDFILE" $daemonize_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_CONF" - # Always attempt to force bridge interfaces up because otherwise - # vswitch and XAPI interact badly on startup sleep 2 # Give time for vswitch to get up and running. - for dp in $(dp_list); do + # In Xen environments, always attempt to force the management + # bridge interface up because otherwise vswitch and XAPI interact + # badly on startup. + if [ -n "$MANAGEMENT_INTERFACE" ] && [ -e "/etc/sysconfig/network-scripts/ifcfg-$MANAGEMENT_INTERFACE" ]; then + action "Bringing up management interface: $MANAGEMENT_INTERFACE" ifup "$MANAGEMENT_INTERFACE" + fi + # When attempting to restart or update modules online, bring up + # all bridge interfaces since presumably they were in use before + # we went down. + for dp in $(dp_list); do local intf=$(dp_intf $dp) if [ -e "/etc/sysconfig/network-scripts/ifcfg-$intf" ]; then - action "Bringing up datapath interface: $intf" ifup "$intf" + if [ "$1" == "update-modules" ]; then + action "Bringing up datapath interface: $intf" ifup "$intf" + fi fi done }