Blame SOURCES/bz1160365-iface-vlan.patch.patch

261ad6
From 0305c97abc49d0f7a93b3602a745805f7e8776d3 Mon Sep 17 00:00:00 2001
261ad6
From: David Vossel <dvossel@redhat.com>
261ad6
Date: Thu, 25 Jun 2015 16:23:45 -0500
261ad6
Subject: [PATCH 1/3] bz1160365-iface-vlan.patch
261ad6
261ad6
---
261ad6
 doc/man/Makefile.am   |   1 +
261ad6
 heartbeat/Makefile.am |   1 +
261ad6
 heartbeat/iface-vlan  | 475 ++++++++++++++++++++++++++++++++++++++++++++++++++
261ad6
 3 files changed, 477 insertions(+)
261ad6
 create mode 100755 heartbeat/iface-vlan
261ad6
261ad6
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
261ad6
index 653e818..091ec24 100644
261ad6
--- a/doc/man/Makefile.am
261ad6
+++ b/doc/man/Makefile.am
261ad6
@@ -107,6 +107,7 @@ man_MANS	       = ocf_heartbeat_AoEtarget.7 \
261ad6
                           ocf_heartbeat_iSCSILogicalUnit.7 \
261ad6
                           ocf_heartbeat_iSCSITarget.7 \
261ad6
                           ocf_heartbeat_ids.7 \
261ad6
+                          ocf_heartbeat_iface-vlan.7 \
261ad6
                           ocf_heartbeat_iscsi.7 \
261ad6
                           ocf_heartbeat_jboss.7 \
261ad6
                           ocf_heartbeat_lxc.7 \
261ad6
diff --git a/heartbeat/Makefile.am b/heartbeat/Makefile.am
261ad6
index e4ed4fd..6df4080 100644
261ad6
--- a/heartbeat/Makefile.am
261ad6
+++ b/heartbeat/Makefile.am
261ad6
@@ -76,6 +76,7 @@ ocf_SCRIPTS	     =  ClusterMon		\
261ad6
 			fio			\
261ad6
 			galera			\
261ad6
 			ids			\
261ad6
+			iface-vlan		\
261ad6
 			iscsi			\
261ad6
 			ICP			\
261ad6
 			IPsrcaddr		\
