diff --git a/rgmanager/src/resources/Makefile.am b/rgmanager/src/resources/Makefile.am index 7719f816e..f620f4ab8 100644 --- a/rgmanager/src/resources/Makefile.am +++ b/rgmanager/src/resources/Makefile.am @@ -1,117 +1,117 @@ # # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in SUBDIRS = utils TARGET = fs.sh RESOURCES = service.sh ip.sh nfsclient.sh nfsexport.sh \ script.sh netfs.sh clusterfs.sh smb.sh \ apache.sh openldap.sh samba.sh mysql.sh \ postgres-8.sh tomcat-5.sh lvm.sh \ - vm.sh SAPInstance SAPDatabase named.sh \ + vm.sh SAPInstance SAPDatabase named.sh db2.sh \ ASEHAagent.sh drbd.sh nfsserver.sh \ tomcat-6.sh orainstance.sh oralistener.sh oracledb.sh METADATA = apache.metadata openldap.metadata samba.metadata \ mysql.metadata postgres-8.metadata \ tomcat-5.metadata named.metadata lvm.metadata \ drbd.metadata tomcat-6.metadata \ orainstance.metadata oralistener.metadata HELPERS = ocf-shellfuncs svclib_nfslock \ lvm_by_lv.sh lvm_by_vg.sh DTD = ra-api-1-modified.dtd XSL = ra2man.xsl ra2ref.xsl ra2rng.xsl RESRNG = resources.rng.head resources.rng.mid resources.rng.tail EXTRA_DIST = $(TARGET:=.in) \ $(RESOURCES) \ $(METADATA) \ $(HELPERS) \ $(DTD) \ $(XSL) \ $(RESRNG) rasdir = ${CLUSTERDATA} ras_SCRIPTS = $(TARGET) \ $(RESOURCES) \ $(HELPERS) ras_DATA = $(METADATA) rngdir = ${CLUSTERDATA}/relaxng rng_DATA = $(DTD) $(XSL) $(RESRNG) $(TARGET): cat $@.in | sed \ -e 's#@''LOGDIR@#${LOGDIR}#g' \ > $@.out chmod +x $@.out mv $@.out $@ clean-local: rm -f $(TARGET) resources.rng ras-validation: $(RESOURCES) $(TARGET) $(DTD) @echo Validating resource agent meta-data @for f in $(RESOURCES); do \ echo " $(abs_srcdir)/$$f "; \ bash $(abs_srcdir)/$$f meta-data | xmllint --dtdvalid \ $(abs_srcdir)/$(DTD) --noout -; \ if [ $$? -ne 0 ]; then exit 1; fi \ done @for f in $(TARGET); do \ echo " $(abs_builddir)/$$f "; \ bash $(abs_builddir)/$$f meta-data | xmllint --dtdvalid \ $(abs_srcdir)/$(DTD) --noout -; \ if [ $$? -ne 0 ]; then exit 1; fi \ done # # Schema maintenance. Run 'make resources.rng' and paste it in to # config/tools/xml/cluster.rng.in where it says 'autogenerated'. # # resources.rng.* should never be distributed by themselves. # resources.rng: $(RESOURCES) $(TARGET) utils/config-utils.sh resources.rng: $(XSL) $(RESRNG) rm -f resources.rng cat resources.rng.head >> resources.rng @echo Generating per-resource RelaxNG information... @for f in $(RESOURCES) $(TARGET); do \ echo " ./$$f"; \ bash ./$$f meta-data | xsltproc ra2rng.xsl - >> resources.rng; \ done cat resources.rng.mid >> resources.rng @echo Generating per-resource RelaxNG reference information... @for f in $(RESOURCES) $(TARGET); do \ echo " ./$$f"; \ bash ./$$f meta-data | xsltproc ra2ref.xsl - >> resources.rng; \ done cat resources.rng.tail >> resources.rng utils/config-utils.sh: make -C utils config-utils.sh diff --git a/rgmanager/src/resources/db2.sh b/rgmanager/src/resources/db2.sh new file mode 100755 index 000000000..f396ff62f --- /dev/null +++ b/rgmanager/src/resources/db2.sh @@ -0,0 +1,133 @@ +#!/bin/bash +# +# Copyright (c) 2011 Holger Teutsch +# Copyright (c) 2014 David Vossel +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +# NOTE: +# +# This agent is a wrapper around the heartbeat/db2 agent which limits the heartbeat +# db2 agent to Standard role support. This allows cluster managers such as rgmanager +# which do not have multi-state resource support to manage db2 instances with +# a limited feature set. +# + +export LC_ALL=C +export LANG=C +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +. $(dirname $0)/ocf-shellfuncs + +meta_data() { +cat < + + +1.0 + +Resource Agent that manages an IBM DB2 LUW databases in Standard role. Multiple partitions are supported. + +When partitions are in use, each partition must be configured as a separate primitive resource. + + +Resource Agent that manages an IBM DB2 LUW databases in Standard role with multiple partition support. + + + + +The instance of the database(s). + +instance + + + + +List of databases to be managed, e.g "db1 db2". +Defaults to all databases in the instance. + +List of databases to be managed + + + + +The number of the partion (DBPARTITIONNUM) to be managed. + +database partition number (DBPARTITIONNUM) + + + + + + + + + + + + + +END +} + +heartbeat_db2_wrapper() +{ + # default heartbeat agent ocf root. + export OCF_ROOT=/usr/lib/ocf + heartbeat_db2="${OCF_ROOT}/resource.d/heartbeat/db2" + + if ! [ -a $heartbeat_db2 ]; then + echo "heartbeat db2 agent not found at '${heartbeat_db2}'" + exit $OCF_ERR_INSTALLED + fi + + $heartbeat_db2 $1 +} + +case $1 in + meta-data) + meta_data + exit 0 + ;; + validate-all) + heartbeat_db2_wrapper $1 + exit $? + ;; + start) + heartbeat_db2_wrapper $1 + exit $? + ;; + stop) + heartbeat_db2_wrapper $1 + exit $? + ;; + status|monitor) + heartbeat_db2_wrapper "monitor" + exit $? + ;; + restart) + heartbeat_db2_wrapper "stop" + rc=$? + if [ $rc -ne 0 ]; then + exit $rc + fi + heartbeat_db2_wrapper "start" + exit $? + ;; + *) + echo "Usage: db2.sh {start|stop|monitor|validate-all|meta-data}" + exit $OCF_ERR_UNIMPLEMENTED + ;; +esac