This can be useful for upgrades when there's no time for a reboot.
This is essentially cut-and-paste of the version already in
xenserver/etc_init.d_openvswitch with a few adaptations for Debian.
This code probably won't last very long, because I am separately working
on refactoring the multiple initscripts into a single version plus simple
distro-specific wrappers.
Tested slightly on my own host (which runs Debian "sid").
Bug #5167.
---
debian/control | 1 +
debian/openvswitch-switch.init | 48 +++++++++++++++++++++++++++++++++++++
debian/openvswitch-switch.install | 1 +
3 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/debian/control b/debian/control
index 41db244..b996b2b 100644
--- a/debian/control
+++ b/debian/control
@@ -37,6 +37,7 @@ Package: openvswitch-switch
Architecture: linux-any
Suggests: openvswitch-datapath-module
Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends},
openvswitch-common (= ${binary:Version}), module-init-tools, procps
+Recommends: iproute, iptables
Description: Open vSwitch switch implementation
openvswitch-switch provides the userspace components and utilities for
the Open vSwitch switch.
diff --git a/debian/openvswitch-switch.init b/debian/openvswitch-switch.init
index 8ea5866..ccdc0ee 100755
--- a/debian/openvswitch-switch.init
+++ b/debian/openvswitch-switch.init
@@ -210,6 +210,51 @@ set_system_info() {
fi
}
+function internal_interfaces {
+ # Outputs a list of internal interfaces:
+ #
+ # - There is an internal interface for every bridge, whether it has
+ # an Interface record or not and whether the Interface record's
+ # 'type' is properly set.
+ #
+ # - There is an internal interface for each Interface record whose
+ # 'type' is 'internal'.
+ #
+ # But ignore interfaces that don't really exist.
+ for d in `(ovs-vsctl --bare \
+ -- --columns=name find Interface type=internal \
+ -- list-br) | sort -u`
+ do
+ if test -e "/sys/class/net/$d"; then
+ printf "%s " "$d"
+ fi
+ done
+}
+
+SELF=$0
+function force_reload_kmod {
+ ifaces=$(internal_interfaces)
+ echo "Configured internal interfaces: $ifaces."
+
+ "$SELF" stop
+
+ script=$(mktemp)
+ echo "Saving interface configuration to $script."
+ if ! /usr/share/openvswitch/scripts/ovs-save $ifaces > "$script"; then
+ echo "Failed to save configuration, not replacing kernel module"
+ "$SELF" start
+ exit 1
+ fi
+ chmod +x "$script"
+
+ unload_modules
+
+ "$SELF" start
+
+ echo "Restoring interface configuration from $script."
+ "$script"
+}
+
case "$1" in
start)
conf_file=/etc/openvswitch/conf.db
@@ -368,6 +413,9 @@ case "$1" in
fi
done
;;
+ force-reload-kmod)
+ force_reload_kmod
+ ;;
*)
N=/etc/init.d/openvswitch-switch
echo "Usage: $N
{start|stop|restart|force-reload|status|force-stop|unload}" >&2
diff --git a/debian/openvswitch-switch.install
b/debian/openvswitch-switch.install
index 088b860..f0f748f 100644
--- a/debian/openvswitch-switch.install
+++ b/debian/openvswitch-switch.install
@@ -5,3 +5,4 @@ _debian/utilities/ovs-pcap usr/bin
_debian/utilities/ovs-tcpundump usr/bin
_debian/utilities/ovs-vlan-test usr/bin
_debian/vswitchd/ovs-vswitchd usr/sbin
+utilities/ovs-save usr/share/openvswitch/scripts
--
1.7.4.4
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev