#!/bin/sh # # # lrmregtest OCF RA. Does nothing but wait a few seconds, can be # configured to fail occassionally. # # updated to support the LRM regression testing. # # Copyright (c) 2007 SUSE LINUX AG, Dejan Muhamedagic # All Rights Reserved. # # Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Brée # 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. # ####################################################################### # Initialization: . ${OCF_ROOT}/lib/heartbeat/ocf-shellfuncs ####################################################################### meta_data() { cat < 1.0 This is a lrmregtest Resource Agent. Use for LRM regression testing. lrmregtest resource agent How long to delay before each action. Action delay Complain loudly if they try to run us in parallel on the same resource. Report error if run twice at the same time Process the TERM signal and don't exit. No TERM ain't gonna kill us. Print more information. Be verbose. END } ####################################################################### # don't exit on TERM, to test that lrmd makes sure that we do exit sigterm_handler() { ocf_log info "They use TERM to bring us down. No such luck." return } dummy_usage() { cat </dev/null then ocf_log err "There is another instance of ${OCF_RESOURCE_INSTANCE} running: pid `cat $lockf`." exit $OCF_ERR_GENERIC fi } [ "$OCF_RESKEY_check_parallel" = 1 ] && check4parallel [ "$OCF_RESKEY_ignore_TERM" = 1 ] && trap sigterm_handler TERM echo $$ > $lockf trap "rm -f $lockf" EXIT verbose && invocation $@ case $__OCF_ACTION in meta-data) meta_data exit $OCF_SUCCESS ;; start) dummy_start;; stop) dummy_stop;; monitor) dummy_monitor;; migrate_to) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrate_to}." dummy_stop ;; migrate_from) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrated_from}." dummy_start ;; reload) ocf_log err "Reloading..." dummy_start ;; validate-all) dummy_validate;; usage|help) dummy_usage exit $OCF_SUCCESS ;; *) dummy_usage exit $OCF_ERR_UNIMPLEMENTED ;; esac rc=$? ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" exit $rc