diff --git a/heartbeat/drbd b/heartbeat/drbd index c78c59a5c..45c2ae994 100644 --- a/heartbeat/drbd +++ b/heartbeat/drbd @@ -1,624 +1,585 @@ #!/bin/bash # # # OCF Resource Agent compliant drbd resource script. # # Copyright (c) 2004 - 2007 SUSE LINUX Products GmbH, Lars Marowsky-Bree # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Further, this software is distributed without any warranty that it is # free of the rightful claim of any third person regarding infringement # or the like. Any license provided herein, whether implied or # otherwise, applies only to this software file. Patent licenses, if # any, provided herein do not apply to combinations of this program with # other software, or any other product whatsoever. # # You should have received a copy of the GNU General Public License # along with this program; if not, write the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # # # OCF instance parameters # OCF_RESKEY_drbd_resource # OCF_RESKEY_drbdconf -# OCF_RESKEY_CRM_meta_clone_max -# OCF_RESKEY_CRM_meta_clone_node_max -# OCF_RESKEY_master_max -# OCF_RESKEY_master_node_max - ####################################################################### # Initialization: if [ -n "$OCF_DEBUG_LIBRARY" ]; then . $OCF_DEBUG_LIBRARY else . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs fi ####################################################################### meta_data() { cat < 1.1 Master/Slave OCF Resource Agent for DRBD This resource agent manages a Distributed Replicated Block Device (DRBD) object as a master/slave resource. DRBD is a mechanism for replicating storage; please see the documentation for setup details. The name of the drbd resource from the drbd.conf file. drbd resource name Full path to the drbd.conf file. Path to drbd.conf Whether or not to override the hostname with the clone number. This can be used to create floating peer configurations; drbd will be told to use node_<cloneno> as the hostname instead of the real uname, which can then be used in drbd.conf. Override drbd hostname - - - -Number of clones of this drbd resource. Do not fiddle with the default. - -Number of clones - - - - - -Clones per node. Do not fiddle with the default. - -Number of nodes - - - - - -Maximum number of active primaries. Do not fiddle with the default. - -Number of primaries - - - - - -Maximum number of primaries per node. Do not fiddle with the default. - -Number of primaries per node - - - - END exit $OCF_SUCCESS } do_cmd() { local cmd="$*" ocf_log debug "$RESOURCE: Calling $cmd" local cmd_out cmd_out=$($cmd 2>&1) ret=$? if [ $ret -ne 0 ]; then ocf_log err "$RESOURCE: Called $cmd" ocf_log err "$RESOURCE: Exit code $ret" ocf_log err "$RESOURCE: Command output: $cmd_out" else ocf_log debug "$RESOURCE: Exit code $ret" ocf_log debug "$RESOURCE: Command output: $cmd_out" fi echo $cmd_out return $ret } do_drbdadm() { local cmd="$DRBDADM -c $DRBDCONF $*" ocf_log debug "$RESOURCE: Calling $cmd" local cmd_out cmd_out=$($cmd 2>&1) ret=$? # Trim the garbage drbdadm likes to print when using the node # override feature: local cmd_ret=$(echo $cmd_out | sed -e 's/found __DRBD_NODE__.*</dev/null ; then : else ocf_log err "Invalid configuration file $DRBDCONF" return $OCF_ERR_CONFIGURED fi if [ "$OCF_RESKEY_CRM_meta_clone_max" -ne 2 ] \ || [ "$OCF_RESKEY_CRM_meta_clone_node_max" -ne 1 ] \ - || [ "$OCF_RESKEY_master_node_max" -ne 1 ] \ - || [ "$OCF_RESKEY_master_max" -ne 1 ] ; then + || [ "$OCF_RESKEY_CRM_meta_master_node_max" -ne 1 ] \ + || [ "$OCF_RESKEY_CRM_meta_master_max" -ne 1 ] ; then ocf_log err "Clone options misconfigured." exit $OCF_ERR_CONFIGURED fi return $OCF_SUCCESS } if [ $# -ne 1 ]; then echo "Incorrect parameter count." drbd_usage exit $OCF_ERR_ARGS fi : ${OCF_RESKEY_CRM_meta_interval=0} ACTION=$1 case $ACTION in meta-data) meta_data ;; validate-all) drbd_init drbd_validate_all ;; start|stop|monitor|promote|demote|notify) if ocf_is_root ; then : ; else ocf_log err "You must be root to perform this operation." exit $OCF_ERR_PERM fi drbd_init drbd_$ACTION exit $? ;; usage|help) drbd_usage exit $OCF_SUCCESS ;; *) drbd_usage exit $OCF_ERR_ARGS ;; esac