261ad6
diff --git a/heartbeat/iface-vlan b/heartbeat/iface-vlan
261ad6
new file mode 100755
261ad6
index 0000000..bc8583c
261ad6
--- /dev/null
261ad6
+++ b/heartbeat/iface-vlan
261ad6
@@ -0,0 +1,475 @@
261ad6
+#!/bin/sh
261ad6
+#
261ad6
+#       OCF Resource Agent compliant iface-vlan script.
261ad6
+#
261ad6
+#       Implements network VLAN interface management
261ad6
+#
261ad6
+# Copyright (C) 2013 Red Hat, Inc.  All rights reserved.
261ad6
+# Author: Fabio M. Di Nitto <fdinitto@redhat.com>
261ad6
+#
261ad6
+# This program is free software; you can redistribute it and/or modify
261ad6
+# it under the terms of version 2 of the GNU General Public License as
261ad6
+# published by the Free Software Foundation.
261ad6
+#
261ad6
+# This program is distributed in the hope that it would be useful, but
261ad6
+# WITHOUT ANY WARRANTY; without even the implied warranty of
261ad6
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
261ad6
+#
261ad6
+# Further, this software is distributed without any warranty that it is
261ad6
+# free of the rightful claim of any third person regarding infringement
261ad6
+# or the like.  Any license provided herein, whether implied or
261ad6
+# otherwise, applies only to this software file.  Patent licenses, if
261ad6
+# any, provided herein do not apply to combinations of this program with
261ad6
+# other software, or any other product whatsoever.
261ad6
+#
261ad6
+# You should have received a copy of the GNU General Public License
261ad6
+# along with this program; if not, write the Free Software Foundation,
261ad6
+# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
261ad6
+#
261ad6
+#
261ad6
+
261ad6
+# TODO:
261ad6
+#
261ad6
+#	OCF parameters are as below
261ad6
+#       OCF_RESKEY_vlan_interface
261ad6
+#       OCF_RESKEY_vlan_id
261ad6
+#	OCF_RESKEY_vlan_name
261ad6
+#       OCF_RESKEY_vlan_reorder_hdr
261ad6
+#       OCF_RESKEY_vlan_gvrp
261ad6
+#       OCF_RESKEY_vlan_mvrp
261ad6
+#       OCF_RESKEY_vlan_loose_binding
261ad6
+#
261ad6
+
261ad6
+#######################################################################
261ad6
+# Initialization:
261ad6
+
261ad6
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
261ad6
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
261ad6
+
261ad6
+# Defaults
261ad6
+OCF_RESKEY_vlan_reorder_hdr_default=1
261ad6
+OCF_RESKEY_vlan_gvrp_default=0
261ad6
+OCF_RESKEY_vlan_mvrp_default=0
261ad6
+OCF_RESKEY_vlan_loose_binding_default=0
261ad6
+OCF_RESKEY_vlan_name_default=${OCF_RESKEY_vlan_interface}.${OCF_RESKEY_vlan_id}
261ad6
+
261ad6
+: ${OCF_RESKEY_vlan_name=${OCF_RESKEY_vlan_name_default}}
261ad6
+: ${OCF_RESKEY_vlan_reorder_hdr=${OCF_RESKEY_vlan_reorder_hdr_default}}
261ad6
+: ${OCF_RESKEY_vlan_gvrp=${OCF_RESKEY_vlan_gvrp_default}}
261ad6
+
261ad6
+# don't set defaults for mvrp or loose binding since both
261ad6
+# are rather new kernel features and they might not be supported
261ad6
+#: ${OCF_RESKEY_vlan_mvrp=${OCF_RESKEY_vlan_mvrp_default}}
261ad6
+#: ${OCF_RESKEY_vlan_loose_binding=${OCF_RESKEY_vlan_loose_binding_default}}
261ad6
+
261ad6
+#######################################################################
261ad6
+
261ad6
+vlan_usage() {
261ad6
+	cat <
261ad6
+usage: $0 {start|stop|status|monitor|validate-all|meta-data}
261ad6
+
261ad6
+Expects to have a fully populated OCF RA-compliant environment set.
261ad6
+END
261ad6
+}
261ad6
+
261ad6
+vlan_meta_data() {
261ad6
+	cat <
261ad6
+
261ad6
+
261ad6
+<resource-agent name="iface-vlan">
261ad6
+  <version>1.0</version>
261ad6
+
261ad6
+  <longdesc lang="en">
261ad6
+    This resource manages VLAN network interfaces.
261ad6
+    It can add, remove, configure VLANs.
261ad6
+  </longdesc>
261ad6
+
261ad6
+  <shortdesc lang="en">
261ad6
+    Manages VLAN network interfaces.
261ad6
+  </shortdesc>
261ad6
+
261ad6
+  <parameters>
261ad6
+    <parameter name="vlan_interface" unique="1" required="1">
261ad6
+      <longdesc lang="en">
261ad6
+        Define the interface where VLAN should be attached.
261ad6
+      </longdesc>
261ad6
+      <shortdesc lang="en">
261ad6
+        Network interface.
261ad6
+      </shortdesc>
261ad6
+      <content type="string"/>
261ad6
+    </parameter>
261ad6
+
261ad6
+    <parameter name="vlan_id" unique="1" required="1">
261ad6
+      <longdesc lang="en">
261ad6
+        Define the VLAN ID. It has to be a value between 0 and 4094.
261ad6
+      </longdesc>
261ad6
+      <shortdesc lang="en">
261ad6
+        Define the VLAN ID.
261ad6
+      </shortdesc>
261ad6
+      <content type="integer"/>
261ad6
+    </parameter>
261ad6
+
261ad6
+    <parameter name="vlan_name" unique="1">
261ad6
+      <longdesc lang="en">
261ad6
+        Define the name of the VLAN interface (max 15 charaters).
261ad6
+      </longdesc>
261ad6
+      <shortdesc lang="en">
261ad6
+        Name of the VLAN.
261ad6
+      </shortdesc>
261ad6
+      <content type="string" default="vlan_interface.vlan.id" />
261ad6
+    </parameter>
261ad6
+
261ad6
+    <parameter name="vlan_reorder_hdr" unique="0">
261ad6
+      <longdesc lang="en">
261ad6
+        Enable or disable header reordering.
261ad6
+      </longdesc>
261ad6
+      <shortdesc lang="en">
261ad6
+        Enable or disable header reordering.
261ad6
+      </shortdesc>
261ad6
+      <content type="boolean" default="${OCF_RESKEY_vlan_reorder_hdr_default}"/>
261ad6
+    </parameter>
261ad6
+
261ad6
+    <parameter name="vlan_gvrp" unique="0">
261ad6
+      <longdesc lang="en">
261ad6
+        Enable or disable GARP VLAN registration protocol.
261ad6
+      </longdesc>
261ad6
+      <shortdesc lang="en">
261ad6
+        Enable or disable gvrp.
261ad6
+      </shortdesc>
261ad6
+      <content type="boolean" default="${OCF_RESKEY_vlan_gvrp_default}"/>
261ad6
+    </parameter>
261ad6
+
261ad6
+    <parameter name="vlan_mvrp" unique="0">
261ad6
+      <longdesc lang="en">
261ad6
+        Enable or disable Multiple VLAN Registration Protocol.
261ad6
+        Please note that most distributions do not ship a version of iproute2
261ad6
+        that supports mvrp yet, even if the kernel has support for it.
261ad6
+        Check output of $IPADDR2 link add type vlan --help in the FLAG
261ad6
+        section to verify if mvrp support is available.
261ad6
+      </longdesc>
261ad6
+      <shortdesc lang="en">
261ad6
+        Enable or disable mvrp.
261ad6
+      </shortdesc>
261ad6
+      <content type="boolean" default="${OCF_RESKEY_vlan_mvrp_default}"/>
261ad6
+    </parameter>
261ad6
+
261ad6
+    <parameter name="vlan_loose_binding" unique="0">
261ad6
+      <longdesc lang="en">
261ad6
+        Enable or disable VLAN loose bind. By default the VLAN interface
261ad6
+        admin status (UP/DOWN) follows the underneath inteface status.
261ad6
+        Enabling loose bind allows the VLAN to disconnect from the
261ad6
+        interface status. Be very careful that enabling loose binding
261ad6
+        could invalidate this agent monitor operations.
261ad6
+        Please note that most distributions do not ship a version of iproute2
261ad6
+        that supports loose_binding yet, even if the kernel has support for it.
261ad6
+        Check output of $IPADDR2 link add type vlan --help in the FLAG
261ad6
+        section to verify if loose_binding support is available.
261ad6
+      </longdesc>
261ad6
+      <shortdesc lang="en">
261ad6
+        Enable or disable loose binding.
261ad6
+      </shortdesc>
261ad6
+      <content type="boolean" default="${OCF_RESKEY_vlan_loose_binding_default}"/>
261ad6
+    </parameter>
261ad6
+  </parameters>
261ad6
+
261ad6
+  <actions>
261ad6
+    <action name="start"        timeout="30s" />
261ad6
+    <action name="stop"         timeout="20s" />
261ad6
+    <action name="status"       timeout="20s" depth="0" interval="10s" />
261ad6
+    <action name="monitor"      timeout="20s" depth="0" interval="10s" />
261ad6
+    <action name="meta-data"    timeout="5s" />
261ad6
+    <action name="validate-all" timeout="20s" />
261ad6
+  </actions>
261ad6
+</resource-agent>
261ad6
+END
261ad6
+}
261ad6
+
261ad6
+# check if the interface is admin up/down
261ad6
+
261ad6
+iface_is_up() {
261ad6
+	if ! $IP2UTIL -o link show $1 | \
261ad6
+	    sed -e 's#.*<##g' -e 's#>.*##' -e 's#LOWER_UP##g' | \
261ad6
+	    grep -q UP; then
261ad6
+		return 1
261ad6
+	fi
261ad6
+	return 0
261ad6
+}
261ad6
+
261ad6
+# check if the slaves have link layer up/down
261ad6
+# see kernel network documentation on meaning of LOWER_UP flag
261ad6
+# for more in depth explanation on how it works
261ad6
+# NOTE: this check is not reliable in virt environment
261ad6
+# since interfaces are always LOWER_UP. There is no way
261ad6
+# from the guest to know if the host has disconnected somehow
261ad6
+
261ad6
+iface_lower_is_up() {
261ad6
+	if ! $IP2UTIL -o link show $1 | \
261ad6
+	    grep -q LOWER_UP; then
261ad6
+		return 1
261ad6
+	fi
261ad6
+	return 0
261ad6
+}
261ad6
+
261ad6
+vlan_validate() {
261ad6
+	check_binary $IP2UTIL
261ad6
+
261ad6
+	if [ -z "$OCF_RESKEY_vlan_interface" ]; then
261ad6
+		ocf_log err "Invalid OCF_RESKEY_vlan_interface: value cannot be empty"
261ad6
+		return 1
261ad6
+	fi
261ad6
+
261ad6
+	# the echo .. is the equivalent of strlen in bash
261ad6
+	#
261ad6
+	# /usr/include/linux/if.h:#define IFNAMSIZ        16
261ad6
+	# needs to include 0 byte end string
261ad6
+
261ad6
+	if [ "${#OCF_RESKEY_vlan_interface}" -gt 15 ]; then
261ad6
+		ocf_log err "Invalid OCF_RESKEY_vlan_interface: name is too long"
261ad6
+		return 1
261ad6
+	fi
261ad6
+
261ad6
+	if [ ! -d "/sys/class/net" ]; then
261ad6
+		ocf_log err "Unable to find sysfs network class in /sys"
261ad6
+		return 1
261ad6
+	fi
261ad6
+
261ad6
+	if [ ! -e "/sys/class/net/$OCF_RESKEY_vlan_interface" ]; then
261ad6
+		ocf_log err "Invalid OCF_RESKEY_vlan_interface: $OCF_RESKEY_vlan_interface does not exists"
261ad6
+		return 1
261ad6
+	fi
261ad6
+
261ad6
+	if [ -z "$OCF_RESKEY_vlan_id" ]; then
261ad6
+		ocf_log err "Invalid OCF_RESKEY_vlan_id: value cannot be empty"
261ad6
+		return 1
261ad6
+	fi
261ad6
+	if ! ocf_is_decimal "$OCF_RESKEY_vlan_id" || \
261ad6
+	   [ "$OCF_RESKEY_vlan_id" -gt "4094" ]; then
261ad6
+		ocf_log err "Invalid OCF_RESKEY_vlan_id: must be a decimal value (0 to 4094 included)"
261ad6
+		return 1
261ad6
+	fi
261ad6
+
261ad6
+	if [ "${#OCF_RESKEY_vlan_name}" -gt 15 ]; then
261ad6
+		ocf_log err "Invalid OCF_RESKEY_vlan_name: name is too long"
261ad6
+		return 1
261ad6
+	fi
261ad6
+
261ad6
+	return 0
261ad6
+}
261ad6
+
261ad6
+vlan_check() {
261ad6
+	if [ -e "/sys/class/net/$OCF_RESKEY_vlan_name" ]; then
261ad6
+		if [ ! -e "$HA_RSCTMP/iface-vlan.$OCF_RESKEY_vlan_name" ]; then
261ad6
+			return $OCF_ERR_GENERIC
261ad6
+		fi
261ad6
+	else
261ad6
+		if [ -e "$HA_RSCTMP/iface-vlan.$OCF_RESKEY_vlan_name" ]; then
261ad6
+			error="$(rm -f "$HA_RSCTMP/iface-vlan.$OCF_RESKEY_vlan_name" 2>&1)"
261ad6
+			if [ "$?" != "0" ]; then
261ad6
+				ocf_log err "Unable to remove stale lock file for vlan $OCF_RESKEY_vlan_name: $error"
261ad6
+				return $OCF_ERR_GENERIC
261ad6
+			fi
261ad6
+		fi
261ad6
+		return $OCF_NOT_RUNNING
261ad6
+	fi
261ad6
+
261ad6
+	if ! iface_is_up $OCF_RESKEY_vlan_interface; then
261ad6
+		if ocf_is_true "$OCF_RESKEY_vlan_loose_binding"; then
261ad6
+			ocf_log warn "Interface $OCF_RESKEY_vlan_interface is administratively down"
261ad6
+		else
261ad6
+			ocf_log err "Interface $OCF_RESKEY_vlan_interface is administratively down"
261ad6
+			return $OCF_ERR_GENERIC
261ad6
+		fi
261ad6
+	fi
261ad6
+
261ad6
+	if ! iface_is_up $OCF_RESKEY_vlan_name; then
261ad6
+		ocf_log err "VLAN $OCF_RESKEY_vlan_name is administratively down"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	if ! iface_lower_is_up $OCF_RESKEY_vlan_name; then
261ad6
+		ocf_log err "VLAN $OCF_RESKEY_vlan_name has no active link-layer"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	return $OCF_SUCCESS
261ad6
+}
261ad6
+
261ad6
+# we need a simpler stop version to clean after us if start fails
261ad6
+# without involving any error checking
261ad6
+# rolling back in case of failure is otherwise complex
261ad6
+
261ad6
+vlan_force_stop() {
261ad6
+	$IP2UTIL link delete "$OCF_RESKEY_vlan_name" >/dev/null 2>&1
261ad6
+	rm -f "$HA_RSCTMP/iface-vlan.$OCF_RESKEY_vlan_name" 2>&1
261ad6
+}
261ad6
+
261ad6
+vlan_start() {
261ad6
+	# check if the vlan already exists
261ad6
+	vlan_check
261ad6
+	ret=$?
261ad6
+	if [ "$ret" != "$OCF_NOT_RUNNING" ]; then
261ad6
+		return $ret
261ad6
+	fi
261ad6
+
261ad6
+	# make sure kernel module is loaded
261ad6
+	if [ ! -e /proc/net/vlan ]; then
261ad6
+		error="$(modprobe 8021q 2>&1)"
261ad6
+		if [ "$?" != "0" ]; then
261ad6
+			ocf_log err "Unable to load kernel 8021q driver: $error"
261ad6
+			return $OCF_ERR_GENERIC
261ad6
+		fi
261ad6
+	fi
261ad6
+
261ad6
+	# generate options
261ad6
+	VLANOPTS=""
261ad6
+
261ad6
+	if [ -n "$OCF_RESKEY_vlan_reorder_hdr" ]; then
261ad6
+		if ocf_is_true "$OCF_RESKEY_vlan_reorder_hdr"; then
261ad6
+			VLANOPTS="reorder_hdr on"
261ad6
+		else
261ad6
+			VLANOPTS="reorder_hdr off"
261ad6
+		fi
261ad6
+	fi
261ad6
+
261ad6
+	if [ -n "$OCF_RESKEY_vlan_gvrp" ]; then
261ad6
+		if ocf_is_true "$OCF_RESKEY_vlan_gvrp"; then
261ad6
+			VLANOPTS="$VLANOPTS gvrp on"
261ad6
+		else
261ad6
+			VLANOPTS="$VLANOPTS gvrp off"
261ad6
+		fi
261ad6
+	fi
261ad6
+
261ad6
+	if [ -n "$OCF_RESKEY_vlan_mvrp" ]; then
261ad6
+		if ocf_is_true "$OCF_RESKEY_vlan_mvrp"; then
261ad6
+			VLANOPTS="$VLANOPTS mvrp on"
261ad6
+		else
261ad6
+			VLANOPTS="$VLANOPTS mvrp off"
261ad6
+		fi
261ad6
+	fi
261ad6
+
261ad6
+	if [ -n "$OCF_RESKEY_vlan_loose_binding" ]; then
261ad6
+		if ocf_is_true "$OCF_RESKEY_vlan_loose_binding"; then
261ad6
+			VLANOPTS="$VLANOPTS loose_binding on"
261ad6
+		else
261ad6
+			VLANOPTS="$VLANOPTS loose_binding off"
261ad6
+		fi
261ad6
+	fi
261ad6
+
261ad6
+	# create the VLAN
261ad6
+	error="$($IP2UTIL link add link "$OCF_RESKEY_vlan_interface" name "$OCF_RESKEY_vlan_name" type vlan id "$OCF_RESKEY_vlan_id" $VLANOPTS 2>&1)"
261ad6
+	if [ "$?" != "0" ]; then
261ad6
+		ocf_log err "Unable to create VLAN $OCF_RESKEY_vlan_name: $error"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	# set the interface up
261ad6
+	error="$($IP2UTIL link set dev "$OCF_RESKEY_vlan_interface" up 2>&1)"
261ad6
+	if [ "$?" != "0" ]; then
261ad6
+		ocf_log err "Unable to set VLAN $OCF_RESKEY_vlan_interface up: $error"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	# set the vlan up
261ad6
+	error="$($IP2UTIL link set dev "$OCF_RESKEY_vlan_name" up 2>&1)"
261ad6
+	if [ "$?" != "0" ]; then
261ad6
+		ocf_log err "Unable to set VLAN $OCF_RESKEY_vlan_name up: $error"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	error="$(touch "$HA_RSCTMP/iface-vlan.$OCF_RESKEY_vlan_name" 2>&1)"
261ad6
+	if [ "$?" != "0" ]; then
261ad6
+		ocf_log err "Unable to create lock file for VLAN $OCF_RESKEY_vlan_name: $error"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	return $OCF_SUCCESS
261ad6
+}
261ad6
+
261ad6
+vlan_stop() {
261ad6
+	vlan_check
261ad6
+	ret=$?
261ad6
+	if [ "$ret" = "$OCF_NOT_RUNNING" ]; then
261ad6
+		return $OCF_SUCCESS
261ad6
+	fi
261ad6
+	if [ "$ret" != "$OCF_SUCCESS" ]; then
261ad6
+		return $ret
261ad6
+	fi
261ad6
+
261ad6
+	# set vlan down
261ad6
+	error="$($IP2UTIL link set dev "$OCF_RESKEY_vlan_name" down 2>&1)"
261ad6
+	if [ "$?" != "0" ]; then
261ad6
+		ocf_log err "Unable to set VLAN $OCF_RESKEY_vlan_name down: $error"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	# delete vlan
261ad6
+	error="$($IP2UTIL link delete "$OCF_RESKEY_vlan_name" 2>&1)"
261ad6
+	if [ "$?" != "0" ]; then
261ad6
+		ocf_log err "Unable to delete VLAN $OCF_RESKEY_vlan_name: $error"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	error="$(rm -f "$HA_RSCTMP/iface-vlan.$OCF_RESKEY_vlan_name" 2>&1)"
261ad6
+	if [ "$?" != "0" ]; then
261ad6
+		ocf_log err "Unable to remove lock file for VLAN $OCF_RESKEY_vlan_name: $error"
261ad6
+		return $OCF_ERR_GENERIC
261ad6
+	fi
261ad6
+
261ad6
+	return $OCF_SUCCESS
261ad6
+}
261ad6
+
261ad6
+case $__OCF_ACTION in
261ad6
+	meta-data)
261ad6
+		vlan_meta_data
261ad6
+		exit $OCF_SUCCESS
261ad6
+	;;
261ad6
+	usage|help)
261ad6
+		vlan_usage
261ad6
+		exit $OCF_SUCCESS
261ad6
+	;;
261ad6
+esac
261ad6
+
261ad6
+if [ ! -d "$HA_RSCTMP" ]; then
261ad6
+	ocf_log debug "$HA_RSCTMP not found, we are probably being executed manually"
261ad6
+	mkdir -p "$HA_RSCTMP"
261ad6
+fi
261ad6
+
261ad6
+if [ -n "$__OCF_ACTION" ] && ! vlan_validate; then
261ad6
+	exit $OCF_ERR_CONFIGURED
261ad6
+fi
261ad6
+
261ad6
+case $__OCF_ACTION in
261ad6
+	start|stop)
261ad6
+		if ! ocf_is_root; then
261ad6
+			ocf_log err "You must be root for $__OCF_ACTION operation."
261ad6
+			exit $OCF_ERR_PERM
261ad6
+		fi
261ad6
+	;;
261ad6
+esac
261ad6
+
261ad6
+case $__OCF_ACTION in
261ad6
+	start)
261ad6
+		vlan_start
261ad6
+		ret=$?
261ad6
+		if [ "$ret" != "$OCF_SUCCESS" ]; then
261ad6
+			vlan_force_stop
261ad6
+		fi
261ad6
+		exit $ret
261ad6
+	;;
261ad6
+	stop)
261ad6
+		vlan_stop
261ad6
+		exit $?
261ad6
+	;;
261ad6
+	status|monitor)
261ad6
+		vlan_check
261ad6
+		exit $?
261ad6
+	;;
261ad6
+	validate-all)
261ad6
+		# vlan_validate above does the trick
261ad6
+	;;
261ad6
+	*)
261ad6
+		vlan_usage
261ad6
+		exit $OCF_ERR_UNIMPLEMENTED
261ad6
+	;;
261ad6
+esac
261ad6
+# vi:sw=4:ts=8:
261ad6
-- 
261ad6
1.8.4.2
261ad6