[openvswitch] Auto-start openvswitch service on ifup/ifdown (#818754)

Thomas Graf tgraf at fedoraproject.org
Fri Jan 25 16:48:02 UTC 2013


commit 6262ced9498b48cf8289391e6f48bcd813ccc9d6
Author: Thomas Graf <tgraf at redhat.com>
Date:   Fri Jan 25 17:40:15 2013 +0100

    Auto-start openvswitch service on ifup/ifdown (#818754)
    
    Also adds OVSREQUIRES to allow defining OpenFlow interface
    dependencies

 ifdown-ovs       |    2 ++
 ifup-ovs         |   21 +++++++++++++++++++++
 openvswitch.spec |    8 ++++++--
 3 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/ifdown-ovs b/ifdown-ovs
index 19047d8..d2a2f4b 100644
--- a/ifdown-ovs
+++ b/ifdown-ovs
@@ -34,6 +34,8 @@ if [ ! -x ${OTHERSCRIPT} ]; then
     OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth"
 fi
 
+[ -f /var/lock/subsys/openvswitch ] || /sbin/service openvswitch start
+
 case "$TYPE" in
 	OVSBridge)
 		${OTHERSCRIPT} ${CONFIG} $2
diff --git a/ifup-ovs b/ifup-ovs
index c427879..dcf90e4 100644
--- a/ifup-ovs
+++ b/ifup-ovs
@@ -34,6 +34,27 @@ if [ ! -x ${OTHERSCRIPT} ]; then
 	OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-eth"
 fi
 
+check_recursion()
+{
+	[ -n "${UPPEDSTACK}" ] && for _r in ${UPPEDSTACK}; do
+		[ "$_r" = "$1" ] && return 1
+	done
+
+	return 0
+}
+
+if [ -z "${UPPEDSTACK}" ]; then
+	UPPEDSTACK="${DEVICE}"
+fi
+
+[ -n "${OVSREQUIRES}" ] && for _i in ${OVSREQUIRES}; do
+	if ( check_recursion "$_i" ); then
+		UPPEDSTACK="${UPPEDSTACK} $_i" /sbin/ifup "$_i"
+	fi
+done
+
+[ -f /var/lock/subsys/openvswitch ] || /sbin/service openvswitch start
+
 case "$TYPE" in
 	OVSBridge)
 		ovs-vsctl -t ${TIMEOUT} -- --may-exist add-br "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
diff --git a/openvswitch.spec b/openvswitch.spec
index 2837fcf..6e20687 100644
--- a/openvswitch.spec
+++ b/openvswitch.spec
@@ -1,6 +1,6 @@
 Name:           openvswitch
 Version:        1.7.3
-Release:        6%{?dist}
+Release:        7%{?dist}
 Summary:        Open vSwitch daemon/database/utilities
 
 # Nearly all of openvswitch is ASL 2.0.  The bugtool is LGPLv2+, and the
@@ -205,7 +205,11 @@ desktop-file-install --dir=$RPM_BUILD_ROOT%{_datadir}/applications %{SOURCE6}
 
 
 %changelog
-* Thu Jan 24 2013 Thomas Graf <tgraf at redhat.com> - 1.7.3-1
+* Fri Jan 25 2013 Thomas Graf <tgraf at redhat.com> - 1.7.3-7
+- Auto-start openvswitch service on ifup/ifdown (#818754)
+- Add OVSREQUIRES to allow defining OpenFlow interface dependencies
+
+* Thu Jan 24 2013 Thomas Graf <tgraf at redhat.com> - 1.7.3-6
 - Update to Open vSwitch 1.7.3
 
 * Tue Nov 20 2012 Thomas Graf <tgraf at redhat.com> - 1.7.1-6


More information about the scm-commits mailing list