[ovs-dev] [PATCH] debian: Add an upstart job file

Andrew James andrew.james at hp.com
Thu Jul 24 21:14:02 UTC 2014


This adds the upstart job configuration file written by James Page from
Ubuntu's openvswitch-2.0.1+git20140120 package plus the changes proposed in
https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/1314888

Signed-off-by: Andrew James <andrew.james at hp.com>
---
   debian/openvswitch-switch.upstart | 47 +++++++++++++++++++++++++++++++++++++++
   1 file changed, 47 insertions(+)
   create mode 100644 debian/openvswitch-switch.upstart

diff --git a/debian/openvswitch-switch.upstart b/debian/openvswitch-switch.upstart
new file mode 100644
index 0000000..d7a8978
--- /dev/null
+++ b/debian/openvswitch-switch.upstart
@@ -0,0 +1,47 @@
+# vim: set ft=upstart ts=2 et:
+description "Open vSwitch switch"
+author "James Page <james.page at ubuntu.com>"
+
+emits ovs-up
+emits ovs-pre-down
+
+start on (local-filesystems and net-device-up IFACE=lo)
+stop on runlevel [!2345]
+
+pre-start script
+  (test -x /usr/sbin/ovs-vswitchd && test -x /usr/sbin/ovsdb-server) || exit 0
+
+  . /usr/share/openvswitch/scripts/ovs-lib
+  test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
+
+  if ovs_ctl load-kmod; then
+    :
+  else
+    echo "Module has probably not been built for this kernel."
+    if ! test -d /usr/share/doc/openvswitch-datapath-dkms; then
+      echo "Install the openvswitch-datapath-dkms package."
+    fi
+
+    if test X"$OVS_MISSING_KMOD_OK" = Xyes; then
+      # We're being invoked by the package postinst.  Do not
+      # fail package installation just because the kernel module
+      # is not available.
+      exit 0
+    fi
+  fi
+  set ovs_ctl start --system-id=random
+  if test X"$FORCE_COREFILES" != X; then
+    set "$@" --force-corefiles="$FORCE_COREFILES"
+  fi
+  set "$@" $OVS_CTL_OPTS
+  "$@" || exit $?
+  initctl emit ovs-up
+end script
+
+post-stop script
+  . /usr/share/openvswitch/scripts/ovs-lib
+  test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
+
+  initctl emit ovs-pre-down
+  ovs_ctl stop
+end script
-- 
2.0.1





More information about the dev mailing list