#!/bin/sh # # # Written by Leo Eraly # # 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. # # This RA can be used in a Novell Linux environment if you have NCP volumes # on top of traditional Linux filesystems (e.g ext3,reiserfs) and you want to make # them high-available without the use of Novell Cluster Services. # ! This is not intented to be used with NCP volumes on top of NSS ! # # The NCP server also requires a virtual IP (for its resource) so next to this script # you'll also need to configure an IPaddr resource which has a dependency on this resource/script ####################################################################### # Initialization: . /usr/lib/heartbeat/ocf-shellfuncs #. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs ####################################################################### HOSTOS=`uname` MOUNT=/bin/mount usage() { echo "usage: $0 {start|stop|status|monitor|validate-all|meta-data}" return $1 } meta_data() { cat < 1.0 Resource script for NCP Volumes. It manages an NCP volume an a shared medium. NCP volume resource agent The mount point for the filesystem. mount point The IPv4 address for the cluster resource "192.168.1.1". IPv4 address The name of the (virtual) NCP volume to be mounted NCP volume name The name of the (virtual) NCP server NCP server name END exit $OCF_SUCCESS } ################################################################## ncp_usage() { cat < /dev/null 2>&1 ; then ocf_log info "Filesystem $MOUNTPOINT is already mounted." return $OCF_SUCCESS fi #ncpcon mount $NCPCON mount "$NCP_VOLUME,PATH=$MOUNTPOINT" if [ $? -ne 0 ]; then ocf_log err "Couldn't mount volume $NCP_VOLUME on $MOUNTPOINT" return $OCF_ERR_GENERIC fi #ncpcon bind $NCPCON bind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP if [ $? -ne 0 ]; then ocf_log err "Couldn't bind $NCP_SERVER with ip $RESOURCE_IP" return $OCF_ERR_GENERIC fi return $OCF_SUCCESS } ncp_stop() { ncp_status >/dev/null 2>&1 if [ $? -eq $OCF_NOT_RUNNING ]; then # Already unmounted, wonderful. return $OCF_SUCCESS else # ncpcon unbind $NCPCON unbind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP if [ $? -ne 0 ]; then ocf_log err "Couldn't unbind $NCP_SERVER with ip $RESOURCE_IP" return $OCF_ERR_GENERIC fi # unmount volume $NCPCON dismount $NCP_VOLUME if [ $? -ne 0 ]; then ocf_log err "Couldn't umount $NCP_VOLUME" return $OCF_ERR_GENERIC fi fi return $OCF_SUCCESS } #ocf_log debug "$0 started with arguments \"$@\"" NCPBASE=/opt/novell/ncpserv NCPCON=$NCPBASE/sbin/ncpcon MOUNTPOINT=$(echo $OCF_RESKEY_directory | sed 's/\/*$//') : ${MOUNTPOINT:=/} NCP_VOLUME=$OCF_RESKEY_ncpvolume NCP_SERVER=$OCF_RESKEY_ncpserver RESOURCE_IP=$OCF_RESKEY_ip case $__OCF_ACTION in meta-data) meta_data ;; start) ncp_start ;; stop) ncp_stop ;; status|monitor) ncp_status exit $? ;; validate-all) ncp_validate ;; usage|help) ncp_usage exit $OCF_SUCCESS ;; *) ncp_usage exit $OCF_ERR_UNIMPLEMENTED ;; esac exit $?