├── .gitattributes ├── .gitignore ├── AUTHORS ├── COPYING ├── COPYING.GPLv3 ├── COPYING.LGPL ├── ChangeLog ├── Makefile.am ├── NEWS ├── README.md ├── autogen.sh ├── ci └── build.sh ├── configure.ac ├── doc ├── Makefile.am ├── README.webapps ├── dev-guides │ ├── ra-dev-guide-docinfo.xml │ ├── ra-dev-guide.asc │ └── writing-python-agents.md └── man │ ├── Makefile.am │ ├── mkappendix.sh │ ├── ra2refentry.xsl │ └── ralist.sh ├── heartbeat ├── AoEtarget.in ├── AudibleAlarm ├── CTDB.in ├── ClusterMon ├── Delay ├── Dummy ├── EvmsSCC ├── Evmsd ├── Filesystem ├── ICP ├── IPaddr ├── IPaddr2 ├── IPsrcaddr ├── IPv6addr.c ├── IPv6addr_utils.c ├── LVM ├── LVM-activate ├── LinuxSCSI ├── MailTo ├── Makefile.am ├── ManageRAID.in ├── ManageVE.in ├── NodeUtilization ├── Pure-FTPd ├── README ├── README.galera ├── README.mariadb.md ├── Raid1 ├── Route ├── SAPDatabase ├── SAPInstance ├── SendArp ├── ServeRAID ├── SphinxSearchDaemon ├── Squid.in ├── Stateful ├── SysInfo.in ├── VIPArip ├── VirtualDomain ├── WAS ├── WAS6 ├── WinPopup ├── Xen ├── Xinetd ├── ZFS ├── aliyun-vpc-move-ip ├── anything ├── apache ├── apache-conf.sh ├── asterisk ├── aws-vpc-move-ip ├── aws-vpc-route53.in ├── aws.sh ├── awseip ├── awsvip ├── azure-events-az.in ├── azure-events.in ├── azure-lb ├── clvm.in ├── conntrackd.in ├── corosync-qnetd ├── crypt ├── db2 ├── dhcpd ├── dnsupdate.in ├── docker ├── docker-compose ├── dovecot ├── dummypy.in ├── eDir88.in ├── ethmonitor ├── exportfs ├── findif.sh ├── fio.in ├── galera.in ├── garbd ├── gcp-ilb ├── gcp-pd-move.in ├── gcp-vpc-move-ip.in ├── gcp-vpc-move-route.in ├── gcp-vpc-move-vip.in ├── http-mon.sh ├── iSCSILogicalUnit.in ├── iSCSITarget.in ├── ibm-cloud-vpc-cr-vip.in ├── ibm-cloud-vpc-move-fip.in ├── ids ├── iface-bridge ├── iface-macvlan ├── iface-vlan ├── ipsec ├── iscsi ├── jboss ├── jira.in ├── kamailio.in ├── lvm-clvm.sh ├── lvm-plain.sh ├── lvm-tag.sh ├── lvmlockd ├── lxc.in ├── lxd-info.in ├── machine-info.in ├── mariadb.in ├── mdraid ├── metadata.rng ├── minio ├── mpathpersist.in ├── mysql ├── mysql-common.sh ├── mysql-proxy ├── nagios ├── named ├── nfsnotify.in ├── nfsserver ├── nfsserver-redhat.sh ├── nginx ├── nvmet-namespace ├── nvmet-port ├── nvmet-subsystem ├── ocf-binaries.in ├── ocf-directories.in ├── ocf-distro ├── ocf-rarun ├── ocf-returncodes ├── ocf-shellfuncs.in ├── ocf.py ├── ocivip ├── openstack-cinder-volume ├── openstack-common.sh ├── openstack-floating-ip ├── openstack-info.in ├── openstack-virtual-ip ├── ora-common.sh ├── oraasm ├── oracle ├── oralsnr ├── osceip ├── ovsmonitor ├── pgagent ├── pgsql ├── pingd ├── podman ├── podman-etcd ├── portblock ├── postfix ├── pound ├── powervs-subnet.in ├── proftpd ├── ra-api-1.dtd ├── rabbitmq-cluster.in ├── rabbitmq-server-ha ├── redis.in ├── rkt ├── rsyncd ├── rsyslog.in ├── sapdb-nosha.sh ├── sapdb.sh ├── scsi2reservation ├── send_ua.c ├── sfex ├── sg_persist.in ├── shellfuncs.in ├── slapd.in ├── smb-share.in ├── storage-mon.in ├── sybaseASE.in ├── symlink ├── syslog-ng.in ├── tomcat ├── varnish ├── vdo-vol ├── vmware ├── vsftpd.in └── zabbixserver ├── include ├── IPv6addr.h ├── Makefile.am └── agent_config.h.in ├── ldirectord ├── Makefile.am ├── OCF │ ├── Makefile.am │ └── ldirectord.in ├── init.d │ ├── Makefile.am │ ├── ldirectord.debian.default.in │ ├── ldirectord.debian.in │ └── ldirectord.in ├── ldirectord.cf ├── ldirectord.in ├── logrotate.d │ ├── Makefile.am │ └── ldirectord └── systemd │ ├── Makefile.am │ └── ldirectord.service.in ├── m4 ├── PKG_CHECK_VAR.m4 └── ac_python_module.m4 ├── make ├── git-version-gen ├── gitlog-to-changelog ├── release.mk └── spellcheck-ignore ├── resource-agents.pc.in ├── resource-agents.spec.in ├── rgmanager ├── Makefile.am └── src │ ├── Makefile.am │ └── resources │ ├── ASEHAagent.sh.in │ ├── Makefile.am │ ├── SAPDatabase │ ├── SAPInstance │ ├── apache.metadata │ ├── apache.sh.in │ ├── bind-mount.sh.in │ ├── clusterfs.sh.in │ ├── db2.sh.in │ ├── drbd.metadata │ ├── drbd.sh.in │ ├── fs.sh.in │ ├── ip.sh.in │ ├── lvm.metadata │ ├── lvm.sh.in │ ├── lvm_by_lv.sh.in │ ├── lvm_by_vg.sh.in │ ├── mysql.metadata │ ├── mysql.sh.in │ ├── named.metadata │ ├── named.sh.in │ ├── netfs.sh.in │ ├── nfsclient.sh.in │ ├── nfsexport.sh.in │ ├── nfsserver.sh.in │ ├── ocf-shellfuncs.in │ ├── openldap.metadata │ ├── openldap.sh.in │ ├── oracledb.sh.in │ ├── oradg.metadata │ ├── oradg.sh.in │ ├── orainstance.metadata │ ├── orainstance.sh.in │ ├── oralistener.metadata │ ├── oralistener.sh.in │ ├── postgres-8.metadata │ ├── postgres-8.sh.in │ ├── ra-api-1-modified.dtd │ ├── ra2man.xsl │ ├── ra2ref.xsl │ ├── ra2rng.xsl │ ├── resources.rng.head │ ├── resources.rng.mid │ ├── resources.rng.tail │ ├── samba.metadata │ ├── samba.sh.in │ ├── script.sh.in │ ├── service.sh.in │ ├── smb.sh.in │ ├── svclib_nfslock.in │ ├── tomcat-5.metadata │ ├── tomcat-5.sh.in │ ├── tomcat-6.metadata │ ├── tomcat-6.sh.in │ ├── utils │ ├── Makefile.am │ ├── config-utils.sh.in │ ├── fs-lib.sh.in │ ├── httpd-parse-config.pl │ ├── member_util.sh.in │ ├── messages.sh.in │ ├── named-parse-config.pl │ ├── ra-skelet.sh.in │ ├── rhev-check.sh │ └── tomcat-parse-config.pl │ └── vm.sh.in ├── systemd ├── Makefile.am ├── resource-agents-deps.target └── resource-agents.conf.in └── tools ├── Makefile.am ├── README.sfex ├── findif.c ├── nfsconvert.in ├── ocf-tester.8 ├── ocf-tester.in ├── ocft ├── ChangeLog ├── Filesystem ├── IPaddr2 ├── IPaddr2v4 ├── IPaddr2v6 ├── IPsrcaddr ├── IPv6addr ├── LVM ├── MailTo ├── Makefile.am ├── README.in ├── README.zh_CN.in ├── Raid1 ├── SendArp ├── VirtualDomain ├── Xen ├── Xinetd ├── apache ├── caselib.in ├── db2 ├── drbd.linbit ├── exportfs ├── exportfs-multidir ├── helpers.sh ├── iscsi ├── jboss ├── mysql ├── mysql-proxy ├── named ├── nfsserver ├── ocft.in ├── oracle ├── pgsql ├── portblock ├── postfix ├── runocft ├── runocft.prereq ├── sg_persist └── tomcat ├── send_arp.libnet.c ├── send_arp.linux.c ├── sfex.h ├── sfex_daemon.c ├── sfex_init.8 ├── sfex_init.c ├── sfex_lib.c ├── sfex_lib.h ├── sfex_stat.c ├── storage_mon.c ├── test-findif.sh └── tickle_tcp.c /.gitattributes: -------------------------------------------------------------------------------- 1 | configure.ac export-subst 2 | heartbeat/ocf-shellfuncs.in export-subst 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | Makefile.in 3 | aclocal.m4 4 | autoconf 5 | autoheader 6 | autom4te.cache 7 | automake 8 | autoscan.log 9 | compile 10 | configure 11 | configure.scan 12 | config.guess 13 | config.log 14 | config.sub 15 | config.status 16 | Makefile 17 | depcomp 18 | install-sh 19 | libtoolize 20 | ltmain.sh 21 | libtool 22 | make/stamp-h1 23 | make/clusterautoconfig.h* 24 | missing 25 | resource-agents.spec 26 | *.pc 27 | .deps 28 | .libs 29 | *.o 30 | *.la 31 | *.lo 32 | *.loT 33 | rgmanager/src/resources/* 34 | !rgmanager/src/resources/*.in 35 | rgmanager/src/resources/Makefile.in 36 | rgmanager/src/resources/utils/config-utils.sh 37 | resource-agents-* 38 | .version 39 | 40 | # generated by ./autogen.sh && ./configure 41 | doc/man/*.7 42 | doc/man/*.xml 43 | heartbeat/ocf-binaries 44 | heartbeat/ocf-directories 45 | heartbeat/ocf-shellfuncs 46 | heartbeat/send_ua 47 | heartbeat/shellfuncs 48 | heartbeat/*.pyc 49 | heartbeat/AoEtarget 50 | heartbeat/CTDB 51 | heartbeat/ManageRAID 52 | heartbeat/ManageVE 53 | heartbeat/Squid 54 | heartbeat/SysInfo 55 | heartbeat/aws-vpc-route53 56 | heartbeat/azure-events 57 | heartbeat/azure-events-az 58 | heartbeat/clvm 59 | heartbeat/conntrackd 60 | heartbeat/dnsupdate 61 | heartbeat/dummypy 62 | heartbeat/eDir88 63 | heartbeat/fio 64 | heartbeat/galera 65 | heartbeat/gcp-pd-move 66 | heartbeat/gcp-vpc-move-ip 67 | heartbeat/gcp-vpc-move-route 68 | heartbeat/gcp-vpc-move-vip 69 | heartbeat/ibm-cloud-vpc-cr-vip 70 | heartbeat/ibm-cloud-vpc-move-fip 71 | heartbeat/iSCSILogicalUnit 72 | heartbeat/iSCSITarget 73 | heartbeat/jira 74 | heartbeat/kamailio 75 | heartbeat/lxc 76 | heartbeat/lxd-info 77 | heartbeat/machine-info 78 | heartbeat/mariadb 79 | heartbeat/mpathpersist 80 | heartbeat/nfsnotify 81 | heartbeat/openstack-info 82 | heartbeat/powervs-subnet 83 | heartbeat/rabbitmq-cluster 84 | heartbeat/redis 85 | heartbeat/rsyslog 86 | heartbeat/sg_persist 87 | heartbeat/slapd 88 | heartbeat/smb-share 89 | heartbeat/storage-mon 90 | heartbeat/sybaseASE 91 | heartbeat/syslog-ng 92 | heartbeat/vsftpd 93 | include/agent_config.h 94 | include/config.h 95 | include/config.h.in 96 | include/stamp-h1 97 | include/stamp-h2 98 | ldirectord/ldirectord 99 | ldirectord/ldirectord.8 100 | ldirectord/OCF/ldirectord 101 | ldirectord/init.d/ldirectord 102 | ldirectord/init.d/ldirectord.debian 103 | ldirectord/init.d/ldirectord.debian.default 104 | ldirectord/systemd/ldirectord.service 105 | systemd/resource-agents.conf 106 | tools/findif 107 | tools/nfsconvert 108 | tools/ocf-tester 109 | tools/send_arp 110 | tools/storage_mon 111 | tools/tickle_tcp 112 | tools/ocft/README 113 | tools/ocft/README.zh_CN 114 | tools/ocft/caselib 115 | tools/ocft/ocft 116 | 117 | *.cache 118 | *.upgrade.xml 119 | py-compile 120 | ylwrap 121 | __pycache__ 122 | 123 | # BEAM Entries 124 | *.beam 125 | parser-messages 126 | MISC_ERRORS 127 | cscope.files 128 | cscope.out 129 | patches 130 | updates 131 | logs 132 | 133 | # OS and Editor Artifacts 134 | .DS_Store 135 | .bomb 136 | *.rej 137 | *.bz2 138 | *.gz 139 | *.xz 140 | *.sed 141 | *.diff 142 | *.patch 143 | *.gres 144 | *~ 145 | 146 | # Misc 147 | HTML 148 | TAGS 149 | GPATH 150 | GRTAGS 151 | GSYMS 152 | GTAGS 153 | .gres.* 154 | *.orig 155 | .gdb_history 156 | *~ 157 | \#* 158 | .changes 159 | pacemaker.tar.gz 160 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Authors: 2 | -------- 3 | A. J. Lewis 4 | Abhijith Das 5 | Adam Manthei 6 | Akamatsu Hiroshi 7 | Alan Robertson 8 | Alasdair G. Kergon 9 | Andrew Beekhof 10 | Andrew Price 11 | Benjamin Marzinski 12 | Bob Peterson 13 | Chris Feist 14 | Christian Rishoj 15 | Christine Caulfield 16 | Daiki Matsuda 17 | Daniel Phillips 18 | David Lee 19 | David Teigland 20 | Dejan Muhamedagic 21 | Dominik Klein 22 | Fabio M. Di Nitto 23 | Florian Haas 24 | Hideo Yamauchi 25 | Horms 26 | Huang Zhen 27 | James Parsons 28 | Jean-Francois Larvoire 29 | Joel Becker 30 | Jonathan Brassow 31 | Keisuke MORI 32 | Ken Preslan 33 | Lars Marowsky-Bree 34 | Lon Hohberger 35 | Marc - A. Dahlhaus 36 | Marek 'marx' Grac 37 | Mark Hlawatschek 38 | Matthew Soffen 39 | Michael Conrad Tadpol Tilstra 40 | Michael Schwartzkopff 41 | Nakahira Kazutomo 42 | Patrick Caulfield 43 | Philipp Kolmann 44 | Raoul Bhatia 45 | Robert Peterson 46 | Ron Terry 47 | Ross Vandegrift 48 | Ryan McCabe 49 | Ryan O'Hara 50 | Sebastian Reitenbach 51 | Serge Dubrouski 52 | Simon Horman 53 | Stanko Kupcevic 54 | Stephan Berlet 55 | Steven Whitehouse 56 | Takenaka Kazuhiro 57 | Wendy Cheng 58 | Xinwei Hu 59 | jparsons 60 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClusterLabs/resource-agents/b4306400423f0db6f22fdc79a619d5ebfc0dada6/NEWS -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Resource agents 2 | 3 | This repository contains resource agents (RAs) compliant 4 | with the Open Cluster Framework (OCF) specification. 5 | 6 | These resource agents are used by two cluster resource 7 | management implementations: 8 | 9 | - Pacemaker 10 | - rgmanager 11 | 12 | More information about OCF resource agents is available 13 | in the OCF Resource Agent Developer's guide (link below). 14 | 15 | 16 | ## Where can I find more information? 17 | 18 | * [ClusterLabs website](http://www.clusterlabs.org/) 19 | * [OCF Resource Agent Developer's guide](https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc) 20 | * Mailing lists for [users](http://oss.clusterlabs.org/mailman/listinfo/users) and [developers](http://oss.clusterlabs.org/mailman/listinfo/developers) 21 | * [ClusterLabs IRC channel](https://wiki.clusterlabs.org/wiki/ClusterLabs_IRC_channel) 22 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | autoreconf -i -v && echo Now run ./configure and make 4 | -------------------------------------------------------------------------------- /ci/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o pipefail 3 | [[ "${DEBUG:-}" ]] && set -x 4 | 5 | declare -i failed 6 | failed=0 7 | 8 | # SC2046: Quote this to prevent word splitting. 9 | # SC1090: Can't follow non-constant source. Use a directive to specify location. 10 | # SC2039: In POSIX sh, 'local' is undefined. 11 | # SC2086: Double quote to prevent globbing and word splitting. 12 | # SC2154: var is referenced but not assigned. 13 | # SC1087: Use braces when expanding arrays. 14 | ignored_errors="SC1090,SC2039,SC2154,SC1087" 15 | 16 | success() { 17 | printf "\r\033[2K [ \033[00;32mOK\033[0m ] Checking %s...\n" "$1" 18 | } 19 | 20 | warn() { 21 | printf "\r\033[2K [\033[0;33mWARNING\033[0m] Checking %s...\n" "$1" 22 | } 23 | 24 | fail() { 25 | printf "\r\033[2K [\033[0;31mFAIL\033[0m] Checking %s...\n" "$1" 26 | failed=$((failed + 1)) 27 | } 28 | 29 | check() { 30 | local script="$1" 31 | 32 | out="$(shellcheck -s sh -f gcc -x -e "$ignored_errors" "$script" 2>&1)" 33 | rc=$? 34 | if [ $rc -eq 0 ]; then 35 | success "$script" 36 | elif echo "$out" | grep -i 'error' >/dev/null; then 37 | fail "$script" 38 | else 39 | warn "$script" 40 | fi 41 | echo "$out" 42 | } 43 | 44 | find_prunes() { 45 | local prunes="! -path './.git/*'" 46 | if [ -f .gitmodules ]; then 47 | while read -r module; do 48 | prunes="$prunes ! -path './$module/*'" 49 | done < <(grep path .gitmodules | awk '{print $3}') 50 | fi 51 | echo "$prunes" 52 | } 53 | 54 | find_cmd() { 55 | echo "find heartbeat -type f -and \( -perm /111 -or -name '*.sh' -or -name '*.c' -or -name '*.in' \) $(find_prunes)" 56 | } 57 | 58 | check_all_executables() { 59 | echo "Checking executables and .sh files..." 60 | while read -r script; do 61 | file --mime "$script" | grep 'charset=binary' >/dev/null 2>&1 && continue 62 | file --mime "$script" | grep 'text/x-python' >/dev/null 2>&1 && continue 63 | # upstream CI doesnt detect MIME-format correctly for Makefiles 64 | [[ "$script" =~ .*/Makefile.in ]] && continue 65 | 66 | if grep -qE "\ 2 | Florian 3 | Haas 4 | 5 | hastexo 6 | 7 | florian.haas@hastexo.com 8 | 9 | 10 | John 11 | Shi 12 | 13 | SUSE 14 | 15 | Original ocft README 16 | jshi@suse.com 17 | 18 | 19 | Dejan 20 | Muhamedagic 21 | 22 | SUSE 23 | 24 | ocft documentation rewrite 25 | dmuhamedagic@suse.com 26 | 27 | 28 | 2010 29 | 2011 30 | 31 | LINBIT HA-Solutions GmbH 32 | 33 | 34 | 35 | 2011 36 | 37 | Novell, Inc. 38 | 39 | 40 | 41 | 2011 42 | 43 | SUSE Linux GmbH 44 | 45 | 46 | 47 | 2011 48 | 49 | hastexo Professional Services GmbH 50 | 51 | 52 | 53 | License information 54 | The text of and illustrations in this document are licensed 55 | under a Creative Commons Attribution–Share Alike 3.0 Unported 56 | license ("CC-BY-SA"). 57 | 58 | 59 | A summary of CC-BY-SA is available at . 61 | 62 | 63 | The full license text is available at . 65 | 66 | 67 | In accordance with CC-BY-SA, if you distribute this document 68 | or an adaptation of it, you must provide the URL for the original 69 | version. 70 | 71 | 72 | 73 | 74 | 75 | 1.0.2 76 | November 18, 2011 77 | FGH 78 | 79 | 80 | 1.0.1 81 | January 3, 2011 82 | FGH 83 | 84 | 85 | 1.0.0 86 | December 13, 2010 87 | FGH 88 | 89 | 90 | -------------------------------------------------------------------------------- /doc/dev-guides/writing-python-agents.md: -------------------------------------------------------------------------------- 1 | # Resource Agent guide for Python 2 | 3 | ## Introduction 4 | 5 | A simple library for authoring resource agents in Python is 6 | provided in the `ocf.py` library. 7 | 8 | Agents written in Python should be compatible with Python 3.6+. 9 | 10 | The library provides various helper constants and functions, a logging 11 | implementation as well as a run loop and metadata generation facility. 12 | 13 | ## Constants 14 | 15 | The following OCF constants are provided: 16 | 17 | * `OCF_SUCCESS` 18 | * `OCF_ERR_GENERIC` 19 | * `OCF_ERR_ARGS` 20 | * `OCF_ERR_UNIMPLEMENTED` 21 | * `OCF_ERR_PERM` 22 | * `OCF_ERR_INSTALLED` 23 | * `OCF_ERR_CONFIGURED` 24 | * `OCF_NOT_RUNNING` 25 | * `OCF_RUNNING_MASTER` 26 | * `OCF_FAILED_MASTER` 27 | * `OCF_RESOURCE_INSTANCE` 28 | * `HA_DEBUG` 29 | * `HA_DATEFMT` 30 | * `HA_LOGFACILITY` 31 | * `HA_LOGFILE` 32 | * `HA_DEBUGLOG` 33 | * `OCF_ACTION` -- Set to `$__OCF_ACTION` if set, or to the first command line argument. 34 | 35 | ## Logger 36 | 37 | The `logger` variable holds a Python standard log object with its 38 | formatter set to follow the OCF standard logging format. 39 | 40 | Example: 41 | 42 | ``` python 43 | 44 | from ocf import logger 45 | 46 | logger.error("Something went terribly wrong.") 47 | 48 | ``` 49 | 50 | ## Helper functions 51 | 52 | * `ocf_exit_reason`: Prints the exit error string to stderr. 53 | * `have_binary`: Returns True if the given binary is available. 54 | * `is_true`: Converts an OCF truth value to a Python boolean. 55 | * `is_probe`: Returns True when running a probe action. Used to return 56 | OCF_NOT_RUNNING instead of error code that would cause unexpected actions 57 | like fencing before starting the resource or when it is disabled. 58 | * `get_parameter`: Looks up the matching `OCF_RESKEY_` environment variable. 59 | * `distro`: Returns / or if version info is unavailable. 60 | * `Agent`: Class which helps to generate the XML metadata. 61 | * `run`: OCF run loop implementation. 62 | 63 | ## Run loop and metadata example 64 | 65 | ``` python 66 | import os 67 | import sys 68 | 69 | OCF_FUNCTIONS_DIR = os.environ.get("OCF_FUNCTIONS_DIR", "%s/lib/heartbeat" % os.environ.get("OCF_ROOT")) 70 | sys.path.append(OCF_FUNCTIONS_DIR) 71 | import ocf 72 | 73 | def start_action(argument): 74 | print("The start action receives the argument as a parameter: {}".format(argument)) 75 | 76 | 77 | def main(): 78 | agent = ocf.Agent("example-agent", 79 | shortdesc="This is an example agent", 80 | longdesc="An example of how to " + 81 | "write an agent in Python using the ocf " + 82 | "Python library.") 83 | agent.add_parameter("argument", 84 | shortdesc="Example argument", 85 | longdesc="This argument is just an example.", 86 | content_type="string", 87 | default="foobar") 88 | agent.add_action("start", timeout=60, handler=start_action) 89 | agent.run() 90 | 91 | if __name__ == "__main__": 92 | main() 93 | ``` 94 | -------------------------------------------------------------------------------- /doc/man/mkappendix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat < 5 | 6 | 7 | Resource agent manual pages 8 | EOF 9 | 10 | for manpage in $(printf "%s\n" "$@" | sort -f); do 11 | cat < 13 | EOF 14 | done 15 | 16 | cat < 18 | EOF 19 | -------------------------------------------------------------------------------- /doc/man/ralist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | RADIR=$1 4 | PREFIX=$2 5 | SUFFIX=$3 6 | 7 | find "$RADIR" -type f -executable | while read -r file; do 8 | echo "${PREFIX}$(basename "$file")${SUFFIX}" 9 | done 10 | -------------------------------------------------------------------------------- /heartbeat/README: -------------------------------------------------------------------------------- 1 | The OCF RA shared code directory 2 | 3 | If an RA is too big to be comfortably maintained, split it into 4 | several source files. Obviosuly, if two or more RAs share some 5 | code, move that code out to a file which can be shared. 6 | 7 | These files will be installed in $OCF_ROOT/lib/heartbeat with 8 | permissions 644. 9 | 10 | Naming practice 11 | 12 | Use names such as .sh or -check.sh or anything-else.sh 13 | where "anything-else" should be related to both the RA and the 14 | code it contains. By adding extension (.sh) it is going to be 15 | easier to notice that these files are not complete resource 16 | agents. 17 | 18 | For instance, oracle and oralsnr RA can both use code in 19 | ora-common.sh. 20 | 21 | Of course, if the RA is implemented in another programming 22 | language, use the appropriate extension. 23 | 24 | RA tracing 25 | 26 | RA tracing may be turned on by setting OCF_TRACE_RA. The trace 27 | output will be saved to OCF_TRACE_FILE, if set. If not, 28 | then the trace would be saved to the OCF_RESKEY_trace_dir. 29 | If it's also not defined, the log will be saved by default to 30 | 31 | $HA_VARLIB/trace_ra//.. 32 | 33 | e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08 34 | 35 | HA_VARLIB is typically set to /var/lib/heartbeat. 36 | 37 | OCF_TRACE_FILE can be set to a path or file descriptor: 38 | 39 | - FD (small integer [3-9]) in that case it is up to the callers 40 | to capture output; the FD _must_ be open for writing 41 | 42 | - absolute path 43 | 44 | NB: FD 9 may be used for tracing with bash >= v4 in case 45 | OCF_TRACE_FILE is set to a path. 46 | 47 | -------------------------------------------------------------------------------- /heartbeat/aws.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # AWS Helper Scripts 5 | # 6 | # 7 | 8 | : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} 9 | . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs 10 | 11 | # Defaults 12 | OCF_RESKEY_curl_retries_default="4" 13 | OCF_RESKEY_curl_sleep_default="3" 14 | 15 | : ${OCF_RESKEY_curl_retries=${OCF_RESKEY_curl_retries_default}} 16 | : ${OCF_RESKEY_curl_sleep=${OCF_RESKEY_curl_sleep_default}} 17 | 18 | # Function to enable reusable IMDS token retrieval for efficient repeated access 19 | # File to store the token and timestamp 20 | TOKEN_FILE="${HA_RSCTMP}/.aws_imds_token" 21 | TOKEN_FUNC="fetch_new_token" # Used by curl_retry() if saved token is invalid 22 | TOKEN_LIFETIME=21600 # Token lifetime in seconds (6 hours) 23 | TOKEN_EXPIRY_THRESHOLD=3600 # Renew token if less than 60 minutes (1 hour) remaining 24 | DMI_FILE="/sys/devices/virtual/dmi/id/board_asset_tag" # Only supported on nitro-based instances. 25 | 26 | # Function to fetch a new token 27 | fetch_new_token() { 28 | TOKEN=$(curl_retry "$OCF_RESKEY_curl_retries" "$OCF_RESKEY_curl_sleep" "--show-error -sX PUT -H 'X-aws-ec2-metadata-token-ttl-seconds: $TOKEN_LIFETIME'" "http://169.254.169.254/latest/api/token") 29 | echo "$TOKEN $(date +%s)" > "$TOKEN_FILE" 30 | chmod 600 "$TOKEN_FILE" 31 | echo "$TOKEN" 32 | } 33 | 34 | # Function to retrieve or renew the token 35 | get_token() { 36 | if [ -f "$TOKEN_FILE" ]; then 37 | read -r STORED_TOKEN STORED_TIMESTAMP < "$TOKEN_FILE" 38 | CURRENT_TIME=$(date +%s) 39 | ELAPSED_TIME=$((CURRENT_TIME - STORED_TIMESTAMP)) 40 | 41 | if [ "$ELAPSED_TIME" -lt "$((TOKEN_LIFETIME - TOKEN_EXPIRY_THRESHOLD))" ]; then 42 | # Token is still valid 43 | echo "$STORED_TOKEN" 44 | return 45 | fi 46 | fi 47 | # Fetch a new token if not valid 48 | fetch_new_token 49 | } 50 | 51 | get_instance_id() { 52 | local INSTANCE_ID 53 | 54 | # Try to get the EC2 instance ID from DMI first before falling back to IMDS. 55 | ocf_log debug "EC2: Attempt to get EC2 Instance ID from local file." 56 | if [ -r "$DMI_FILE" ] && [ -s "$DMI_FILE" ]; then 57 | INSTANCE_ID="$(cat "$DMI_FILE")" 58 | case "$INSTANCE_ID" in 59 | i-0*) echo "$INSTANCE_ID"; return "$OCF_SUCCESS" ;; 60 | esac 61 | fi 62 | 63 | INSTANCE_ID=$(curl_retry "$OCF_RESKEY_curl_retries" "$OCF_RESKEY_curl_sleep" "--show-error -s -H 'X-aws-ec2-metadata-token: $TOKEN'" "http://169.254.169.254/latest/meta-data/instance-id") 64 | if [ $? -ne 0 ]; then 65 | ocf_exit_reason "Failed to get EC2 Instance ID" 66 | exit $OCF_ERR_GENERIC 67 | fi 68 | 69 | echo "$INSTANCE_ID" 70 | return "$OCF_SUCCESS" 71 | } 72 | 73 | get_interface_mac() { 74 | local MAC_FILE MAC_ADDR rc 75 | MAC_FILE="/sys/class/net/${OCF_RESKEY_interface}/address" 76 | if [ -z "$OCF_RESKEY_interface" ]; then 77 | cmd="curl_retry \"$OCF_RESKEY_curl_retries\" \"$OCF_RESKEY_curl_sleep\" \"--show-error -s -H 'X-aws-ec2-metadata-token: $TOKEN'\" \"http://169.254.169.254/latest/meta-data/mac\"" 78 | elif [ -f "$MAC_FILE" ]; then 79 | cmd="cat ${MAC_FILE}" 80 | else 81 | cmd="ip -br link show dev ${OCF_RESKEY_interface} | tr -s ' ' | cut -d' ' -f3" 82 | fi 83 | ocf_log debug "executing command: $cmd" 84 | MAC_ADDR="$(eval $cmd)" 85 | rc=$? 86 | if [ $rc != 0 ]; then 87 | ocf_log warn "command failed, rc: $rc" 88 | return $OCF_ERR_GENERIC 89 | fi 90 | ocf_log debug "MAC address associated with interface ${OCF_RESKEY_interface}: ${MAC_ADDR}" 91 | 92 | echo $MAC_ADDR 93 | return $OCF_SUCCESS 94 | } 95 | -------------------------------------------------------------------------------- /heartbeat/ethmonitor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClusterLabs/resource-agents/b4306400423f0db6f22fdc79a619d5ebfc0dada6/heartbeat/ethmonitor -------------------------------------------------------------------------------- /heartbeat/http-mon.sh: -------------------------------------------------------------------------------- 1 | # 2 | # General http monitor code 3 | # (sourced by apache and httpmon) 4 | # 5 | # Author: Alan Robertson 6 | # Sun Jiang Dong 7 | # 8 | # Support: users@clusterlabs.org 9 | # 10 | # License: GNU General Public License (GPL) 11 | # 12 | # Copyright: (C) 2002-2005 International Business Machines 13 | # 14 | 15 | # default options for http clients 16 | # NB: We _always_ test a local resource, so it should be 17 | # safe to connect from the local interface. 18 | bind_address="127.0.0.1" 19 | curl_ipv6_opts="" 20 | if ocf_is_true "$OCF_RESKEY_use_ipv6" || echo "$STATUSURL" | grep -qs "::"; then 21 | bind_address="::1" 22 | curl_ipv6_opts="-g" 23 | fi 24 | WGETOPTS="-O- -q --no-proxy --bind-address=$bind_address" 25 | CURLOPTS="-o - -Ss -L --noproxy '*' --interface $bind_address $curl_ipv6_opts" 26 | 27 | request_url_header() { 28 | which curl >/dev/null 2>&1 29 | if [ $? -eq 0 ]; then 30 | curl -IL --connect-timeout 5 --interface lo $curl_ipv6_opts "$1" > /dev/null 2>&1 31 | return $? 32 | fi 33 | 34 | which wget >/dev/null 2>&1 35 | if [ $? -eq 0 ]; then 36 | local header=$(wget --server-response --spider --timeout=5 --tries=2 "$1" 2>&1) 37 | if [ $? -eq 0 ]; then 38 | return $OCF_SUCCESS 39 | fi 40 | 41 | # a 4xx error is still a server response. 42 | echo "$header" | grep "HTTP/1.1 4.. " > /dev/null 2>&1 43 | return $? 44 | fi 45 | return $OCF_ERR_GENERIC 46 | } 47 | 48 | # 49 | # run the http client 50 | # 51 | curl_func() { 52 | cl_opts="$CURLOPTS $test_httpclient_opts" 53 | if [ x != "x$test_user" ]; then 54 | echo "-u $test_user:$test_password" | 55 | curl -K - $cl_opts "$1" 56 | else 57 | curl $cl_opts "$1" 58 | fi 59 | } 60 | wget_func() { 61 | # -L not implemented in wget2 62 | wget -V | grep -q "^GNU Wget2 " || WGETOPTS="$WGETOPTS -L" 63 | auth="" 64 | cl_opts="$WGETOPTS $test_httpclient_opts" 65 | [ x != "x$test_user" ] && 66 | auth="--http-user=$test_user --http-passwd=$test_password" 67 | wget $auth $cl_opts "$1" 68 | } 69 | # 70 | # rely on whatever the user provided 71 | userdefined() { 72 | $test_httpclient $test_httpclient_opts "$1" 73 | } 74 | 75 | # 76 | # find a good http client 77 | # 78 | findhttpclient() { 79 | # prefer curl (see b2ca07d) 80 | if [ "x$CLIENT" != x ] && which "$CLIENT" >/dev/null 2>&1; then 81 | echo "$CLIENT" 82 | elif which curl >/dev/null 2>&1; then 83 | echo "curl" 84 | elif which wget >/dev/null 2>&1; then 85 | echo "wget" 86 | else 87 | return 1 88 | fi 89 | } 90 | gethttpclient() { 91 | [ -z "$test_httpclient" ] && 92 | test_httpclient=$ourhttpclient 93 | case "$test_httpclient" in 94 | curl|wget) echo ${test_httpclient}_func;; #these are supported 95 | *) echo userdefined;; 96 | esac 97 | } 98 | 99 | # test configuration good? 100 | is_testconf_sane() { 101 | if [ "x$test_regex" = x -o "x$test_url" = x ]; then 102 | ocf_log err "test regular expression or test url empty" 103 | return 1 104 | fi 105 | if [ "x$test_user$test_password" != x -a \( "x$test_user" = x -o "x$test_password" = x \) ]; then 106 | ocf_log err "bad user authentication for extended test" 107 | return 1 108 | fi 109 | return 0 110 | } 111 | # 112 | # read the test definition from the config 113 | # 114 | readtestconf() { 115 | test_name="$1" # we look for this one or the first one if empty 116 | lcnt=0 117 | readdef="" 118 | test_url="" test_regex="" 119 | test_user="" test_password="" 120 | test_httpclient="" test_httpclient_opts="" 121 | 122 | while read key value; do 123 | lcnt=$((lcnt+1)) 124 | if [ "$readdef" ]; then 125 | case "$key" in 126 | "url") test_url="$value" ;; 127 | "user") test_user="$value" ;; 128 | "password") test_password="$value" ;; 129 | "client") test_httpclient="$value" ;; 130 | "client_opts") test_httpclient_opts="$value" ;; 131 | "match") test_regex="$value" ;; 132 | "end") break ;; 133 | "#"*|"") ;; 134 | *) ocf_log err "$lcnt: $key: unknown keyword"; return 1 ;; 135 | esac 136 | else 137 | [ "$key" = "test" ] && 138 | [ -z "$test_name" -o "$test_name" = "$value" ] && 139 | readdef=1 140 | fi 141 | done 142 | } 143 | -------------------------------------------------------------------------------- /heartbeat/lvm-clvm.sh: -------------------------------------------------------------------------------- 1 | # lvm-clvmd.sh 2 | # 3 | # Description: LVM management with clvmd 4 | # 5 | # 6 | # Author: Resource agents contributors 7 | # Interface to LVM by Dejan Muhamedagic 8 | # Support: users@clusterlabs.org 9 | # License: GNU General Public License (GPL) 10 | # Copyright: (C) 2017 Dejan Muhamedagic 11 | # 12 | 13 | ## 14 | # Attempt to deactivate vg cluster wide and then start the vg exclusively 15 | ## 16 | retry_exclusive_start() 17 | { 18 | # Deactivate each LV in the group one by one cluster wide 19 | set -- $(lvs -o name,attr --noheadings $OCF_RESKEY_volgrpname 2> /dev/null) 20 | while [ $# -ge 2 ]; do 21 | case $2 in 22 | ????ao*) 23 | # open LVs cannot be deactivated. 24 | return $OCF_ERR_GENERIC;; 25 | *) 26 | if ! lvchange -an $OCF_RESKEY_volgrpname/$1; then 27 | ocf_exit_reason "Unable to perform required deactivation of $OCF_RESKEY_volgrpname/$1 before starting" 28 | return $OCF_ERR_GENERIC 29 | fi 30 | ;; 31 | esac 32 | shift 2 33 | done 34 | 35 | ocf_run vgchange $vgchange_activate_options $OCF_RESKEY_volgrpname 36 | } 37 | 38 | # 39 | # the interface to the LVM RA 40 | # 41 | 42 | lvm_init() { 43 | vgchange_activate_options="-aey" 44 | vgchange_deactivate_options="-an" 45 | } 46 | 47 | lvm_validate_all() { 48 | if ! ps -C clvmd > /dev/null 2>&1; then 49 | ocf_exit_reason "$OCF_RESKEY_volgrpname has the cluster attribute set, but 'clvmd' is not running" 50 | exit $OCF_ERR_GENERIC 51 | fi 52 | } 53 | 54 | lvm_status() { 55 | return 0 56 | } 57 | 58 | lvm_pre_activate() { 59 | return 0 60 | } 61 | 62 | lvm_post_activate() { 63 | local rc=$1 64 | if [ $rc -ne 0 ]; then 65 | # Failure to exclusively activate cluster vg.: 66 | # This could be caused by a remotely active LV, Attempt 67 | # to disable volume group cluster wide and try again. 68 | # Allow for some settling 69 | sleep 5 70 | if ! retry_exclusive_start; then 71 | return $OCF_ERR_GENERIC 72 | fi 73 | fi 74 | return $rc 75 | } 76 | 77 | lvm_pre_deactivate() { 78 | return 0 79 | } 80 | 81 | lvm_post_deactivate() { 82 | local rc=$1 83 | return $rc 84 | } 85 | 86 | # vim:tabstop=4:shiftwidth=4:textwidth=0:wrapmargin=0 87 | -------------------------------------------------------------------------------- /heartbeat/lvm-plain.sh: -------------------------------------------------------------------------------- 1 | # lvm-plain.sh 2 | # 3 | # Description: LVM management with no VG protection 4 | # 5 | # 6 | # Author: Dejan Muhamedagic 7 | # Support: users@clusterlabs.org 8 | # License: GNU General Public License (GPL) 9 | # Copyright: (C) 2017 Dejan Muhamedagic 10 | # 11 | 12 | # 13 | # interface to the LVM RA 14 | # 15 | 16 | # apart from the standard vgchange options, 17 | # this is mostly a template 18 | # please copy and modify appropriately 19 | # when adding new VG protection mechanisms 20 | 21 | # lvm_init sets the vgchange options: 22 | # vgchange_activate_options 23 | # vgchange_deactivate_options 24 | # (for both activate and deactivate) 25 | 26 | lvm_init() { 27 | vgchange_activate_options="-aly" 28 | vgchange_deactivate_options="-aln" 29 | # for clones (clustered volume groups), we'll also have to force 30 | # monitoring, even if disabled in lvm.conf. 31 | if ocf_is_clone; then 32 | vgchange_activate_options="$vgchange_activate_options --monitor y" 33 | fi 34 | } 35 | 36 | lvm_validate_all() { 37 | : nothing to validate 38 | } 39 | 40 | lvm_status() { 41 | return 0 42 | } 43 | 44 | lvm_pre_activate() { 45 | return 0 46 | } 47 | 48 | lvm_post_activate() { 49 | local rc=$1 50 | return $rc 51 | } 52 | 53 | lvm_pre_deactivate() { 54 | return 0 55 | } 56 | 57 | lvm_post_deactivate() { 58 | local rc=$1 59 | return $rc 60 | } 61 | 62 | # vim:tabstop=4:shiftwidth=4:textwidth=0:wrapmargin=0 63 | -------------------------------------------------------------------------------- /heartbeat/metadata.rng: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | boolean 36 | string 37 | second 38 | integer 39 | 40 | 41 | 42 | 43 | select 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 0 82 | 1 83 | 84 | 85 | 86 | 87 | 88 | Promoted 89 | Unpromoted 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /heartbeat/ocf-binaries.in: -------------------------------------------------------------------------------- 1 | # Make sure PATH contains all the usual suspects 2 | PATH="$PATH:/sbin:/bin:/usr/sbin:/usr/bin" 3 | 4 | # Include /usr/ucb for finding whoami on Solaris 5 | PATH="$PATH:/usr/ucb" 6 | 7 | export PATH 8 | 9 | # Binaries and binary options for use in Resource Agents 10 | : ${AWK:=@AWK@} 11 | : ${EGREP:="@EGREP@"} 12 | : ${FGREP:="@FGREP@"} 13 | : ${IFCONFIG_A_OPT:="@IFCONFIG_A_OPT@"} 14 | : ${MAILCMD:=@MAILCMD@} 15 | : ${PING:=@PING@} 16 | : ${SH:=@SHELL@} 17 | : ${TEST:=@TEST@} 18 | : ${TESTPROG:=@TEST@} 19 | 20 | # Entries that should probably be removed 21 | : ${BASENAME:=basename} 22 | : ${BLOCKDEV:=blockdev} 23 | : ${CAT:=cat} 24 | : ${FSCK:=fsck} 25 | : ${FUSER:=fuser} 26 | : ${GETENT:=getent} 27 | : ${GREP:=grep} 28 | : ${IFCONFIG:=ifconfig} 29 | : ${IPTABLES:=iptables} 30 | ## for cases that are known not to be serviceable with iptables-nft impl. 31 | : ${IPTABLES_LEGACY:=iptables-legacy} 32 | : ${IP2UTIL:=ip} 33 | : ${MDADM:=mdadm} 34 | : ${MODPROBE:=modprobe} 35 | : ${MOUNT:=mount} 36 | : ${MSGFMT:=msgfmt} 37 | : ${NETSTAT:=netstat} 38 | : ${PERL:=perl} 39 | : ${RAIDSTART:=raidstart} 40 | : ${RAIDSTOP:=raidstop} 41 | : ${ROUTE:=route} 42 | : ${UMOUNT:=umount} 43 | : ${REBOOT:=reboot} 44 | : ${POWEROFF_CMD:=poweroff} 45 | : ${WGET:=wget} 46 | : ${WHOAMI:=whoami} 47 | : ${STRINGSCMD:=strings} 48 | : ${SCP:=scp} 49 | : ${SSH:=@SSH@} 50 | : ${SWIG:=swig} 51 | : ${GZIP_PROG:=gzip} 52 | : ${TAR:=tar} 53 | : ${MD5:=md5} 54 | : ${DRBDADM:=drbdadm} 55 | : ${DRBDSETUP:=drbdsetup} 56 | 57 | check_binary () { 58 | if ! have_binary "$1"; then 59 | if [ "$OCF_NOT_RUNNING" = 7 ]; then 60 | # Chances are we have a fully setup OCF environment 61 | ocf_exit_reason "Setup problem: couldn't find command: $1" 62 | else 63 | echo "Setup problem: couldn't find command: $1" 64 | fi 65 | exit $OCF_ERR_INSTALLED 66 | fi 67 | } 68 | 69 | have_binary () { 70 | if [ "$OCF_TESTER_FAIL_HAVE_BINARY" = "1" ]; then 71 | false 72 | else 73 | local bin=`echo $1 | sed -e 's/ -.*//'` 74 | test -x "`which $bin 2>/dev/null`" 75 | fi 76 | } 77 | -------------------------------------------------------------------------------- /heartbeat/ocf-directories.in: -------------------------------------------------------------------------------- 1 | # Binaries and binary options for use in Resource Agents 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | : ${INITDIR:=@INITDIR@} 6 | : ${HA_DIR:=@sysconfdir@/ha.d} 7 | : ${HA_RCDIR:=$HA_DIR/rc.d} 8 | : ${HA_CONFDIR=$HA_DIR/conf} 9 | : ${HA_CF:=$HA_DIR/ha.cf} 10 | : ${HA_VARLIB:=@localstatedir@/lib/heartbeat} 11 | : ${HA_RSCTMP:=@HA_RSCTMPDIR@} 12 | : ${HA_RSCTMP_OLD:=@HA_VARRUNDIR@/heartbeat/rsctmp} 13 | : ${HA_FIFO:=@localstatedir@/lib/heartbeat/fifo} 14 | : ${HA_BIN:=@libexecdir@/heartbeat} 15 | : ${HA_SBIN_DIR:=@sbindir@} 16 | : ${HA_DATEFMT:="%b %d %T "} 17 | : ${HA_DEBUGLOG:=/dev/null} 18 | : ${HA_RESOURCEDIR:=$HA_DIR/resource.d} 19 | : ${HA_DOCDIR:=@datadir@/doc/heartbeat} 20 | : ${__SCRIPT_NAME:=`basename $0`} 21 | : ${HA_VARRUN:=@localstatedir@/run} 22 | : ${HA_VARLOCK:=@localstatedir@/lock/subsys} 23 | -------------------------------------------------------------------------------- /heartbeat/ocf-rarun: -------------------------------------------------------------------------------- 1 | # 2 | # This is the OCF RA driver. It should take care of all the 3 | # boring details and leave only the parts which are really about 4 | # the actual resource to the resource agent. 5 | # 6 | # The interface 7 | # 8 | # The RA needs to define functions for all supported actions and 9 | # name them _. For instance, apache_start or 10 | # apache_meta_data. 11 | # 12 | # The following functions are required: 13 | # 14 | # - _methods 15 | # - _usage 16 | # - _meta_data 17 | # - _start 18 | # - _stop 19 | # - _monitor 20 | # 21 | # The required parameters should all be listed in the 22 | # OCF_REQUIRED_PARAMS variable. For example, "config user group". 23 | # 24 | # The OCF_REQUIRED_BINARIES variable should contain a list of all 25 | # programs which are needed for the correct operation of the 26 | # resource agent. 27 | # 28 | # _getconfig and _validate_all are optional. getconfig is 29 | # where RA can read more configuration from the file system or do 30 | # some other configuration processing. 31 | # validate_all checks if the environment is OK. 32 | # 33 | # If it exists, the _probe function is invoked on probes 34 | # (monitor with interval 0) instead of _monitor. 35 | # 36 | # NB: If the RA name contains a '-', it is going to be converted 37 | # to '_' when generating function names. For syslog-ng for 38 | # instance, the monitor function name would be syslog_ng_monitor 39 | 40 | is_function() { 41 | test z"`command -v $1`" = z"$1" 42 | } 43 | run_function() { 44 | is_function $1 && $1 45 | } 46 | is_var_defined() { 47 | test z != "z$(eval echo $`echo $1`)" 48 | } 49 | mk_action_func() { 50 | ACTION_FUNC=`echo ${OCF_RESOURCE_TYPE}_$__OCF_ACTION | tr '-' '_'` 51 | } 52 | validate_args() { 53 | is_function $ACTION_FUNC || { 54 | ocf_exit_reason "$__OCF_ACTION: action not supported" 55 | run_function ${OCF_RESOURCE_TYPE}_methods 56 | exit $OCF_ERR_UNIMPLEMENTED 57 | } 58 | } 59 | simple_actions() { 60 | case $__OCF_ACTION in 61 | meta-data|usage|methods) 62 | $ACTION_FUNC 63 | exit $OCF_SUCCESS 64 | ;; 65 | esac 66 | } 67 | run_probe() { 68 | if is_function ${OCF_RESOURCE_TYPE}_probe; then 69 | ${OCF_RESOURCE_TYPE}_probe 70 | exit 71 | fi 72 | } 73 | check_required_params() { 74 | local v 75 | for v in $OCF_REQUIRED_PARAMS; do 76 | is_var_defined OCF_RESKEY_$v || { 77 | ocf_exit_reason "$v: required parameter not set" 78 | exit $OCF_ERR_CONFIGURED 79 | } 80 | done 81 | } 82 | # this function does an exit (end of the road) 83 | handle_invalid_env() { 84 | local rc msg 85 | rc=$1 86 | msg=${2:-"environment is invalid, resource considered stopped"} 87 | case "$__OCF_ACTION" in 88 | stop) 89 | ocf_log info $msg 90 | exit $OCF_SUCCESS 91 | ;; 92 | monitor) 93 | if ocf_is_probe; then 94 | ocf_log info $msg 95 | exit $OCF_NOT_RUNNING 96 | else 97 | # in recurring monitor, this amounts to error 98 | ocf_exit_reason "$msg" 99 | exit $OCF_ERR_GENERIC 100 | fi 101 | ;; 102 | status) 103 | ocf_log info $msg 104 | exit $LSB_STATUS_STOPPED 105 | ;; 106 | *) 107 | ocf_exit_reason "$msg" 108 | exit $rc 109 | ;; 110 | esac 111 | } 112 | check_required_binaries() { 113 | local v 114 | for v in $OCF_REQUIRED_BINARIES; do 115 | have_binary $v || { 116 | handle_invalid_env $OCF_ERR_INSTALLED "$v: required binary not installed" 117 | # unreachable 118 | } 119 | done 120 | } 121 | validate_env() { 122 | check_required_binaries # all binaries present? 123 | is_function ${OCF_RESOURCE_TYPE}_validate_all || 124 | return 125 | local rc 126 | LSB_STATUS_STOPPED=3 127 | ${OCF_RESOURCE_TYPE}_validate_all # is environment ok? 128 | rc=$? 129 | if [ $rc -ne 0 ]; then 130 | handle_invalid_env $rc 131 | # unreachable 132 | fi 133 | } 134 | 135 | # ocf_rarun: the main function 136 | ocf_rarun() { 137 | mk_action_func # create action function name 138 | validate_args # validate command line arguments 139 | simple_actions # run meta-data (or similar) 140 | check_required_params # all required parameters defined? 141 | run_function ${OCF_RESOURCE_TYPE}_getconfig # get extra configuration 142 | validate_env # is environment ok? 143 | ocf_is_probe && run_probe # do probe 144 | shift 1 # skip action 145 | $ACTION_FUNC $* # run action 146 | } 147 | -------------------------------------------------------------------------------- /heartbeat/ocf-returncodes: -------------------------------------------------------------------------------- 1 | # 2 | # Common varibales for the OCF Resource Agents supplied by 3 | # heartbeat. 4 | # 5 | # Copyright (c) 2004 SUSE LINUX AG, Andrew Beekhof 6 | # All Rights Reserved. 7 | # 8 | # 9 | # This library is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU Lesser General Public 11 | # License as published by the Free Software Foundation; either 12 | # version 2.1 of the License, or (at your option) any later version. 13 | # 14 | # This library is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # Lesser General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU Lesser General Public 20 | # License along with this library; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | # 23 | 24 | OCF_SUCCESS=0 25 | OCF_ERR_GENERIC=1 26 | OCF_ERR_ARGS=2 27 | OCF_ERR_UNIMPLEMENTED=3 28 | OCF_ERR_PERM=4 29 | OCF_ERR_INSTALLED=5 30 | OCF_ERR_CONFIGURED=6 31 | OCF_NOT_RUNNING=7 32 | 33 | # Non-standard values. 34 | # 35 | # OCF does not include the concept of master/slave resources so we 36 | # need to extend it so we can discover a resource's complete state. 37 | # 38 | # OCF_RUNNING_MASTER: 39 | # The resource is in "master" mode and fully operational 40 | # OCF_FAILED_MASTER: 41 | # The resource is in "master" mode but in a failed state 42 | # 43 | # The extra two values should only be used during a probe. 44 | # 45 | # Probes are used to discover resources that were started outside of 46 | # the CRM and/or left behind if the LRM fails. 47 | # 48 | # They can be identified in RA scripts by checking for: 49 | # [ "${__OCF_ACTION}" = "monitor" -a "${OCF_RESKEY_CRM_meta_interval}" = "0" ] 50 | # 51 | # Failed "slaves" should continue to use: OCF_ERR_GENERIC 52 | # Fully operational "slaves" should continue to use: OCF_SUCCESS 53 | # 54 | OCF_RUNNING_MASTER=8 55 | OCF_FAILED_MASTER=9 56 | -------------------------------------------------------------------------------- /heartbeat/ora-common.sh: -------------------------------------------------------------------------------- 1 | # ora-common.sh 2 | # 3 | # Description: Common code for oracle and oralsnr resource agents 4 | # 5 | # 6 | # Author: Dejan Muhamedagic 7 | # Support: users@clusterlabs.org 8 | # License: GNU General Public License (GPL) 9 | # Copyright: (C) 2012 Dejan Muhamedagic, SUSE/Attachmate 10 | # 11 | 12 | # Gather up information about our oracle instance 13 | 14 | rmtmpfiles() { 15 | rm -f $TMPFILES 16 | } 17 | 18 | ora_common_getconfig() { 19 | ORACLE_SID=$1 20 | # optional, defaults to whatever is in oratab 21 | ORACLE_HOME=$2 22 | # optional, defaults to the owner of ORACLE_HOME 23 | ORACLE_OWNER=$3 24 | # optional, defaults to $ORACLE_HOME/network/admin 25 | # (only the oralsnr may provide and use this one) 26 | TNS_ADMIN=$4 27 | 28 | # get ORACLE_HOME from /etc/oratab if not set 29 | if [ x = "x$ORACLE_HOME" ];then 30 | ORACLE_HOME=`awk -F: "/^$ORACLE_SID:/"'{print $2}' /etc/oratab` 31 | if [ -f /etc/oratab ]; then 32 | if [ x = "x$ORACLE_HOME" ];then 33 | handle_invalid_env $OCF_ERR_CONFIGURED "ORACLE_HOME could not be obtained from /etc/oratab. Please check the sid parameter." 34 | fi 35 | fi 36 | fi 37 | 38 | # there a better way to find out ORACLE_OWNER? 39 | [ x = "x$ORACLE_OWNER" ] && 40 | ORACLE_OWNER=`ls -ld $ORACLE_HOME/. 2>/dev/null | awk 'NR==1{print $3}'` 41 | 42 | # There are use-cases were users want to be able to set a custom TMS_ADMIN path. 43 | # When TNS_ADMIN is not provided, use the default path. 44 | [ x = "x$TNS_ADMIN" ] && 45 | TNS_ADMIN=$ORACLE_HOME/network/admin 46 | 47 | LD_LIBRARY_PATH=$ORACLE_HOME/lib 48 | LIBPATH=$ORACLE_HOME/lib 49 | PATH=$ORACLE_HOME/bin:$ORACLE_HOME/dbs:$PATH 50 | export ORACLE_SID ORACLE_HOME ORACLE_OWNER TNS_ADMIN 51 | export LD_LIBRARY_PATH LIBPATH 52 | 53 | ORA_ENVF=`mktemp` 54 | dumporaenv > $ORA_ENVF 55 | chmod 644 $ORA_ENVF 56 | TMPFILES="$ORA_ENVF" 57 | trap "rmtmpfiles" EXIT 58 | } 59 | 60 | ora_common_validate_all() { 61 | # Let's make sure a few important things are set... 62 | if [ x = "x$ORACLE_OWNER" ]; then 63 | ocf_log info "ORACLE_OWNER not set" 64 | return $OCF_ERR_INSTALLED 65 | fi 66 | 67 | US=`id -u -n` 68 | if [ $US != root -a $US != $ORACLE_OWNER ] 69 | then 70 | ocf_exit_reason "$0 must be run as root or $ORACLE_OWNER" 71 | return $OCF_ERR_PERM 72 | fi 73 | return 0 74 | } 75 | 76 | dumporaenv() { 77 | cat< 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 23 | 24 | 25 | 27 | 28 | 29 | 32 | 33 | 34 | 41 | -------------------------------------------------------------------------------- /heartbeat/send_ua.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This program manages IPv6 address with OCF Resource Agent standard. 4 | * 5 | * Author: Huang Zhen 6 | * Copyright (c) 2004 International Business Machines 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License 10 | * as published by the Free Software Foundation; either version 2 11 | * of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include /* for inet_pton */ 31 | #include /* for if_nametoindex */ 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | static void usage_send_ua(const char* self); 38 | static void byebye(int nsig); 39 | 40 | int 41 | main(int argc, char* argv[]) 42 | { 43 | char* ipv6addr; 44 | int count = UA_REPEAT_COUNT; 45 | int interval = 1000; /* default 1000 msec */ 46 | int ch; 47 | int i; 48 | char* cp; 49 | char* prov_ifname = NULL; 50 | struct in6_addr addr6; 51 | struct sigaction act; 52 | 53 | /* Check binary name */ 54 | if (argc < 4) { 55 | usage_send_ua(argv[0]); 56 | return OCF_ERR_ARGS; 57 | } 58 | while ((ch = getopt(argc, argv, "h?c:i:")) != EOF) { 59 | switch(ch) { 60 | case 'c': /* count option */ 61 | count = atoi(optarg); 62 | break; 63 | case 'i': /* interval option */ 64 | interval = atoi(optarg); 65 | break; 66 | case 'h': 67 | case '?': 68 | default: 69 | usage_send_ua(argv[0]); 70 | return OCF_ERR_ARGS; 71 | } 72 | } 73 | 74 | /* set termination signal */ 75 | memset(&act, 0, sizeof(struct sigaction)); 76 | act.sa_flags &= ~SA_RESTART; /* redundant - to stress syscalls should fail */ 77 | act.sa_handler = byebye; 78 | if ((sigemptyset(&act.sa_mask) < 0) || (sigaction(SIGTERM, &act, NULL) < 0)) { 79 | printf("ERROR: Could not set handler for signal: %s", strerror(errno)); 80 | return OCF_ERR_GENERIC; 81 | } 82 | 83 | ipv6addr = argv[optind]; 84 | 85 | if (ipv6addr == NULL) { 86 | printf("ERROR: Please set OCF_RESKEY_ipv6addr to the IPv6 address you want to manage."); 87 | usage_send_ua(argv[0]); 88 | return OCF_ERR_ARGS; 89 | } 90 | 91 | /* legacy option */ 92 | if ((cp = strchr(ipv6addr, '/'))) { 93 | *cp=0; 94 | } 95 | 96 | prov_ifname = argv[optind+2]; 97 | 98 | if (inet_pton(AF_INET6, ipv6addr, &addr6) <= 0) { 99 | printf("ERROR: Invalid IPv6 address [%s]", ipv6addr); 100 | usage_send_ua(argv[0]); 101 | return OCF_ERR_ARGS; 102 | } 103 | 104 | /* Check whether this system supports IPv6 */ 105 | if (access(IF_INET6, R_OK)) { 106 | printf("ERROR: No support for INET6 on this system."); 107 | return OCF_ERR_GENERIC; 108 | } 109 | 110 | /* Send unsolicited advertisement packet to neighbor */ 111 | for (i = 0; i < count; i++) { 112 | send_ua(&addr6, prov_ifname); 113 | usleep(interval * 1000); 114 | } 115 | 116 | return OCF_SUCCESS; 117 | } 118 | 119 | static void usage_send_ua(const char* self) 120 | { 121 | printf("usage: %s [-i[=Interval]] [-c[=Count]] [-h] IPv6-Address Prefix Interface\n",self); 122 | return; 123 | } 124 | 125 | /* Following code is copied from send_arp.c, linux-HA project. */ 126 | void 127 | byebye(int nsig) 128 | { 129 | (void)nsig; 130 | /* Avoid an "error exit" log message if we're killed */ 131 | exit(0); 132 | } 133 | 134 | -------------------------------------------------------------------------------- /heartbeat/shellfuncs.in: -------------------------------------------------------------------------------- 1 | # Author: Alan Robertson 2 | # Support: linux-ha-dev@lists.tummy.com 3 | # License: GNU Lesser General Public License (LGPL) 4 | # 5 | # Set these variables if they're not already set... 6 | # 7 | 8 | : ${HA_SBIN_DIR:=@sbindir@} 9 | : ${HA_NOARCHBIN:=@datadir@/heartbeat} 10 | : ${OCF_AGENTS:=@OCF_RA_DIR@/heartbeat/} 11 | 12 | export HA_DIR HA_RCDIR HA_FIFO HA_BIN 13 | export HA_DEBUGLOG HA_LOGFILE HA_LOGFACILITY 14 | export HA_DATEFMT HA_RESOURCEDIR HA_DOCDIR 15 | export OCF_AGENTS 16 | 17 | PATH=$HA_BIN:${HA_SBIN_DIR}:${HA_NOARCHBIN}:$PATH 18 | PATH=`echo $PATH | sed -e 's%::%%' -e 's%:\.:%:%' -e 's%^:%%' -e 's%^\.:%%'` 19 | export PATH 20 | 21 | # A suitable echo command 22 | Echo() { 23 | echo "$@" 24 | } 25 | 26 | # copy stdin (text) to FIFO, with surrounding ">>>" and "<<<" marker lines. 27 | # no args.; no result 28 | # Notes: 29 | # o Using "cat -" rather than "cat" simply for clarity. 30 | # o The trailing "| cat -" tries to hold things together as a single 31 | # write (which is probably preferable behaviour in this context). 32 | ha_clustermsg() { 33 | (echo ">>>"; cat -; echo "<<<") | cat - >> $HA_FIFO 34 | } 35 | 36 | ha_parameter() { 37 | VALUE=`sed -e 's%[ ][ ]*% %' -e 's%^ %%' -e 's%#.*%%' $HA_CF | 38 | grep -i "^$1 " | sed 's%[^ ]* %%'` 39 | if 40 | [ "X$VALUE" = X ] 41 | then 42 | 43 | case $1 in 44 | keepalive) VALUE=2;; 45 | deadtime) 46 | ka=`ha_parameter keepalive` 47 | VALUE=`expr $ka '*' 2 '+' 1`;; 48 | esac 49 | fi 50 | Echo $VALUE 51 | } 52 | 53 | BSD_Status() { 54 | local base=${1##*/} 55 | local pid 56 | 57 | ret_status=`/bin/ps -ao pid,command | grep $base | sed 's/ .*//'` 58 | 59 | if 60 | [ "$ret_status" != "" ] 61 | then 62 | echo "${base} is running..." 63 | return 0 64 | fi 65 | 66 | if 67 | [ -f $HA_VARRUN/${base}.pid ] 68 | then 69 | echo "${base} dead but pid file exists" 70 | return 1 71 | fi 72 | 73 | if 74 | [ -f /var/run/${base}.pid ] 75 | then 76 | echo "${base} dead but pid file exists" 77 | return 1 78 | fi 79 | 80 | if 81 | [ -f $HA_VARLOCK/${base}.pid ] 82 | then 83 | echo "${base} dead but lock file exists" 84 | return 2 85 | fi 86 | 87 | if 88 | [ -f /var/spool/lock/${base} ] 89 | then 90 | echo "${base} dead but lock file exists" 91 | return 2 92 | fi 93 | } 94 | 95 | # Now get the good stuff 96 | . @OCF_LIB_DIR@/heartbeat/ocf-shellfuncs 97 | -------------------------------------------------------------------------------- /include/IPv6addr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This program manages IPv6 address with OCF Resource Agent standard. 3 | * 4 | * Author: Huang Zhen 5 | * Copyright (c) 2004 International Business Machines 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef OCF_IPV6_HELPER_H 23 | #define OCF_IPV6_HELPER_H 24 | #include 25 | #include 26 | /* 27 | 0 No error, action succeeded completely 28 | 1 generic or unspecified error (current practice) 29 | The "monitor" operation shall return this for a crashed, hung or 30 | otherwise non-functional resource. 31 | 2 invalid or excess argument(s) 32 | Likely error code for validate-all, if the instance parameters 33 | do not validate. Any other action is free to also return this 34 | exit status code for this case. 35 | 3 unimplemented feature (for example, "reload") 36 | 4 user had insufficient privilege 37 | 5 program is not installed 38 | 6 program is not configured 39 | 7 program is not running 40 | 8 resource is running in "master" mode and fully operational 41 | 9 resource is in "master" mode but in a failed state 42 | */ 43 | #define OCF_SUCCESS 0 44 | #define OCF_ERR_GENERIC 1 45 | #define OCF_ERR_ARGS 2 46 | #define OCF_ERR_UNIMPLEMENTED 3 47 | #define OCF_ERR_PERM 4 48 | #define OCF_ERR_INSTALLED 5 49 | #define OCF_ERR_CONFIGURED 6 50 | #define OCF_NOT_RUNNING 7 51 | 52 | #define HWADDR_LEN 6 /* mac address length */ 53 | #define UA_REPEAT_COUNT 5 54 | #define BCAST_ADDR "ff02::1" 55 | #define IF_INET6 "/proc/net/if_inet6" 56 | 57 | int send_ua(struct in6_addr* src_ip, char* if_name); 58 | #endif 59 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 Andrew Beekhof 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | # 18 | 19 | MAINTAINERCLEANFILES = Makefile.in config.h.in config.h.in~ 20 | 21 | idir=$(includedir)/heartbeat 22 | i_HEADERS = agent_config.h 23 | 24 | noinst_HEADERS = config.h IPv6addr.h 25 | -------------------------------------------------------------------------------- /include/agent_config.h.in: -------------------------------------------------------------------------------- 1 | /* Where Resouce agents keep state files */ 2 | #undef HA_RSCTMPDIR 3 | 4 | -------------------------------------------------------------------------------- /ldirectord/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # ldirectord: Linux-HA heartbeat code 3 | # 4 | # Copyright (C) 2001 Michael Moerz 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | MAINTAINERCLEANFILES = Makefile.in 21 | CLEANFILES = ldirectord.8 22 | 23 | EXTRA_DIST = ldirectord ldirectord.cf 24 | 25 | SUBDIRS = logrotate.d init.d OCF systemd 26 | 27 | ldirectord.8: ldirectord 28 | $(POD2MAN) --section=8 $< > $@ 29 | 30 | sbin_SCRIPTS = ldirectord 31 | 32 | if BUILD_POD_DOC 33 | man_MANS = ldirectord.8 34 | endif 35 | 36 | harddir = $(sysconfdir)/ha.d/resource.d 37 | 38 | .PHONY: install-exec-hook 39 | install-exec-hook: 40 | $(INSTALL) -d $(DESTDIR)$(harddir) 41 | cd $(DESTDIR)$(harddir) && ln -s -f $(sbindir)/ldirectord . 42 | 43 | .PHONY: uninstall-hook 44 | uninstall-hook: 45 | rm -f $(DESTDIR)$(harddir)/ldirectord 46 | -------------------------------------------------------------------------------- /ldirectord/OCF/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # ldirectord: Linux-HA heartbeat code 3 | # 4 | # Copyright (C) 2007 Horms 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | MAINTAINERCLEANFILES = Makefile.in 21 | 22 | EXTRA_DIST = $(ocf_SCRIPTS) 23 | 24 | ocfdir = $(OCF_RA_DIR_PREFIX)/heartbeat 25 | 26 | ocf_SCRIPTS = ldirectord 27 | -------------------------------------------------------------------------------- /ldirectord/init.d/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # ldirectord: Linux-HA heartbeat code 3 | # 4 | # Copyright (C) 2001 Michael Moerz 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | MAINTAINERCLEANFILES = Makefile.in 21 | 22 | initddir = $(INITDIRPREFIX) 23 | 24 | initd_SCRIPTS = ldirectord 25 | 26 | EXTRA_DIST = $(initd_SCRIPTS) \ 27 | $(initd_SCRIPTS).debian $(initd_SCRIPTS).debian.default.in 28 | 29 | -------------------------------------------------------------------------------- /ldirectord/init.d/ldirectord.debian.default.in: -------------------------------------------------------------------------------- 1 | # @sysconfdir@/default/ldirectord 2 | # Defaults for the Debian ldirectord script 3 | 4 | # Set to the configuration file 5 | # May be absolute or relative to @sysconfdir@/ha.d/ 6 | CONFIG_FILE=ldirectord.cf 7 | -------------------------------------------------------------------------------- /ldirectord/init.d/ldirectord.debian.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | ### BEGIN INIT INFO 4 | # Provides: ldirectord 5 | # Required-Start: $remote_fs $syslog 6 | # Required-Stop: $remote_fs $syslog 7 | # Default-Start: 2 3 4 5 8 | # Default-Stop: 0 1 6 9 | ### END INIT INFO 10 | # 11 | # Author: Horms 12 | # 13 | # Debian init script for ldirectord 14 | # 15 | 16 | NAME=ldirectord 17 | DAEMON="@sbindir@/$NAME" 18 | CONFIG="@sysconfdir@/default/$NAME" 19 | 20 | test -x $DAEMON || exit 0 21 | 22 | CONFIG_FILE="" 23 | [ -f "$CONFIG" ] && . "$CONFIG" 24 | CONFIG_FILE="${CONFIG_FILE:=ldirectord.cf}" 25 | 26 | case "$1" in 27 | start|stop|restart|try-restart|status|reload|force-reload) 28 | exec "$DAEMON" $1 29 | ;; 30 | *) 31 | echo "Usage: /etc/init.d/$NAME" \ 32 | "{start|stop|restart|try-restart|status|reload|force-reload}" >&2 33 | exit 1 34 | ;; 35 | esac 36 | -------------------------------------------------------------------------------- /ldirectord/init.d/ldirectord.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # ldirectord Linux Director Daemon 4 | # 5 | # chkconfig: - 92 40 6 | # description: Start and stop ldirectord on non-heartbeat systems 7 | # Using the config file /etc/ha.d/ldirectord.cf 8 | # Normally ldirectord is started and stopped by heartbeat 9 | # 10 | # processname: ldirectord 11 | # config: /etc/ha.d/ldirectord.cf 12 | # 13 | # Author: Horms 14 | # Released: April 2000 15 | # Licence: GNU General Public Licence 16 | # 17 | ### BEGIN INIT INFO 18 | # Provides: ldirectord 19 | # Required-Start: $syslog $network $remote_fs 20 | # Required-Stop: $syslog $network $remote_fs 21 | # Should-Start: $time sshd 22 | # Default-Start: 3 5 23 | # Default-Stop: 0 1 2 6 24 | # Short-Description: Control Linux Virtual Server via ldirectord on non-heartbeat systems 25 | # Description: Starts (and stops) the ldirectord service if 26 | # running outside a heartbeat managed environment. 27 | # ldirectord manages the Linux Virtual Server component for 28 | # TCP/UDP load-balancing. 29 | # It uses the config file @sysconfdir@/ha.d/ldirectord.cf. 30 | ### END INIT INFO 31 | 32 | DAEMON=@sbindir@/ldirectord 33 | 34 | # Source function library. 35 | if 36 | [ -f /etc/rc.d/init.d/functions ] 37 | then 38 | . /etc/rc.d/init.d/functions 39 | fi 40 | 41 | [ -x $DAEMON ] || exit 0 42 | 43 | action() { 44 | echo -n "$1... " 45 | shift 46 | $@ 47 | stat=$? 48 | if [ $stat = 0 ]; then 49 | echo success 50 | else 51 | echo failure 52 | fi 53 | return $stat 54 | } 55 | 56 | ###################################################################### 57 | # Read arument and take action as appropriate 58 | ###################################################################### 59 | 60 | case "$1" in 61 | start) 62 | action "Starting ldirectord" $DAEMON start 63 | touch /var/lock/subsys/ldirectord 64 | ;; 65 | stop) 66 | action "Stopping ldirectord" $DAEMON stop 67 | rm -f /var/lock/subsys/ldirectord 68 | ;; 69 | restart) 70 | action "Restarting ldirectord" $DAEMON restart 71 | ;; 72 | try-restart) 73 | action "Try-Restarting ldirectord" $DAEMON try-restart 74 | ;; 75 | status) 76 | $DAEMON status 77 | ;; 78 | reload) 79 | action "Reloading ldirectord" $DAEMON reload 80 | ;; 81 | force-reload) 82 | action "Force-Reloading ldirectord" $DAEMON force-reload 83 | ;; 84 | *) 85 | echo "Usage: ldirectord 86 | {start|stop|restart|try-restart|status|reload|force-reload}" 87 | exit 1 88 | esac 89 | 90 | exit $? 91 | -------------------------------------------------------------------------------- /ldirectord/logrotate.d/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # ldirectord: Linux-HA heartbeat code 3 | # 4 | # Copyright (C) 2001 Michael Moerz 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | MAINTAINERCLEANFILES = Makefile.in 21 | 22 | EXTRA_DIST = ldirectord 23 | 24 | logrotatedir = $(sysconfdir)/logrotate.d 25 | 26 | logrotate_DATA = ldirectord 27 | -------------------------------------------------------------------------------- /ldirectord/logrotate.d/ldirectord: -------------------------------------------------------------------------------- 1 | /var/log/ldirectord.log { 2 | missingok 3 | } 4 | -------------------------------------------------------------------------------- /ldirectord/systemd/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # ldirectord: Linux-HA heartbeat code 3 | # 4 | # Copyright (C) 2001 Michael Moerz 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | MAINTAINERCLEANFILES = Makefile.in 21 | 22 | if HAVE_SYSTEMD 23 | systemdsystemunitdir = $(SYSTEMD_UNIT_DIR) 24 | systemdsystemunit_DATA = ldirectord.service 25 | endif 26 | -------------------------------------------------------------------------------- /ldirectord/systemd/ldirectord.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Monitor and administer real servers in a LVS cluster of load balanced virtual servers 3 | Documentation=man:ldirectord(8) 4 | 5 | [Service] 6 | ExecStart=@sbindir@/ldirectord start 7 | ExecStartPost=/usr/bin/touch /var/lock/subsys/ldirectord 8 | ExecStop=@sbindir@/ldirectord stop 9 | ExecStopPost=@RM@ -f /var/lock/subsys/ldirectord 10 | ExecReload=@sbindir@/ldirectord reload 11 | PIDFile=/var/run/ldirectord.ldirectord.pid 12 | Type=forking 13 | KillMode=none 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /m4/PKG_CHECK_VAR.m4: -------------------------------------------------------------------------------- 1 | dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, 2 | dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 3 | dnl ------------------------------------------- 4 | dnl Since: 0.28 5 | dnl 6 | dnl Retrieves the value of the pkg-config variable for the given module. 7 | dnl 8 | dnl Origin (declared license: GPLv2+ with less restrictive exception): 9 | dnl https://cgit.freedesktop.org/pkg-config/tree/pkg.m4.in?h=pkg-config-0.29.1#n261 10 | dnl (AS_VAR_COPY replaced with backward-compatible equivalent and guard 11 | dnl to prefer system-wide variant by Jan Pokorny ) 12 | 13 | m4_ifndef([PKG_CHECK_VAR],[ 14 | AC_DEFUN([PKG_CHECK_VAR], 15 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 16 | AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl 17 | 18 | _PKG_CONFIG([$1], [variable="][$3]["], [$2]) 19 | dnl AS_VAR_COPY([$1], [pkg_cv_][$1]) 20 | $1=AS_VAR_GET([pkg_cv_][$1]) 21 | 22 | AS_VAR_IF([$1], [""], [$5], [$4])dnl 23 | ])dnl PKG_CHECK_VAR 24 | ])dnl m4_ifndef 25 | -------------------------------------------------------------------------------- /m4/ac_python_module.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis AC_PYTHON_MODULE(modname[, fatal]) 2 | dnl 3 | dnl Checks for Python module. 4 | dnl 5 | dnl If fatal is non-empty then absence of a module will trigger an 6 | dnl error. 7 | dnl 8 | dnl @category InstalledPackages 9 | dnl @author Andrew Collier . 10 | dnl @version 2004-07-14 11 | dnl @license AllPermissive 12 | 13 | AC_DEFUN([AC_PYTHON_MODULE],[ 14 | AC_MSG_CHECKING(python module: $1) 15 | $PYTHON -c "import $1" 2>/dev/null 16 | if test $? -eq 0; 17 | then 18 | AC_MSG_RESULT(yes) 19 | eval AS_TR_CPP(HAVE_PYMOD_$1)=yes 20 | else 21 | AC_MSG_RESULT(no) 22 | eval AS_TR_CPP(HAVE_PYMOD_$1)=no 23 | # 24 | if test -n "$2" 25 | then 26 | AC_MSG_ERROR(failed to find required module $1) 27 | exit 1 28 | fi 29 | fi 30 | ]) 31 | -------------------------------------------------------------------------------- /make/release.mk: -------------------------------------------------------------------------------- 1 | # to build official release tarballs, handle tagging and publish. 2 | 3 | # signing key 4 | gpgsignkey=0x6CE95CA7 5 | 6 | project=resource-agents 7 | 8 | all: checks setup tag tarballs sha256 sign 9 | 10 | checks: 11 | ifeq (,$(version)) 12 | @echo ERROR: need to define version= 13 | @exit 1 14 | endif 15 | @if [ ! -d .git ]; then \ 16 | echo This script needs to be executed from top level cluster git tree; \ 17 | exit 1; \ 18 | fi 19 | 20 | setup: checks 21 | ./autogen.sh 22 | ./configure 23 | make maintainer-clean 24 | 25 | tag: setup ./tag-$(version) 26 | 27 | tag-$(version): 28 | ifeq (,$(release)) 29 | @echo Building test release $(version), no tagging 30 | else 31 | git tag -a -m "v$(version) release" v$(version) HEAD 32 | @touch $@ 33 | endif 34 | 35 | tarballs: tag 36 | ./autogen.sh 37 | ./configure 38 | make distcheck 39 | 40 | sha256: tarballs $(project)-$(version).sha256 41 | 42 | $(project)-$(version).sha256: 43 | ifeq (,$(release)) 44 | @echo Building test release $(version), no sha256 45 | else 46 | sha256sum $(project)-$(version)*tar* | sort -k2 > $@ 47 | endif 48 | 49 | sign: sha256 $(project)-$(version).sha256.asc 50 | 51 | $(project)-$(version).sha256.asc: $(project)-$(version).sha256 52 | ifeq (,$(release)) 53 | @echo Building test release $(version), no sign 54 | else 55 | gpg --default-key $(gpgsignkey) \ 56 | --detach-sign \ 57 | --armor \ 58 | $< 59 | endif 60 | 61 | publish: 62 | ifeq (,$(release)) 63 | @echo Building test release $(version), no publishing! 64 | else 65 | git push --tags origin 66 | scp $(project)-$(version).* \ 67 | fedorahosted.org:$(project) 68 | @echo Hey you!.. yeah you looking somewhere else! 69 | @echo remember to update the wiki and send the email to cluster-devel and linux-cluster 70 | endif 71 | 72 | clean: 73 | rm -rf $(project)*.tar.* $(project)*.sha* tag-* 74 | -------------------------------------------------------------------------------- /make/spellcheck-ignore: -------------------------------------------------------------------------------- 1 | personal_ws-1.1 en 500 2 | abap 3 | acpi 4 | addrlabel 5 | arping 6 | ase 7 | asm 8 | async 9 | awscli 10 | backend 11 | basename 12 | cfg 13 | chroot 14 | chrooted 15 | cib 16 | cidr 17 | cli 18 | clvmd 19 | cmd 20 | cmirrord 21 | conf 22 | config 23 | conntrackd 24 | corosync 25 | crm 26 | cron 27 | csync 28 | ctdb 29 | ctl 30 | dev 31 | devs 32 | dhcp 33 | dhcpd 34 | dirs 35 | dlm 36 | dname 37 | dns 38 | edirectory 39 | exportfs 40 | failover 41 | filesystem 42 | fio 43 | fsck 44 | fsid 45 | fstype 46 | ftpd 47 | fullname 48 | galera 49 | gid 50 | hostname 51 | init 52 | ipaddr 53 | ipc 54 | iptables 55 | iscsi 56 | isql 57 | jboss 58 | jira 59 | jvm 60 | kamailio 61 | kamctl 62 | ldap 63 | ldapsearch 64 | libvirt 65 | libvirtd 66 | localhost 67 | lockd 68 | logfile 69 | loopback 70 | lvm 71 | lvmlockd 72 | lxc 73 | lxd 74 | malloc 75 | manpage 76 | minio 77 | mkdir 78 | mpathpersist 79 | multipath 80 | multistate 81 | mybackend 82 | mysqld 83 | nagios 84 | netmask 85 | nfs 86 | nfsd 87 | ng 88 | ng's 89 | nginx 90 | nof 91 | nsenter 92 | ocf 93 | ocs 94 | olcpidfile 95 | openstack 96 | openvz 97 | oradebug 98 | orauser 99 | param 100 | params 101 | pcmk 102 | pgsql 103 | pid 104 | pidfile 105 | pingd 106 | pipefs 107 | pkill 108 | podman 109 | portblock 110 | postfix 111 | proftpd 112 | prout 113 | qdisk 114 | qemu 115 | rabbitmq 116 | rk 117 | rkt 118 | rpc 119 | rsync 120 | rsyncd 121 | rsyslog 122 | rundir 123 | runtime 124 | sanlock 125 | sapcontrol 126 | saphostagent 127 | sapinstance 128 | sark 129 | sbin 130 | sg 131 | sigkill 132 | sigterm 133 | slapd 134 | statusurl 135 | stderr 136 | stdout 137 | stonith 138 | subdirectory 139 | subnet 140 | sunrpc 141 | sybase 142 | symlink 143 | sysconfig 144 | syslog 145 | systemd 146 | tcp 147 | udp 148 | ulimit 149 | uri 150 | usr 151 | utils 152 | varnishd 153 | vcl 154 | virsh 155 | virtualized 156 | vlan 157 | vmware 158 | vmx 159 | vsftpd 160 | wget 161 | whitespace 162 | xen 163 | xinetd 164 | zabbix 165 | zfs 166 | -------------------------------------------------------------------------------- /resource-agents.pc.in: -------------------------------------------------------------------------------- 1 | ocfrootdir = @OCF_ROOT_DIR@ 2 | ra_api_dtd = @datadir@/@PACKAGE_NAME@/ra-api-1.dtd 3 | ra_tmp_dir = @HA_RSCTMPDIR@ 4 | 5 | Name: @PACKAGE_NAME@ 6 | Description: resource agents for use with Pacemaker 7 | URL: https://github.com/ClusterLabs/resource-agents/ 8 | Version: @PACKAGE_VERSION@ 9 | -------------------------------------------------------------------------------- /rgmanager/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | # 18 | 19 | MAINTAINERCLEANFILES = Makefile.in 20 | 21 | SUBDIRS = src 22 | -------------------------------------------------------------------------------- /rgmanager/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | # 18 | 19 | MAINTAINERCLEANFILES = Makefile.in 20 | 21 | SUBDIRS = resources 22 | -------------------------------------------------------------------------------- /rgmanager/src/resources/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | # 18 | 19 | MAINTAINERCLEANFILES = Makefile.in 20 | 21 | SUBDIRS = utils 22 | 23 | TARGET = fs.sh 24 | 25 | RESOURCES = service.sh ip.sh nfsclient.sh nfsexport.sh \ 26 | script.sh netfs.sh clusterfs.sh smb.sh \ 27 | apache.sh openldap.sh samba.sh mysql.sh \ 28 | postgres-8.sh tomcat-5.sh lvm.sh \ 29 | vm.sh SAPInstance SAPDatabase named.sh db2.sh \ 30 | ASEHAagent.sh drbd.sh nfsserver.sh \ 31 | tomcat-6.sh orainstance.sh oralistener.sh oracledb.sh \ 32 | bind-mount.sh oradg.sh 33 | 34 | METADATA = apache.metadata openldap.metadata samba.metadata \ 35 | mysql.metadata postgres-8.metadata \ 36 | tomcat-5.metadata named.metadata lvm.metadata \ 37 | drbd.metadata tomcat-6.metadata \ 38 | orainstance.metadata oralistener.metadata \ 39 | oradg.metadata 40 | 41 | HELPERS = ocf-shellfuncs svclib_nfslock \ 42 | lvm_by_lv.sh lvm_by_vg.sh 43 | 44 | DTD = ra-api-1-modified.dtd 45 | 46 | XSL = ra2man.xsl ra2ref.xsl ra2rng.xsl 47 | 48 | RESRNG = resources.rng.head resources.rng.mid resources.rng.tail 49 | 50 | EXTRA_DIST = $(TARGET:=.in) \ 51 | $(RESOURCES) \ 52 | $(METADATA) \ 53 | $(HELPERS) \ 54 | $(DTD) \ 55 | $(XSL) \ 56 | $(RESRNG) 57 | 58 | rasdir = ${CLUSTERDATA} 59 | 60 | ras_SCRIPTS = $(TARGET) \ 61 | $(RESOURCES) \ 62 | $(HELPERS) 63 | 64 | ras_DATA = $(METADATA) 65 | 66 | rngdir = ${CLUSTERDATA}/relaxng 67 | 68 | rng_DATA = $(DTD) $(XSL) $(RESRNG) 69 | 70 | $(TARGET): 71 | cat $(abs_srcdir)/$@.in | sed \ 72 | -e 's#@''LOGDIR@#${LOGDIR}#g' \ 73 | > $@.out 74 | chmod +x $@.out 75 | mv $@.out $@ 76 | 77 | clean-local: 78 | rm -f $(TARGET) resources.rng 79 | 80 | ras-validation: $(RESOURCES) $(TARGET) $(DTD) 81 | @echo Validating resource agent meta-data 82 | @for f in $(RESOURCES); do \ 83 | echo " $(abs_srcdir)/$$f "; \ 84 | bash $(abs_srcdir)/$$f meta-data | xmllint --dtdvalid \ 85 | $(abs_srcdir)/$(DTD) --noout -; \ 86 | if [ $$? -ne 0 ]; then exit 1; fi \ 87 | done 88 | @for f in $(TARGET); do \ 89 | echo " $(abs_builddir)/$$f "; \ 90 | bash $(abs_builddir)/$$f meta-data | xmllint --dtdvalid \ 91 | $(abs_srcdir)/$(DTD) --noout -; \ 92 | if [ $$? -ne 0 ]; then exit 1; fi \ 93 | done 94 | 95 | # 96 | # Schema maintenance. Run 'make resources.rng' and paste it in to 97 | # config/tools/xml/cluster.rng.in where it says 'autogenerated'. 98 | # 99 | # resources.rng.* should never be distributed by themselves. 100 | # 101 | resources.rng: $(RESOURCES) $(TARGET) utils/config-utils.sh 102 | resources.rng: $(XSL) $(RESRNG) 103 | rm -f resources.rng 104 | cat resources.rng.head >> resources.rng 105 | @echo Generating per-resource RelaxNG information... 106 | @for f in $(RESOURCES) $(TARGET); do \ 107 | echo " ./$$f"; \ 108 | bash ./$$f meta-data | xsltproc ra2rng.xsl - >> resources.rng; \ 109 | done 110 | cat resources.rng.mid >> resources.rng 111 | @echo Generating per-resource RelaxNG reference information... 112 | @for f in $(RESOURCES) $(TARGET); do \ 113 | echo " ./$$f"; \ 114 | bash ./$$f meta-data | xsltproc ra2ref.xsl - >> resources.rng; \ 115 | done 116 | cat resources.rng.tail >> resources.rng 117 | 118 | utils/config-utils.sh: 119 | make -C utils config-utils.sh 120 | -------------------------------------------------------------------------------- /rgmanager/src/resources/apache.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 | 7 | This defines an instance of Apache web server 8 | 9 | 10 | Defines an Apache web server 11 | 12 | 13 | 14 | 15 | 16 | Define a name for use in <IfDefine name> directive. 17 | 18 | 19 | Name 20 | 21 | 22 | 23 | 24 | 25 | 26 | Define the full path to the httpd binary. 27 | 28 | 29 | httpd binary 30 | 31 | 32 | 33 | 34 | 35 | 36 | Define an alternate initial ServerRoot 37 | 38 | 39 | Initial ServerRoot 40 | 41 | 42 | 43 | 44 | 45 | 46 | Define an alternate ServerConfigFile 47 | 48 | 49 | Initial ServerConfigFile 50 | 51 | 52 | 53 | 54 | 55 | 56 | Other command-line options for httpd 57 | 58 | 59 | Other command-line options for httpd 60 | 61 | 62 | 63 | 64 | 65 | 66 | Wait X seconds for correct end of service shutdown 67 | 68 | 69 | Wait X seconds for correct end of service shutdown 70 | 71 | 72 | 73 | 74 | 75 | 76 | Inherit the service name. We need to know 77 | the service name in order to determine file 78 | systems and IPs for this service. 79 | 80 | 81 | Inherit the service name. 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /rgmanager/src/resources/db2.sh.in: -------------------------------------------------------------------------------- 1 | #!@BASH_SHELL@ 2 | # 3 | # Copyright (c) 2011 Holger Teutsch 4 | # Copyright (c) 2014 David Vossel 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | 21 | # NOTE: 22 | # 23 | # This agent is a wrapper around the heartbeat/db2 agent which limits the heartbeat 24 | # db2 agent to Standard role support. This allows cluster managers such as rgmanager 25 | # which do not have multi-state resource support to manage db2 instances with 26 | # a limited feature set. 27 | # 28 | 29 | export LC_ALL=C 30 | export LANG=C 31 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin 32 | . $(dirname $0)/ocf-shellfuncs 33 | 34 | meta_data() { 35 | cat < 37 | 38 | 39 | 1.0 40 | 41 | Resource Agent that manages an IBM DB2 LUW databases in Standard role. Multiple partitions are supported. 42 | 43 | When partitions are in use, each partition must be configured as a separate primitive resource. 44 | 45 | 46 | Resource Agent that manages an IBM DB2 LUW databases in Standard role with multiple partition support. 47 | 48 | 49 | 50 | 51 | The instance of the database(s). 52 | 53 | instance 54 | 55 | 56 | 57 | 58 | List of databases to be managed, e.g "db1 db2". 59 | Defaults to all databases in the instance. 60 | 61 | List of databases to be managed 62 | 63 | 64 | 65 | 66 | The number of the partition (DBPARTITIONNUM) to be managed. 67 | 68 | database partition number (DBPARTITIONNUM) 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | END 83 | } 84 | 85 | heartbeat_db2_wrapper() 86 | { 87 | # default heartbeat agent ocf root. 88 | export OCF_ROOT=/usr/lib/ocf 89 | heartbeat_db2="${OCF_ROOT}/resource.d/heartbeat/db2" 90 | 91 | if ! [ -a $heartbeat_db2 ]; then 92 | echo "heartbeat db2 agent not found at '${heartbeat_db2}'" 93 | exit $OCF_ERR_INSTALLED 94 | fi 95 | 96 | $heartbeat_db2 $1 97 | } 98 | 99 | case $1 in 100 | meta-data) 101 | meta_data 102 | exit 0 103 | ;; 104 | validate-all) 105 | heartbeat_db2_wrapper $1 106 | exit $? 107 | ;; 108 | start) 109 | heartbeat_db2_wrapper $1 110 | exit $? 111 | ;; 112 | stop) 113 | heartbeat_db2_wrapper $1 114 | exit $? 115 | ;; 116 | status|monitor) 117 | heartbeat_db2_wrapper "monitor" 118 | exit $? 119 | ;; 120 | restart) 121 | heartbeat_db2_wrapper "stop" 122 | rc=$? 123 | if [ $rc -ne 0 ]; then 124 | exit $rc 125 | fi 126 | heartbeat_db2_wrapper "start" 127 | exit $? 128 | ;; 129 | *) 130 | echo "Usage: db2.sh {start|stop|monitor|validate-all|meta-data}" 131 | exit $OCF_ERR_UNIMPLEMENTED 132 | ;; 133 | esac 134 | -------------------------------------------------------------------------------- /rgmanager/src/resources/drbd.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | This is a DRBD resource. The resource must be configured 7 | in the configuration file (/etc/drbd.conf), and the 8 | DRBD kernel module must be loaded. 9 | 10 | 11 | 12 | This is a DRBD resource. 13 | 14 | 15 | 16 | 17 | 18 | Symbolic name for this resource. 19 | 20 | 21 | Cluster resource name 22 | 23 | 24 | 25 | 26 | 27 | The DRBD resource name, as specified in /etc/drbd.conf. 28 | 29 | 30 | DRBD resource name 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /rgmanager/src/resources/drbd.sh.in: -------------------------------------------------------------------------------- 1 | #!@BASH_SHELL@ 2 | # 3 | # Copyright LINBIT, 2008 4 | # 5 | # This program is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU General Public License as published by the 7 | # Free Software Foundation; either version 2, or (at your option) any 8 | # later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; see the file COPYING. If not, write to the 17 | # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 18 | # MA 02139, USA. 19 | # 20 | 21 | # 22 | # DRBD resource management using the drbdadm utility. 23 | # 24 | 25 | LC_ALL=C 26 | LANG=C 27 | PATH=/bin:/sbin:/usr/bin:/usr/sbin 28 | export LC_ALL LANG PATH 29 | 30 | . $(dirname $0)/ocf-shellfuncs 31 | 32 | drbd_verify_all() 33 | { 34 | # Do we have the drbdadm utility? 35 | if ! which drbdadm >/dev/null 2>&1 ; then 36 | ocf_log error "drbdadm not installed, not found in PATH ($PATH), or not executable." 37 | return $OCF_ERR_INSTALLED 38 | fi 39 | 40 | # Is drbd loaded? 41 | if ! grep drbd /proc/modules >/dev/null 2>&1; then 42 | ocf_log error "drbd not found in /proc/modules. Do you need to modprobe?" 43 | return $OCF_ERR_INSTALLED 44 | fi 45 | 46 | # Do we have the "resource" parameter? 47 | if [ -n "$OCF_RESKEY_resource" ]; then 48 | 49 | # Can drbdadm parse the resource name? 50 | if ! drbdadm sh-dev $OCF_RESKEY_resource >/dev/null 2>&1; then 51 | ocf_log error "DRBD resource \"$OCF_RESKEY_resource\" not found." 52 | return $OCF_ERR_CONFIGURED 53 | fi 54 | 55 | # Is the backing device a locally available block device? 56 | backing_dev=$(drbdadm sh-ll-dev $OCF_RESKEY_resource) 57 | if [ ! -b $backing_dev ]; then 58 | ocf_log error "Backing device for DRBD resource \"$OCF_RESKEY_resource\" ($backing_dev) not found or not a block device." 59 | return $OCF_ERR_INSTALLED 60 | fi 61 | 62 | fi 63 | 64 | return 0 65 | } 66 | 67 | drbd_status() { 68 | role=$(drbdadm role $OCF_RESKEY_resource) 69 | case $role in 70 | Primary/*) 71 | return $OCF_SUCCESS 72 | ;; 73 | Secondary/*) 74 | return $OCF_NOT_RUNNING 75 | ;; 76 | 77 | esac 78 | return $OCF_ERR_GENERIC 79 | } 80 | 81 | drbd_promote() { 82 | drbdadm primary $OCF_RESKEY_resource || return $? 83 | } 84 | 85 | drbd_demote() { 86 | drbdadm secondary $OCF_RESKEY_resource || return $? 87 | } 88 | 89 | 90 | if [ -z "$OCF_CHECK_LEVEL" ]; then 91 | OCF_CHECK_LEVEL=0 92 | fi 93 | 94 | # This one doesn't need to pass the verify check 95 | case $1 in 96 | meta-data) 97 | cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'` && exit 0 98 | exit $OCF_ERR_GENERIC 99 | ;; 100 | esac 101 | 102 | # Everything else does 103 | drbd_verify_all || exit $? 104 | case $1 in 105 | start) 106 | if drbd_status; then 107 | ocf_log debug "DRBD resource ${OCF_RESKEY_resource} already configured" 108 | exit 0 109 | fi 110 | drbd_promote 111 | if [ $? -ne 0 ]; then 112 | exit $OCF_ERR_GENERIC 113 | fi 114 | 115 | exit $? 116 | ;; 117 | stop) 118 | if drbd_status; then 119 | drbd_demote 120 | if [ $? -ne 0 ]; then 121 | exit $OCF_ERR_GENERIC 122 | fi 123 | else 124 | ocf_log debug "DRBD resource ${OCF_RESKEY_resource} is not configured" 125 | fi 126 | exit 0 127 | ;; 128 | status|monitor) 129 | drbd_status 130 | exit $? 131 | ;; 132 | restart) 133 | $0 stop || exit $OCF_ERR_GENERIC 134 | $0 start || exit $OCF_ERR_GENERIC 135 | exit 0 136 | ;; 137 | verify-all) 138 | exit 0 139 | ;; 140 | *) 141 | echo "usage: $0 {start|stop|status|monitor|restart|meta-data|verify-all}" 142 | exit $OCF_ERR_GENERIC 143 | ;; 144 | esac 145 | -------------------------------------------------------------------------------- /rgmanager/src/resources/lvm.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | This defines a LVM volume group that is ... 7 | 8 | 9 | 10 | LVM Failover script 11 | 12 | 13 | 14 | 15 | 16 | Unique name for this LVM resource 17 | 18 | 19 | Name 20 | 21 | 22 | 23 | 24 | 25 | 26 | Name of the volume group being managed 27 | 28 | 29 | Volume group name 30 | 31 | 32 | 33 | 34 | 35 | 36 | Name of the logical volume being managed. This 37 | parameter is optional if there are more than one 38 | logical volumes in the volume group to be managed. 39 | 40 | 41 | Logical Volume name (optional). 42 | 43 | 44 | 45 | 46 | 47 | 48 | If set and the clean up of the tags fails, the node will 49 | immediately reboot. 50 | 51 | 52 | Fence the node if it is not able to clean up LVM tags 53 | 54 | 55 | 56 | 57 | 58 | 59 | If set and unmounting the file system fails, the node will 60 | try to kill lockd and issue reclaims across all remaining 61 | network interface cards. 62 | 63 | 64 | Enable NFS lock workarounds 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /rgmanager/src/resources/mysql.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 | 7 | This defines an instance of MySQL database server 8 | 9 | 10 | Defines a MySQL database server 11 | 12 | 13 | 14 | 15 | 16 | Define a name 17 | 18 | 19 | Name 20 | 21 | 22 | 23 | 24 | 25 | 26 | Define configuration file 27 | 28 | 29 | Define configuration file 30 | 31 | 32 | 33 | 34 | 35 | 36 | Define an IP address for MySQL 37 | 38 | 39 | Define an IP address for MySQL server. If the address 40 | is not given then first IP address from the service is taken. 41 | 42 | 43 | 44 | 45 | 46 | 47 | Other command-line options for mysqld 48 | 49 | 50 | Other command-line options for mysqld 51 | 52 | 53 | 54 | 55 | 56 | 57 | Wait X seconds for correct end of service startup 58 | 59 | 60 | Wait X seconds for correct end of service startup 61 | 62 | 63 | 64 | 65 | 66 | 67 | Wait X seconds for correct end of service shutdown 68 | 69 | 70 | Wait X seconds for correct end of service shutdown 71 | 72 | 73 | 74 | 75 | 76 | 77 | Inherit the service name. We need to know 78 | the service name in order to determine file 79 | systems and IPs for this service. 80 | 81 | 82 | Inherit the service name. 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /rgmanager/src/resources/named.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | This defines an instance of DNS named server 7 | 8 | 9 | Defines an instance of named server 10 | 11 | 12 | 13 | 14 | 15 | Specifies a service name for logging and other purposes 16 | 17 | 18 | Name 19 | 20 | 21 | 22 | 23 | 24 | 25 | Define absolute path to configuration file 26 | 27 | 28 | Config File 29 | 30 | 31 | 32 | 33 | 34 | 35 | Simplified Database Backend 36 | 37 | 38 | Simplified Database Backend 39 | 40 | 41 | 42 | 43 | 44 | 45 | Other command-line options for named 46 | 47 | 48 | Other command-line options for named 49 | 50 | 51 | 52 | 53 | 54 | 55 | Other command-line options for named 56 | 57 | 58 | Other command-line options for named 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Update 'notify-source', 'transfer-source', and 'query-source' to match 67 | the cluster ip associated with this service. 68 | 69 | 70 | Use cluster ip as source. 71 | 72 | 73 | 74 | 75 | 76 | 77 | Wait X seconds for correct end of service shutdown 78 | 79 | 80 | Wait X seconds for correct end of service shutdown 81 | 82 | 83 | 84 | 85 | 86 | 87 | Inherit the service name. We need to know 88 | the service name in order to determine file 89 | systems and IPs for this service. 90 | 91 | 92 | Inherit the service name. 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /rgmanager/src/resources/openldap.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | This defines an instance of Open LDAP 7 | 8 | 9 | Defines an Open LDAP server 10 | 11 | 12 | 13 | 14 | 15 | Specifies a service name for logging and other purposes 16 | 17 | 18 | Name 19 | 20 | 21 | 22 | 23 | 24 | 25 | Define absolute path to configuration file 26 | 27 | 28 | Config File 29 | 30 | 31 | 32 | 33 | 34 | 35 | Serve URL list. Default behaviour of URL list is changed and 36 | enhanced. eg. ldap:/// won't bind all IP address on the 37 | computer but to all IP addresses in service. Using 38 | ldap://0:port/ will bind to all IP addresses for service on 39 | given port. 40 | 41 | 42 | URL list 43 | 44 | 45 | 46 | 47 | 48 | 49 | Other command-line options for slapd 50 | 51 | 52 | Other command-line options for slapd 53 | 54 | 55 | 56 | 57 | 58 | 59 | Wait X seconds for correct end of service shutdown 60 | 61 | 62 | Wait X seconds for correct end of service shutdown 63 | 64 | 65 | 66 | 67 | 68 | 69 | Inherit the service name. We need to know 70 | the service name in order to determine file 71 | systems and IPs for this service. 72 | 73 | 74 | Inherit the service name. 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /rgmanager/src/resources/oradg.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 1.0 7 | 8 | 9 | Oracle Data Guard Failover Instance 10 | 11 | 12 | Oracle Data Guard Failover Instance 13 | 14 | 15 | 16 | 17 | 18 | Instance name (SID) of oracle instance 19 | 20 | 21 | Oracle SID 22 | 23 | 24 | 25 | 26 | 27 | 28 | Oracle user name. This is the user name of the Oracle 29 | user which the Oracle instance runs as. 30 | 31 | 32 | Oracle User Name 33 | 34 | 35 | 36 | 37 | 38 | 39 | This is the Oracle database home directory. 40 | This is configured when you install Oracle. 41 | 42 | 43 | Oracle Home Directory 44 | 45 | 46 | 47 | 48 | 49 | 50 | List of Oracle listeners which will be started with 51 | the database instance. Listener names are separated by 52 | whitespace. Defaults to empty which disables listeners. 53 | 54 | 55 | Oracle listeners 56 | 57 | 58 | 59 | 60 | 61 | 62 | Virtual hostname for DB Console startup 63 | 64 | 65 | Virtual hostname for DB Console 66 | 67 | 68 | 69 | 70 | 71 | 72 | Location for lockfile which will be used for checking if 73 | the Oracle should be running or not. Defaults to location 74 | under /tmp. 75 | 76 | 77 | Pathname for lockfile 78 | 79 | 80 | 81 | 82 | 83 | 84 | Full path to the directory that contains the Oracle 85 | listener tnsnames.ora configuration file. The shell 86 | variable TNS_ADMIN is set to the value provided. 87 | 88 | 89 | Full path to the directory containing tnsnames.ora 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /rgmanager/src/resources/orainstance.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 1.0 7 | 8 | 9 | Oracle 10g Failover Instance 10 | 11 | 12 | Oracle 10g Failover Instance 13 | 14 | 15 | 16 | 17 | 18 | Instance name (SID) of oracle instance 19 | 20 | 21 | Oracle SID 22 | 23 | 24 | 25 | 26 | 27 | 28 | Oracle user name. This is the user name of the Oracle 29 | user which the Oracle instance runs as. 30 | 31 | 32 | Oracle User Name 33 | 34 | 35 | 36 | 37 | 38 | 39 | This is the Oracle database home directory. 40 | This is configured when you install Oracle. 41 | 42 | 43 | Oracle Home Directory 44 | 45 | 46 | 47 | 48 | 49 | 50 | List of Oracle listeners which will be started with 51 | the database instance. Listener names are separated by 52 | whitespace. Defaults to empty which disables listeners. 53 | 54 | 55 | Oracle listeners 56 | 57 | 58 | 59 | 60 | 61 | 62 | Location for lockfile which will be used for checking if 63 | the Oracle should be running or not. Defaults to location 64 | under /tmp. 65 | 66 | 67 | Pathname for lockfile 68 | 69 | 70 | 71 | 72 | 73 | 74 | Full path to the directory that contains the Oracle 75 | listener tnsnames.ora configuration file. The shell 76 | variable TNS_ADMIN is set to the value provided. 77 | 78 | 79 | Full path to the directory containing tnsnames.ora 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /rgmanager/src/resources/oralistener.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 1.0 7 | 8 | 9 | Oracle 10g Listener Instance 10 | 11 | 12 | Oracle 10g Listener Instance 13 | 14 | 15 | 16 | 17 | 18 | Listener name 19 | 20 | 21 | Listener name 22 | 23 | 24 | 25 | 26 | 27 | 28 | Oracle user name. This is the user name of the Oracle 29 | user which the Oracle instance runs as. 30 | 31 | 32 | Oracle User Name 33 | 34 | 35 | 36 | 37 | 38 | 39 | This is the Oracle database home directory. 40 | This is configured when you install Oracle. 41 | 42 | 43 | Oracle Home Directory 44 | 45 | 46 | 47 | 48 | 49 | 50 | Full path to the directory that contains the Oracle 51 | listener tnsnames.ora configuration file. The shell 52 | variable TNS_ADMIN is set to the value provided. 53 | 54 | 55 | Full path to the directory containing tnsnames.ora 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /rgmanager/src/resources/postgres-8.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | This defines an instance of PostgreSQL server 7 | 8 | 9 | Defines a PostgreSQL server 10 | 11 | 12 | 13 | 14 | 15 | Specifies a service name for logging and other purposes 16 | 17 | 18 | Name 19 | 20 | 21 | 22 | 23 | 24 | 25 | Define absolute path to configuration file 26 | 27 | 28 | Config File 29 | 30 | 31 | 32 | 33 | 34 | 35 | User who runs the database server because it can't be 36 | run by root. 37 | 38 | 39 | User who runs the database server 40 | 41 | 42 | 43 | 44 | 45 | 46 | Other command-line options for postmaster 47 | 48 | 49 | Other command-line options for postmaster 50 | 51 | 52 | 53 | 54 | 55 | 56 | Wait X seconds for correct end of service startup 57 | 58 | 59 | Wait X seconds for correct end of service startup. 60 | 61 | 62 | 63 | 64 | 65 | 66 | Inherit the service name. We need to know 67 | the service name in order to determine file 68 | systems and IPs for this service. 69 | 70 | 71 | Inherit the service name. 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /rgmanager/src/resources/ra-api-1-modified.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 34 | 35 | 36 | 38 | 39 | 40 | 43 | 44 | 45 | 51 | 52 | 53 | 54 | 56 | 57 | 58 | 62 | 63 | 64 | 69 | -------------------------------------------------------------------------------- /rgmanager/src/resources/ra2ref.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <ref name=""/> 10 | 11 | -------------------------------------------------------------------------------- /rgmanager/src/resources/resources.rng.head: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /rgmanager/src/resources/resources.rng.mid: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /rgmanager/src/resources/resources.rng.tail: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /rgmanager/src/resources/samba.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | Dynamic smbd/nmbd resource agent 7 | 8 | 9 | Dynamic smbd/nmbd resource agent 10 | 11 | 12 | 13 | 14 | 15 | Samba Symbolic Name. 16 | 17 | 18 | Samba Name 19 | 20 | 21 | 22 | 23 | 24 | 25 | Define absolute path to configuration file 26 | 27 | 28 | Config File 29 | 30 | 31 | 32 | 33 | 34 | 35 | Other command-line options for smbd 36 | 37 | 38 | Other command-line options for smbd 39 | 40 | 41 | 42 | 43 | 44 | 45 | Other command-line options for nmbd 46 | 47 | 48 | Other command-line options for nmbd 49 | 50 | 51 | 52 | 53 | 54 | 55 | Wait X seconds for correct end of service shutdown 56 | 57 | 58 | Wait X seconds for correct end of service shutdown 59 | 60 | 61 | 62 | 63 | 64 | 65 | Inherit the service name. We need to know 66 | the service name in order to determine file 67 | systems and IPs for this smb service. 68 | 69 | 70 | Inherit the service name. 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /rgmanager/src/resources/tomcat-5.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | This defines an instance of Tomcat server 7 | 8 | 9 | Defines a Tomcat server 10 | 11 | 12 | 13 | 14 | 15 | Specifies a service name for logging and other purposes 16 | 17 | 18 | Name 19 | 20 | 21 | 22 | 23 | 24 | 25 | Define absolute path to configuration file 26 | 27 | 28 | Config File 29 | 30 | 31 | 32 | 33 | 34 | 35 | User who runs the Tomcat server 36 | 37 | 38 | User who runs the Tomcat server 39 | 40 | 41 | 42 | 43 | 44 | 45 | Other command-line options for Catalina 46 | 47 | 48 | Other command-line options for Catalina 49 | 50 | 51 | 52 | 53 | 54 | 55 | Cataliny base directory 56 | 57 | 58 | Catalina base directory (differs for each service) 59 | 60 | 61 | 62 | 63 | 64 | 65 | Wait X seconds for correct end of service shutdown 66 | 67 | 68 | Wait X seconds for correct end of service shutdown 69 | 70 | 71 | 72 | 73 | 74 | 75 | Inherit the service name. We need to know 76 | the service name in order to determine file 77 | systems and IPs for this service. 78 | 79 | 80 | Inherit the service name. 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /rgmanager/src/resources/tomcat-6.metadata: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | This defines an instance of Tomcat server 7 | 8 | 9 | Defines a Tomcat server 10 | 11 | 12 | 13 | 14 | 15 | Specifies a service name for logging and other purposes 16 | 17 | 18 | Name 19 | 20 | 21 | 22 | 23 | 24 | 25 | Define absolute path to configuration file 26 | 27 | 28 | Config File 29 | 30 | 31 | 32 | 33 | 34 | 35 | Wait X seconds for correct end of service shutdown 36 | 37 | 38 | Wait X seconds for correct end of service shutdown 39 | 40 | 41 | 42 | 43 | 44 | 45 | Inherit the service name. We need to know 46 | the service name in order to determine file 47 | systems and IPs for this service. 48 | 49 | 50 | Inherit the service name. 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /rgmanager/src/resources/utils/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | # 18 | 19 | MAINTAINERCLEANFILES = Makefile.in 20 | 21 | commonscripts = fs-lib.sh \ 22 | httpd-parse-config.pl \ 23 | member_util.sh \ 24 | messages.sh \ 25 | named-parse-config.pl \ 26 | ra-skelet.sh \ 27 | tomcat-parse-config.pl \ 28 | config-utils.sh 29 | 30 | EXTRA_DIST = $(commonscripts) \ 31 | rhev-check.sh 32 | 33 | sbin_SCRIPTS = rhev-check.sh 34 | 35 | rasutilsdir = ${CLUSTERDATA}/utils 36 | 37 | rasutils_SCRIPTS = $(commonscripts) 38 | -------------------------------------------------------------------------------- /rgmanager/src/resources/utils/httpd-parse-config.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # Copyright (C) 1997-2003 Sistina Software, Inc. All rights reserved. 4 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | 21 | ## 22 | ## This script removes sections from the 23 | ## Apache httpd.conf file. This is quite useful because we 24 | ## don't have any direct access to the parsed configuration 25 | ## file of the httpd server. 26 | ## 27 | ## Usage: ./httpd-parse-config.pl -Dfoo1 -Dfoo2 < httpd.conf 28 | ## where fooX are defines as passed to the httpd server 29 | ## 30 | ## Note: All whitespace characters at the beginning and end 31 | ## of lines are removed. 32 | ## 33 | use strict; 34 | 35 | my @defines = (); 36 | ## Default behaviour is to show all lines when we are not 37 | ## in the sections. 38 | my @show = (1); 39 | 40 | sub testIfDefine($) { 41 | my $param = $1; 42 | my $positiveTest = 1; 43 | if ($param =~ /^!(.*)$/) { 44 | $param = $1; 45 | $positiveTest = 0; 46 | } 47 | 48 | foreach my $def (@defines) { 49 | if ($def eq $param) { 50 | return $positiveTest; 51 | } 52 | } 53 | 54 | return (1-$positiveTest); 55 | } 56 | 57 | foreach my $arg (@ARGV) { 58 | if ($arg =~ /^-D(.*)$/) { 59 | push(@defines, $1); 60 | } 61 | } 62 | 63 | ## Parse config file and remove IfDefine sections 64 | while (my $line = ) { 65 | chomp($line); 66 | $line =~ s/^\s*(.*?)\s*$/$1/; 67 | if ($line =~ //) { 68 | if (testIfDefine($1) == 1) { 69 | if ($show[$#show] == 1) { 70 | push (@show, 1); 71 | } else { 72 | push (@show, 0); 73 | } 74 | } else { 75 | push (@show, 0); 76 | } 77 | } elsif ($line =~ /<\/IfDefine>/) { 78 | pop(@show); 79 | } elsif ($show[$#show] == 1) { 80 | print $line, "\n"; 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /rgmanager/src/resources/utils/member_util.sh.in: -------------------------------------------------------------------------------- 1 | #!@BASH_SHELL@ 2 | # 3 | # Copyright (C) 1997-2003 Sistina Software, Inc. All rights reserved. 4 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | 21 | # 22 | # Use corosync-quorumtool to figure out if the specified node is a member 23 | # of the cluster. Returns 1 if not a member, and 24 | # 0 if the node is happily running. 25 | # 26 | # Tested on RHEL6 and F17 Note that the old version of this function utilized 27 | # clustat, which had introspection in to the configuration. 28 | # If a node was not found, the old version would return '2', but the only 29 | # consumer of this function never cared about that value. 30 | # 31 | is_node_member_clustat() 32 | { 33 | local node="$1" 34 | local output_list 35 | 36 | # Still having a tag while (a) online but (b) not running pacemaker 37 | # (e.g. crm_node) or rgmanager not considered adequate for things like 38 | # the LVM agent - so we use corosync-quorumtool instead. The function 39 | # name really should be changed. 40 | # 41 | # corosync 1.4.1 output looks like: 42 | # 43 | # # corosync-quorumtool -l 44 | # Nodeid Name 45 | # 1 rhel6-1 46 | # 2 rhel6-2 47 | # 48 | # corosync 2.0.1 output looks like: 49 | # # corosync-quorumtool -l 50 | # 51 | # Membership information 52 | # ---------------------- 53 | # Nodeid Votes Name 54 | # 1 1 rhel7-1.priv.redhat.com 55 | # 2 1 rhel7-2.priv.redhat.com 56 | # 57 | 58 | output_list=$(corosync-quorumtool -l | grep -v "^Nodeid") 59 | 60 | # first try searching for the node in the output as both a FQDN or shortname 61 | echo "$output_list" | grep -i -e " $node\$" -e " $node\..*\$" &> /dev/null && return 0 62 | 63 | # if the node was not found in the quorum list, try any known aliases found in /etc/hosts 64 | for alias in $(cat /etc/hosts | grep -e "\s$node\s" -e "\s$node\$" | tail -n 1 | sed 's/\t/ /g' | cut -f2- -d " "); 65 | do 66 | echo "$output_list" | grep -i -e " $alias\$" &> /dev/null && return 0 67 | done 68 | 69 | return 1 70 | } 71 | 72 | 73 | # 74 | # Print the local node name to stdout 75 | # Returns 0 if could be found, 1 if not 76 | # Tested on RHEL6 (cman) and Fedora 17 (corosync/pacemaker) 77 | # 78 | local_node_name() 79 | { 80 | local node nid localid 81 | 82 | if which magma_tool &> /dev/null; then 83 | # Use magma_tool, if available. 84 | line=$(magma_tool localname | grep "^Local") 85 | 86 | if [ -n "$line" ]; then 87 | echo ${line/* = /} 88 | return 0 89 | fi 90 | fi 91 | 92 | if which cman_tool &> /dev/null; then 93 | # Use cman_tool 94 | 95 | line=$(cman_tool status | grep -i "Node name: $1") 96 | [ -n "$line" ] || return 1 97 | echo ${line/*name: /} 98 | return 0 99 | fi 100 | 101 | if ! which crm_node &> /dev/null; then 102 | # no crm_node? :( 103 | return 2 104 | fi 105 | 106 | localid=$(crm_node -i) 107 | while read nid node; do 108 | if [ "$nid" = "$localid" ]; then 109 | echo $node 110 | return 0 111 | fi 112 | done < <(crm_node -l) 113 | 114 | return 1 115 | } 116 | 117 | -------------------------------------------------------------------------------- /rgmanager/src/resources/utils/named-parse-config.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # Copyright (C) 1997-2003 Sistina Software, Inc. All rights reserved. 4 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | 21 | ## 22 | ## Parse named.conf (from STDIN) and add options from cluster.conf 23 | ## 24 | ## ./named-parse-config.pl "directory" "pid-file" "listen-on" "set source " 25 | ## 26 | use strict; 27 | 28 | if ($#ARGV < 3) { 29 | die ("Not enough arguments"); 30 | } 31 | 32 | while (my $line = ) { 33 | chomp($line); 34 | $line =~ s/(.*?)\s*$/$1/; 35 | if ($line =~ /^\s*options\s+\{/) { 36 | print $line, "\n"; 37 | print "\tdirectory \"$ARGV[0]\";\n"; 38 | print "\tpid-file \"$ARGV[1]\";\n"; 39 | print "\tlisten-on { $ARGV[2] };\n"; 40 | if ($ARGV[3] =~ "1|true|TRUE|yes|YES|on|ON") { 41 | print "\tnotify-source $ARGV[2];\n"; 42 | print "\ttransfer-source $ARGV[2];\n"; 43 | print "\tquery-source $ARGV[2];\n"; 44 | } 45 | } else { 46 | print $line, "\n"; 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /rgmanager/src/resources/utils/ra-skelet.sh.in: -------------------------------------------------------------------------------- 1 | #!@BASH_SHELL@ 2 | # 3 | # Copyright (C) 1997-2003 Sistina Software, Inc. All rights reserved. 4 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | 21 | status_check_pid() 22 | { 23 | declare pid_file="$1" 24 | 25 | if [ -z "$pid_file" ]; then 26 | clog_check_file_exist $CLOG_FAILED_INVALID "$pid_file" 27 | return $OCF_ERR_GENERIC 28 | fi 29 | 30 | if [ ! -e "$pid_file" ]; then 31 | clog_check_file_exist $CLOG_FAILED "$pid_file" 32 | return $OCF_NOT_RUNNING 33 | fi 34 | 35 | read pid < "$pid_file" 36 | 37 | if [ -z "$pid" ]; then 38 | return $OCF_ERR_GENERIC 39 | fi 40 | 41 | if [ ! -d /proc/$pid ]; then 42 | return $OCF_ERR_GENERIC 43 | fi 44 | 45 | return 0 46 | } 47 | 48 | stop_generic() 49 | { 50 | declare pid_file="$1" 51 | declare stop_timeout="$2" 52 | declare stop_sig="$3" 53 | declare pid; 54 | declare count=0; 55 | 56 | if [ -z "$stop_sig" ]; then 57 | stop_sig="-TERM" 58 | fi 59 | 60 | if [ ! -e "$pid_file" ]; then 61 | clog_check_file_exist $CLOG_FAILED_NOT_FOUND "$pid_file" 62 | # In stop-after-stop situation there is no PID file but 63 | # it will be nice to check for it in stop-after-start 64 | # look at bug #449394 65 | return 0 66 | fi 67 | 68 | if [ -z "$stop_timeout" ]; then 69 | stop_timeout=20 70 | fi 71 | 72 | read pid < "$pid_file" 73 | 74 | # @todo: PID file empty -> error? 75 | if [ -z "$pid" ]; then 76 | return 0; 77 | fi 78 | 79 | # @todo: PID is not running -> error? 80 | if [ ! -d "/proc/$pid" ]; then 81 | return 0; 82 | fi 83 | 84 | kill $stop_sig "$pid" 85 | 86 | if [ $? -ne 0 ]; then 87 | return $OCF_ERR_GENERIC 88 | fi 89 | 90 | until [ `ps --pid "$pid" &> /dev/null; echo $?` = '1' ] || [ $count -gt $stop_timeout ] 91 | do 92 | sleep 1 93 | let count=$count+1 94 | done 95 | 96 | if [ $count -gt $stop_timeout ]; then 97 | clog_service_stop $CLOG_FAILED_NOT_STOPPED 98 | return $OCF_ERR_GENERIC 99 | fi 100 | 101 | return 0; 102 | } 103 | 104 | stop_generic_sigkill() { 105 | # Use stop_generic (kill -TERM) and if application did not stop 106 | # correctly then use kill -QUIT and check if it was killed 107 | declare pid_file="$1" 108 | declare stop_timeout="$2" 109 | declare kill_timeout="$3" 110 | declare stop_sig="$4" 111 | declare pid 112 | 113 | if [ -z "$stop_sig" ]; then 114 | stop_sig="-TERM" 115 | fi 116 | ## If stop_timeout is equal to zero then we do not want 117 | ## to give -TERM signal at all. 118 | if [ $stop_timeout -ne 0 ]; then 119 | stop_generic "$pid_file" "$stop_timeout" "$stop_sig" 120 | if [ $? -eq 0 ]; then 121 | return 0; 122 | fi 123 | fi 124 | 125 | if [ ! -e "$pid_file" ]; then 126 | clog_check_file_exist $CLOG_FAILED_NOT_FOUND "$pid_file" 127 | # In stop-after-stop situation there is no PID file but 128 | # it will be nice to check for it in stop-after-start 129 | # look at bug #449394 130 | return 0 131 | fi 132 | read pid < "$pid_file" 133 | 134 | if [ -z "$pid" ]; then 135 | return 0; 136 | fi 137 | 138 | if [ ! -d "/proc/$pid" ]; then 139 | return 0; 140 | fi 141 | 142 | kill -QUIT "$pid" 143 | if [ $? -ne 0 ]; then 144 | return $OCF_GENERIC_ERROR 145 | fi 146 | 147 | sleep "$kill_timeout" 148 | ps --pid "$pid" &> /dev/null 149 | if [ $? -eq 0 ]; then 150 | clog_service_stop $CLOG_FAILED_KILL 151 | return $OCF_ERR_GENERIC 152 | fi 153 | 154 | clog_service_stop $CLOG_SUCCEED_KILL 155 | return 0 156 | } 157 | -------------------------------------------------------------------------------- /rgmanager/src/resources/utils/rhev-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | MYNAME=`basename $0` 4 | 5 | do_log() 6 | { 7 | declare severity=$1 8 | 9 | shift 10 | echo "<$severity> $*" 11 | clulog -s $severity "$*" 12 | } 13 | 14 | if [ -z "$1" ]; then 15 | do_log 4 No host specified. 16 | exit 1 17 | fi 18 | 19 | do_log 6 "Checking RHEV status on $1" 20 | 21 | tries=3 22 | http_code= 23 | 24 | while [ $tries -gt 0 ]; do 25 | 26 | # Record start/end times so we can calculate the difference 27 | start_time=$(date +%s) 28 | http_code="$(curl -m 10 -sk https://$1/RHEVManagerWeb/HealthStatus.aspx -D - | head -1 | cut -f2 -d' ')" 29 | 30 | if [ "$http_code" = "200" ]; then 31 | exit 0 32 | fi 33 | 34 | # Reduce sleep time if the attempt took a noticeable amount 35 | # of time. 36 | end_time=$(date +%s) 37 | delta=$(((end_time - start_time))) 38 | sleep_time=$(((90 - delta))) 39 | 40 | ((tries-=1)) 41 | 42 | # if we're going to retry and we have a nonzero sleep time, 43 | # go to sleep. 44 | if [ $tries -gt 0 ] && [ $sleep_time -gt 0 ]; then 45 | sleep $sleep_time 46 | fi 47 | done 48 | 49 | if [ -n "$http_code" ]; then 50 | do_log 3 "RHEV Status check on $1 failed; last HTTP code: $http_code" 51 | else 52 | do_log 3 "RHEV Status check on $1 failed" 53 | fi 54 | 55 | exit 1 56 | -------------------------------------------------------------------------------- /rgmanager/src/resources/utils/tomcat-parse-config.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # Copyright (C) 1997-2003 Sistina Software, Inc. All rights reserved. 4 | # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | 21 | ## 22 | ## This script replace IP addresses on which tomcat server 23 | ## should listen. Tomcat can't listen on every IP because that 24 | ## way we can run only on instance. 25 | ## 26 | ## Usage: ./tomcat-parse-config.pl ip1 ip2 < /etc/tomcat/server.xml 27 | ## where ipXX defines an IP address [eg. 127.0.0.1 134.45.11.1] 28 | ## 29 | ## 30 | use strict; 31 | 32 | while (my $line = ) { 33 | chomp ($line); 34 | 35 | if ($line =~ /(.*?)/) == 0) { 42 | $content .= $tmp . "\n"; 43 | $tmp = ; 44 | chomp($tmp); 45 | } 46 | 47 | if ($tmp =~ /(.*?)>(.*)/) { 48 | $content .= $1 . ">\n"; 49 | $rest = $2; 50 | chomp($rest); 51 | } 52 | 53 | print $start; 54 | foreach my $arg (@ARGV) { 55 | $content =~ s/\s+address=".*?"/ /; 56 | $content =~ s/Connector /Connector address="$arg" /; 57 | print $content; 58 | } 59 | print $rest; 60 | } else { 61 | print $line,"\n"; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /systemd/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2017 Oyvind Albrigtsen 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | # 18 | 19 | MAINTAINERCLEANFILES = Makefile.in 20 | 21 | if HAVE_SYSTEMD 22 | systemdsystemunitdir = $(SYSTEMD_UNIT_DIR) 23 | dist_systemdsystemunit_DATA = resource-agents-deps.target 24 | 25 | tmpfilesdir = $(SYSTEMD_TMPFILES_DIR) 26 | tmpfiles_DATA = resource-agents.conf 27 | endif 28 | -------------------------------------------------------------------------------- /systemd/resource-agents-deps.target: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=resource-agents dependencies 3 | -------------------------------------------------------------------------------- /systemd/resource-agents.conf.in: -------------------------------------------------------------------------------- 1 | d @HA_RSCTMPDIR@ 1755 root root 2 | -------------------------------------------------------------------------------- /tools/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # heartbeat: Linux-HA heartbeat code 3 | # 4 | # Copyright (C) 2001 Michael Moerz 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License 8 | # as published by the Free Software Foundation; either version 2 9 | # of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | MAINTAINERCLEANFILES = Makefile.in 21 | 22 | SUBDIRS = ocft 23 | 24 | AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include 25 | 26 | halibdir = $(libexecdir)/heartbeat 27 | 28 | EXTRA_DIST = ocf-tester.8 sfex_init.8 29 | 30 | sbin_PROGRAMS = 31 | sbin_SCRIPTS = ocf-tester 32 | halib_PROGRAMS = findif \ 33 | storage_mon 34 | halib_SCRIPTS = 35 | 36 | man8_MANS = ocf-tester.8 37 | 38 | if BUILD_SFEX 39 | halib_PROGRAMS += sfex_daemon 40 | sbin_PROGRAMS += sfex_init sfex_stat 41 | man8_MANS += sfex_init.8 42 | endif 43 | 44 | if USE_LIBNET 45 | halib_PROGRAMS += send_arp 46 | send_arp_SOURCES = send_arp.libnet.c 47 | send_arp_CFLAGS = @LIBNETDEFINES@ 48 | send_arp_LDADD = $(GLIBLIB) -lplumb @LIBNETLIBS@ 49 | else 50 | 51 | if SENDARP_LINUX 52 | halib_PROGRAMS += send_arp 53 | send_arp_SOURCES = send_arp.linux.c 54 | endif 55 | 56 | if NFSCONVERT 57 | halib_SCRIPTS += nfsconvert 58 | endif 59 | 60 | endif 61 | 62 | sfex_daemon_SOURCES = sfex_daemon.c sfex.h sfex_lib.c sfex_lib.h 63 | sfex_daemon_CFLAGS = -D_GNU_SOURCE 64 | sfex_daemon_LDADD = $(GLIBLIB) -lplumb -lplumbgpl 65 | 66 | sfex_init_SOURCES = sfex_init.c sfex.h sfex_lib.c sfex_lib.h 67 | sfex_init_CFLAGS = -D_GNU_SOURCE 68 | sfex_init_LDADD = $(GLIBLIB) -lplumb -lplumbgpl 69 | 70 | sfex_stat_SOURCES = sfex_stat.c sfex.h sfex_lib.c sfex_lib.h 71 | sfex_stat_CFLAGS = -D_GNU_SOURCE 72 | sfex_stat_LDADD = $(GLIBLIB) -lplumb -lplumbgpl 73 | 74 | findif_SOURCES = findif.c 75 | 76 | storage_mon_SOURCES = storage_mon.c 77 | storage_mon_CFLAGS = -D_GNU_SOURCE ${LIBQB_CFLAGS} 78 | storage_mon_LDADD = ${LIBQB_LIBS} 79 | 80 | if BUILD_TICKLE 81 | halib_PROGRAMS += tickle_tcp 82 | tickle_tcp_SOURCES = tickle_tcp.c 83 | endif 84 | 85 | .PHONY: install-exec-hook 86 | -------------------------------------------------------------------------------- /tools/ocf-tester.8: -------------------------------------------------------------------------------- 1 | .TH OCF-TESTER "8" "July 2022" "Tool for testing if a cluster resource is OCF compliant" "System Administration Utilities" 2 | .SH NAME 3 | ocf-tester \- Part of the Linux-HA project 4 | .SH SYNOPSIS 5 | .B ocf-tester 6 | [\fI-hvqdX\fR] \fI-n resource_name \fR[\fI-o name=value\fR]\fI* /full/path/to/resource/agent\fR 7 | .SH DESCRIPTION 8 | Tool for testing if a cluster resource is OCF compliant 9 | .SH OPTIONS 10 | .TP 11 | \fB\-h\fR 12 | This text 13 | .TP 14 | \fB\-v\fR 15 | Be verbose while testing 16 | .TP 17 | \fB\-q\fR 18 | Be quiet while testing 19 | .TP 20 | \fB\-d\fR 21 | Turn on RA debugging 22 | .TP 23 | \fB\-n\fR name 24 | Name of the resource 25 | .TP 26 | \fB\-o\fR name=value 27 | Name and value of any parameters required by the agent 28 | .TP 29 | \fB\-h\fR 30 | This text 31 | .TP 32 | \fB\-v\fR 33 | Be verbose while testing 34 | .TP 35 | \fB\-q\fR 36 | Be quiet while testing 37 | .TP 38 | \fB\-d\fR 39 | Turn on RA debugging 40 | .TP 41 | \fB\-X\fR 42 | Turn on RA tracing (expect large output) 43 | .TP 44 | \fB\-n\fR name 45 | Name of the resource 46 | .TP 47 | \fB\-o\fR name=value 48 | Name and value of any parameters required by the agent 49 | -------------------------------------------------------------------------------- /tools/ocft/ChangeLog: -------------------------------------------------------------------------------- 1 | 0.43: 2 | - Add an option 'Agent' in 'CONFIG' 3 | - Fix a bug about remote shell. 4 | - Add top level option 'VARIABLE'. 5 | - Add top level option 'CLEANUP-AGENT'. 6 | - Rename Var & Unvar to Env & Unenv. 7 | - Fix a bug about agent installation. 8 | - Modified configs of agent according the new syntax. 9 | 0.42: 10 | - Fix a bug about agent installation. 11 | - The tests stop early if the basic functionality it not there. 12 | - Fix a bug about 'config parser'. 13 | - Keep the resource stat between the runs to avoid there are multiple stop/start per run. 14 | - Add a function with warning output. 15 | - Adjust the sequence of cases running. 16 | - Change the default timeout. 17 | - Replace the crm_master command in Agent scripts, it is no use in testing, 18 | because the agent runs in local when test. 19 | - Support drbd testing if the configuration is correct. 20 | - Fix a 'Include' bug. 21 | - Fix a bug about configuration of 'mysql'. 22 | 0.41: 23 | - Fixed a remote shell bug. 24 | - Improved 'Include' option, now it supports remote shell, invoked just like 'Include@ip_address'. 25 | - Show line number, if syntax error occurs in config file. 26 | - Add a 'AgentRoot' sub-option. 27 | - Fix a bug with config parsing. 28 | - Rename ACTION "run" to "test". 29 | - Add a simple output mode for "test" ACTION. 30 | - Add a verbose ouput mode for "help" ACTION. 31 | - The output will be recorded to log file. 32 | - Add double stop and double start to tests. 33 | - Exit with 1 if test script failed. 34 | - The output of agents will be exposed if the test fails. 35 | - Run zypper with -q 36 | - Use 127.0.0.x(and lo for interface) for agents IP* 37 | 0.4: 38 | - Add a 'CASE-BLOCK' top option, it can be included by 'CASE' 39 | - Add a 'SETUP-AGENT' top option, you can initialize agents before testing. 40 | - Add a 'Include' sub-option. 41 | - Add a 'Unvar' sub-option. 42 | - Rename 'GLOBAL' to 'CONFIG'. 43 | - Modify a part of syntax. 44 | - Imporve the 'InstallPackage' option, now it supports SUSE, Redhat and Debian. 45 | - Add README & README.zh_CN. 46 | 0.3: 47 | - All statements in CASE can be executed by remote shell. 48 | 0.2: 49 | - Implement options: BashAtExit, GLOBAL, HangTimeout, InstallPackage. 50 | - Delete option: Name. 51 | - Modify a part of syntax. 52 | - Fix some bugs. 53 | - Print testing message in human readable format. 54 | - Improve 'make' and 'run' option. 55 | - Add 'clean' option. 56 | 0.1: 57 | - Implement options: CASE, Bash, Run, Var, Name. 58 | -------------------------------------------------------------------------------- /tools/ocft/Filesystem: -------------------------------------------------------------------------------- 1 | # Filesystem 2 | # by dejan@suse.de on 3 | # Tue Feb 15 18:50:04 CET 2011 4 | # 5 | CONFIG 6 | Agent Filesystem 7 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 8 | HangTimeout 20 9 | 10 | VARIABLE 11 | OCFT_rundir="`get_rundir`" 12 | OCFT_fs="$OCFT_rundir/resource-agents/ocft-Filesystem-fs" 13 | OCFT_dir="$OCFT_rundir/resource-agents/ocft-Filesystem-mnt" 14 | OCFT_loop="`loopbackeddev make $OCFT_fs 16M`" 15 | 16 | SETUP-AGENT 17 | mke2fs -j -Fq -m 0 $OCFT_loop 18 | 19 | CLEANUP-AGENT 20 | loopbackeddev unmake $OCFT_fs 21 | rmdir $OCFT_dir 22 | 23 | CASE-BLOCK required_args 24 | Env OCF_RESKEY_device=$OCFT_loop 25 | Env OCF_RESKEY_fstype=ext3 26 | Env OCF_RESKEY_directory=$OCFT_dir 27 | 28 | CASE-BLOCK default_status 29 | AgentRun stop 30 | 31 | CASE-BLOCK prepare 32 | Include required_args 33 | Include default_status 34 | 35 | CASE "check base env" 36 | Include prepare 37 | AgentRun start OCF_SUCCESS 38 | 39 | CASE "check base env: invalid 'OCF_RESKEY_device'" 40 | Include prepare 41 | Env OCF_RESKEY_device=/dev/no_such_device 42 | AgentRun start OCF_ERR_INSTALLED 43 | 44 | CASE "check base env: unset 'OCF_RESKEY_device'" 45 | Include prepare 46 | Unenv OCF_RESKEY_device 47 | AgentRun start OCF_ERR_CONFIGURED 48 | 49 | CASE "normal start" 50 | Include prepare 51 | AgentRun start OCF_SUCCESS 52 | 53 | CASE "normal stop" 54 | Include prepare 55 | AgentRun start 56 | AgentRun stop OCF_SUCCESS 57 | 58 | CASE "double start" 59 | Include prepare 60 | AgentRun start 61 | AgentRun start OCF_SUCCESS 62 | 63 | CASE "double stop" 64 | Include prepare 65 | AgentRun stop OCF_SUCCESS 66 | 67 | CASE "monitor when running" 68 | Include prepare 69 | AgentRun start 70 | AgentRun monitor OCF_SUCCESS 71 | 72 | CASE "monitor when not running" 73 | Include prepare 74 | AgentRun monitor OCF_NOT_RUNNING 75 | 76 | CASE "monitor depth 10 when running" 77 | Include prepare 78 | AgentRun start 79 | Env OCF_CHECK_LEVEL=10 80 | AgentRun monitor OCF_SUCCESS 81 | 82 | CASE "monitor depth 20 with running" 83 | Include prepare 84 | AgentRun start 85 | Env OCF_CHECK_LEVEL=20 86 | AgentRun monitor OCF_SUCCESS 87 | 88 | CASE "start insert failure (remove device)" 89 | Include prepare 90 | Bash losetup -d $OCFT_loop 91 | BashAtExit losetup $OCFT_loop $OCFT_fs 92 | AgentRun start OCF_ERR_GENERIC 93 | 94 | CASE "monitor depth 20 insert failure (r/o fs)" 95 | Include prepare 96 | AgentRun start 97 | Bash mount -o remount,ro $OCFT_dir 98 | BashAtExit mount -o remount,rw $OCFT_dir 99 | Env OCF_CHECK_LEVEL=20 100 | AgentRun monitor OCF_ERR_GENERIC 101 | 102 | CASE "unimplemented command" 103 | Include prepare 104 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 105 | 106 | -------------------------------------------------------------------------------- /tools/ocft/IPaddr2: -------------------------------------------------------------------------------- 1 | # IPaddr2 2 | 3 | CONFIG 4 | Agent IPaddr2 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | HangTimeout 20 7 | 8 | SETUP-AGENT 9 | ip addr add 192.168.144.1/24 dev eth0 brd 192.168.144.255 10 | 11 | CLEANUP-AGENT 12 | ip addr del 192.168.144.1/24 dev eth0 13 | 14 | CASE-BLOCK required_args 15 | Env OCF_RESKEY_ip=192.168.144.2 16 | 17 | CASE-BLOCK check_iflabel_assigned 18 | Bash ip -4 -o addr show eth0 | grep -w 192.168.144.2/24 | grep -w eth0:iflabel >/dev/null # checking iflabel was assigned correctly 19 | 20 | CASE-BLOCK check_iflabel_removed 21 | Bash ! ip -4 -o addr show eth0 | grep -w 192.168.144.2/24 | grep -w eth0:iflabel >/dev/null # checking iflabel was removed correctly 22 | 23 | CASE-BLOCK default_status 24 | AgentRun stop 25 | 26 | CASE-BLOCK prepare 27 | Include required_args 28 | Include default_status 29 | 30 | CASE "check base env" 31 | Include prepare 32 | AgentRun start OCF_SUCCESS 33 | 34 | CASE "check base env: unset 'OCF_RESKEY_ip'" 35 | Include prepare 36 | Unenv OCF_RESKEY_ip 37 | AgentRun start OCF_ERR_CONFIGURED 38 | 39 | CASE "check base env: set invalid 'OCF_RESKEY_ip'" 40 | Include prepare 41 | Env OCF_RESKEY_ip=not_ip_address 42 | AgentRun start OCF_ERR_CONFIGURED 43 | 44 | CASE "check base env: set 'OCF_RESKEY_cidr_netmask'" 45 | Include prepare 46 | Env OCF_RESKEY_cidr_netmask=24 47 | AgentRun start OCF_SUCCESS 48 | 49 | CASE "check base env: set invalid 'OCF_RESKEY_cidr_netmask'" 50 | Include prepare 51 | Env OCF_RESKEY_cidr_netmask=not_netmask 52 | AgentRun start OCF_ERR_CONFIGURED 53 | 54 | CASE "check base env: set 'OCF_RESKEY_broadcast'" 55 | Include prepare 56 | Env OCF_RESKEY_broadcast=192.168.144.255 57 | AgentRun start OCF_SUCCESS 58 | 59 | CASE "check base env: set invalid 'OCF_RESKEY_broadcast'" 60 | Include prepare 61 | Env OCF_RESKEY_broadcast=not_broadcast 62 | AgentRun start OCF_ERR_CONFIGURED 63 | 64 | CASE "check base env: set 'OCF_RESKEY_nic'" 65 | Include prepare 66 | Env OCF_RESKEY_nic=eth0 67 | AgentRun start OCF_SUCCESS 68 | 69 | CASE "check base env: set invalid 'OCF_RESKEY_nic'" 70 | Include prepare 71 | Env OCF_RESKEY_nic=not_nic 72 | AgentRun start OCF_ERR_CONFIGURED 73 | AgentRun validate-all OCF_ERR_CONFIGURED 74 | 75 | CASE "normal start" 76 | Include prepare 77 | AgentRun start OCF_SUCCESS 78 | 79 | CASE "normal stop" 80 | Include prepare 81 | AgentRun start 82 | AgentRun stop OCF_SUCCESS 83 | 84 | CASE "double start" 85 | Include prepare 86 | AgentRun start 87 | AgentRun start OCF_SUCCESS 88 | 89 | CASE "double stop" 90 | Include prepare 91 | AgentRun stop OCF_SUCCESS 92 | 93 | CASE "monitor with running" 94 | Include prepare 95 | AgentRun start 96 | AgentRun monitor OCF_SUCCESS 97 | 98 | CASE "monitor with not running" 99 | Include prepare 100 | AgentRun monitor OCF_NOT_RUNNING 101 | 102 | CASE "unimplemented command" 103 | Include prepare 104 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 105 | 106 | CASE "Attachment to loopback interface" 107 | Env OCF_RESKEY_ip=127.0.0.3 108 | AgentRun start OCF_SUCCESS 109 | AgentRun monitor OCF_SUCCESS 110 | AgentRun stop OCF_SUCCESS 111 | 112 | CASE "check additional env: set 'OCF_RESKEY_iflabel'" 113 | Include prepare 114 | Env OCF_RESKEY_nic=eth0 115 | Env OCF_RESKEY_iflabel=iflabel 116 | AgentRun start OCF_SUCCESS 117 | Include check_iflabel_assigned 118 | AgentRun stop OCF_SUCCESS 119 | Include check_iflabel_removed 120 | 121 | # This is deprecated but still supported for the compatibility. 122 | CASE "check additional env: specify iflabel in 'OCF_RESKEY_nic'" 123 | Include prepare 124 | Env OCF_RESKEY_nic=eth0:iflabel 125 | AgentRun start OCF_SUCCESS 126 | Include check_iflabel_assigned 127 | AgentRun stop OCF_SUCCESS 128 | Include check_iflabel_removed 129 | 130 | # monitor should return OCF_ERR_GENERIC rather than OCF_ERR_CONFIGURED 131 | # when the specified OCF_RESKEY_nic is vanished by a failure. 132 | # This has been changed as of 3.9.6. 133 | CASE "monitor failure when 'OCF_RESKEY_nic' is vanished" 134 | Include prepare 135 | Env OCF_RESKEY_nic=ethVanished 136 | Env OCF_RESKEY_CRM_meta_interval=10 # not in probe 137 | AgentRun monitor OCF_ERR_GENERIC 138 | -------------------------------------------------------------------------------- /tools/ocft/IPsrcaddr: -------------------------------------------------------------------------------- 1 | # IPsrcaddr 2 | 3 | CONFIG 4 | Agent IPsrcaddr 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage iproute2 7 | HangTimeout 20 8 | 9 | CASE-BLOCK required_args 10 | Env OCF_RESKEY_ipaddress= # put here your IP 11 | Env OCF_RESKEY_cidr_netmask= # and the netmask 12 | 13 | CASE-BLOCK default_status 14 | AgentRun stop 15 | 16 | CASE-BLOCK prepare 17 | Include required_args 18 | Include default_status 19 | 20 | CASE "check base env" 21 | Include prepare 22 | AgentRun start OCF_SUCCESS 23 | 24 | CASE "check base env: unset 'OCF_RESKEY_ipaddress'" 25 | Include prepare 26 | Unenv OCF_RESKEY_ipaddress 27 | AgentRun start OCF_ERR_CONFIGURED 28 | 29 | CASE "check base env: set invalid 'OCF_RESKEY_ipaddress'" 30 | Include prepare 31 | Env OCF_RESKEY_ipaddress=not_ip_address 32 | AgentRun start OCF_ERR_CONFIGURED 33 | 34 | CASE "normal start" 35 | Include prepare 36 | AgentRun start OCF_SUCCESS 37 | 38 | CASE "normal stop" 39 | Include prepare 40 | AgentRun start 41 | AgentRun stop OCF_SUCCESS 42 | 43 | CASE "double start" 44 | Include prepare 45 | AgentRun start 46 | AgentRun start OCF_SUCCESS 47 | 48 | CASE "double stop" 49 | Include prepare 50 | AgentRun stop OCF_SUCCESS 51 | 52 | CASE "monitor with running" 53 | Include prepare 54 | AgentRun start 55 | AgentRun monitor OCF_SUCCESS 56 | 57 | CASE "monitor with not running" 58 | Include prepare 59 | AgentRun monitor OCF_NOT_RUNNING 60 | 61 | CASE "unimplemented command" 62 | Include prepare 63 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 64 | -------------------------------------------------------------------------------- /tools/ocft/LVM: -------------------------------------------------------------------------------- 1 | # LVM 2 | # by dejan@suse.de on 3 | # Wed Feb 16 13:15:01 CET 2011 4 | 5 | CONFIG 6 | Agent LVM 7 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 8 | HangTimeout 20 9 | 10 | VARIABLE 11 | OCFT_rundir="`get_rundir`" 12 | OCFT_pv=$OCFT_rundir/resource-agents/ocft-LVM-pv 13 | OCFT_vg=ocft-vg 14 | OCFT_lv=ocft-lv 15 | OCFT_loop="`loopbackeddev make $OCFT_pv 16M`" 16 | 17 | SETUP-AGENT 18 | pvcreate $OCFT_loop 19 | vgcreate -s 4K $OCFT_vg $OCFT_loop 20 | lvcreate -n $OCFT_lv -L 600K $OCFT_vg 21 | 22 | CLEANUP-AGENT 23 | vgchange -an $OCFT_vg 24 | lvremove -f /dev/$OCFT_vg/$OCFT_lv 25 | vgremove -f $OCFT_vg 26 | pvremove $OCFT_loop 27 | loopbackeddev unmake $OCFT_pv 28 | 29 | CASE-BLOCK required_args 30 | Env OCF_RESKEY_volgrpname=$OCFT_vg 31 | 32 | CASE-BLOCK default_status 33 | AgentRun stop 34 | 35 | CASE-BLOCK prepare 36 | Include required_args 37 | Include default_status 38 | 39 | CASE "check base env" 40 | Include prepare 41 | AgentRun start OCF_SUCCESS 42 | 43 | CASE "check base env: invalid 'OCF_RESKEY_volgrpname'" 44 | Include prepare 45 | Env OCF_RESKEY_volgrpname=/dev/no_such_device 46 | AgentRun start OCF_ERR_GENERIC 47 | 48 | CASE "check base env: unset 'OCF_RESKEY_volgrpname'" 49 | Include prepare 50 | Unenv OCF_RESKEY_volgrpname 51 | AgentRun start OCF_ERR_CONFIGURED 52 | 53 | CASE "normal start" 54 | Include prepare 55 | AgentRun start OCF_SUCCESS 56 | 57 | CASE "normal stop" 58 | Include prepare 59 | AgentRun start 60 | AgentRun stop OCF_SUCCESS 61 | 62 | CASE "double start" 63 | Include prepare 64 | AgentRun start 65 | AgentRun start OCF_SUCCESS 66 | 67 | CASE "double stop" 68 | Include prepare 69 | AgentRun stop OCF_SUCCESS 70 | 71 | CASE "monitor when running" 72 | Include prepare 73 | AgentRun start 74 | AgentRun monitor OCF_SUCCESS 75 | 76 | CASE "monitor when not running" 77 | Include prepare 78 | AgentRun monitor OCF_NOT_RUNNING 79 | 80 | CASE "unimplemented command" 81 | Include prepare 82 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 83 | 84 | -------------------------------------------------------------------------------- /tools/ocft/MailTo: -------------------------------------------------------------------------------- 1 | # MailTo 2 | 3 | CONFIG 4 | Agent MailTo 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage mailx 7 | HangTimeout 20 8 | 9 | CASE-BLOCK required_args 10 | Env OCF_RESKEY_email=root@localhost 11 | 12 | CASE-BLOCK default_status 13 | AgentRun stop 14 | 15 | CASE-BLOCK prepare 16 | Include required_args 17 | Include default_status 18 | 19 | CASE "check base env" 20 | Include prepare 21 | AgentRun start OCF_SUCCESS 22 | 23 | CASE "check base env: unset 'OCF_RESKEY_email'" 24 | Include prepare 25 | Unenv OCF_RESKEY_email 26 | AgentRun start OCF_ERR_CONFIGURED 27 | 28 | CASE "normal start" 29 | Include prepare 30 | AgentRun start OCF_SUCCESS 31 | 32 | CASE "normal stop" 33 | Include prepare 34 | AgentRun start 35 | AgentRun stop OCF_SUCCESS 36 | 37 | CASE "double start" 38 | Include prepare 39 | AgentRun start 40 | AgentRun start OCF_SUCCESS 41 | 42 | CASE "double stop" 43 | Include prepare 44 | AgentRun stop OCF_SUCCESS 45 | 46 | CASE "monitor with running" 47 | Include prepare 48 | AgentRun start 49 | AgentRun monitor OCF_SUCCESS 50 | 51 | CASE "monitor with not running" 52 | Include prepare 53 | AgentRun monitor OCF_NOT_RUNNING 54 | 55 | CASE "unimplemented command" 56 | Include prepare 57 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 58 | -------------------------------------------------------------------------------- /tools/ocft/Makefile.am: -------------------------------------------------------------------------------- 1 | # Author: John Shi 2 | # jshi@suse.de 3 | # This program is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU General Public License 5 | # as published by the Free Software Foundation; either version 2 6 | # of the License, or (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 | # 17 | 18 | MAINTAINERCLEANFILES = Makefile.in 19 | 20 | EXTRA_DIST = $(ocftcfgs_DATA) $(ocft_DATA) $(ocft_SCRIPTS) 21 | 22 | sbin_SCRIPTS = ocft 23 | 24 | ocftcfgsdir = $(datadir)/$(PACKAGE_NAME)/ocft/configs 25 | ocftcfgs_DATA = apache \ 26 | IPaddr2 \ 27 | IPaddr2v4 \ 28 | IPaddr2v6 \ 29 | IPv6addr \ 30 | Filesystem \ 31 | LVM \ 32 | Raid1 \ 33 | IPsrcaddr \ 34 | MailTo \ 35 | jboss \ 36 | mysql \ 37 | mysql-proxy \ 38 | pgsql \ 39 | db2 \ 40 | oracle \ 41 | drbd.linbit \ 42 | exportfs \ 43 | exportfs-multidir \ 44 | nfsserver \ 45 | portblock \ 46 | iscsi \ 47 | named \ 48 | postfix \ 49 | sg_persist \ 50 | tomcat \ 51 | Xinetd \ 52 | Xen \ 53 | VirtualDomain \ 54 | SendArp 55 | 56 | ocftdir = $(datadir)/$(PACKAGE_NAME)/ocft 57 | ocft_DATA = README \ 58 | README.zh_CN \ 59 | caselib \ 60 | helpers.sh \ 61 | runocft.prereq 62 | ocft_SCRIPTS = runocft 63 | 64 | -------------------------------------------------------------------------------- /tools/ocft/README.zh_CN.in: -------------------------------------------------------------------------------- 1 | 1 介绍和设计 2 | ocft是一个测试resource agents的工具。它并不关注HA的策略,而是关注resource agents 3 | 是否正常运行在本机。他能对resource agents设计各种复杂环境,来考验resource agnets 4 | 是否能正常应对,也就是看resouce agents是否能返回正确的或者说我们所期望的值。 5 | 这个工具给我们带来的好处就是我们可以集中的批量的来设计环境,而且这种环境是可被我们 6 | 记录、重现的,对Debug人员来说是很有用的。 7 | 8 | 1.1 组成 9 | 1.1.1 解释器 (@sbindir@/ocft) 10 | 将test case配置文件转换成可执行的测试脚本。 11 | 12 | 1.1.2 配置文件 (@datadir@/@PACKAGE_NAME@/ocft/configs/) 13 | 每一个configuration file只针对一个resouce agent,配置文件名与resouce agent名相同, 14 | 但是它可以容纳很多test case。 15 | 16 | 1.1.3 测试脚本 (/var/lib/@PACKAGE_NAME@/ocft/cases/) 17 | 由generator读取configuration file生成测试脚本,直接运行此脚本就可以开始测试了。 18 | 19 | 1.2 如何定制环境 20 | ocft 通过两种手段来设计resouce agents的运行环境,一是更改resouce agents的环境变量, 21 | 当然这是ocf本身就留给我们的接口。二是更改resource agents所处的系统环境, 22 | 比如更改某个关键文件的权限,更改本机ip地址等等... 23 | 24 | 1.3 如何进行测试 25 | 首先你需要针对某个resource agent在脑中勾画各种复杂且异常的环境,并且你能清楚预知 26 | 这些异常环境会给resource agent带来什么结果,然后将这些设计好的环境和你预知的结果 27 | 都写入配置文件,然后运行generator,将你刚写的test case转换成可执行的脚本。最后运行 28 | 这些脚本,观察它们的输出,你可以清楚看到每个test case运行状况,他会比较你的预知结 29 | 果和resource agent的实际结果,如果不一样,说明你找到resource agent的bug了。 30 | 所有的测试输出都会被记录到日志文件中,你可以在 /var/lib/@PACKAGE_NAME@/ocft/cases/logs 31 | 中找到他们. 32 | 33 | 2 配置 34 | 只有6个top level option,它们是由大写字母和'-'构成的,每个top level option都有若干sub-option, 35 | 它们是首字母大写。 36 | 37 | 2.1 'CONFIG' 选项 38 | 语法:CONFIG 39 | 此option中的设计是全局的,对每个test case都有所影响。 40 | 41 | 2.1.1 'Agent' 选项 42 | 语法:Agent AGENT_NAME 43 | 你要测试的Agent的名字。 44 | 45 | 2.1.2 'AgentRoot' 选项 46 | 语法:AgentRoot /usr/lib/ocf/resource.d/xxx 47 | 一些agent将会被移到 "pacemaker" 或 "linbit" 目录,如果你定义了这个选项,ocft将会用它来 48 | 替代默认的目录"heartbeat"。 49 | 50 | 2.1.3 'InstallPackage' 选项 51 | 语法:InstallPackage package [package2 [...]] 52 | 他会检测系统是否安装了此resource agent的service,如果没有安装,会自动从网络进行安装。 53 | package_name是某个resouce agent在操作系统中必须安装的包。 54 | 55 | 2.1.4 'HangTimeout' 选项 56 | 语法:HangTimeout secs 57 | 如果你更改了一些很关键的东西,有些resouce agent会不知所措,停在那里不动,那么就会影响 58 | 到后面test case的运行,所以你需要设定超时,如果一旦resouce agent停在那超时了,脚本会 59 | 杀死这个resouce agent。 60 | 61 | 2.2 'VARIABLE' 选项 62 | 语法: 63 | VARIABLE 64 | VAR1=value1 65 | VAR2=value2 66 | ... 67 | 在此定义全局变量,这些变量可以用于配置文件中的任何地方,引用时在变量名前加上$。请注意,这些 68 | 变量不同于Env定义的变量,Env是定义环境变量,可以改变agent的行为,而这些变量只是用于配置文件中 69 | 共享。 70 | 71 | 2.3 'SETUP-AGENT' 选项 72 | 语法: 73 | SETUP-AGENT 74 | bash scripts... 75 | ... 76 | 一些Agent在测试前可能需要初始化,你可以用bash脚本在这初始化。 77 | 78 | 2.4 'CLEANUP-AGENT' 选项 79 | 语法: 80 | CLEANUP-AGENT 81 | bash scripts... 82 | ... 83 | 如果之前定义了SETUP-AGENT, 你可能还需要此选项在测试完后来作一些清除。 84 | 85 | 2.5 'CASE' & 'CASE-BLOCK' 选项 86 | 语法:CASE "description" & CASE-BLOCK macro_name 87 | 通常你设计的环境不止一个,那么配置文件中应该会出现许多 'CASE "..."',值得注意的是,以下子 88 | 选项每个都有两种写法,一是普通写法,产生的shell代码对本地产生作用,二是特殊写法,就是在每 89 | 个选项后加上 "@ipaddr",他可以远程执行shell代码,也就是控制远程机器执行你给的shell代码, 90 | 这对需要两台机器以上的resouce agent很有用的,这个远程shell并非简单的用ssh去远程执行,而是在 91 | test case生存期内,后台运行一个远程shell,他始终在后台运行并且保存你的中间结果,也就是说你 92 | 可以交替执行本地shell代码段和远程shell代码段。 93 | 'CASE-BLOCK'选项是一个宏定义器,它定义的内容将会被插入到"CASE"内容中。 94 | 95 | 2.5.1 'Env' 选项 96 | 语法:Env VARIABLE=value 97 | 这是设置resouce agent的环境变量,他们通常是OCF_RESKEY_xxx,注意=号两边不要有空格。 98 | 99 | 2.5.2 'Unenv' 选项 100 | 语法:Unenv VARIABLE 101 | 此选项用于删除环境变量。 102 | 103 | 2.5.3 'Include' 选项 104 | 语法:Include macro_name 105 | 此选项将会被宏"macro_name"的内容所替代,当然,你得预先用"CASE-BLOCK"来定义宏"macro_name" 106 | 的内容。 107 | 108 | 2.5.4 'Bash' 选项 109 | 语法:Bash bash_codes 110 | 此选项是用来设置os的环境,你可以嵌入bash代码来对系统作任意设置,不过要注意不要对系统造成 111 | 不可恢复的后果就行了。 112 | 113 | 2.5.5 'BashAtExit' 选项 114 | 语法:BashAtExit bash_codes 115 | 此选项是用来恢复os的环境,以便另一个test case能正常运行,当然你也可以直接用'Bash'选项来 116 | 恢复,但是如果脚本在执行过程中产生某些错误,那么脚本会直接退出,而不会去执行你的恢复代码, 117 | 那么你就要用到BashAtExit,他能在你退出前去恢复系统环境。 118 | 119 | 2.5.6 'AgentRun' 选项 120 | 语法:AgentRun cmd [ret_value] 121 | 此option会去运行resouce agent,'cmd' 就是resouce agent的参数,如 start,status,stop ... 122 | 第二个参数是可选的,它是你对系统环境作出特殊设定以后,你预计resouce agent会返回的值, 123 | 如果给出此参数,那么脚本会在运行resouce agent后,会比较此时的返回值和你预期的返回值, 124 | 如果不一致,那么说明找到bug了。 125 | -------------------------------------------------------------------------------- /tools/ocft/Raid1: -------------------------------------------------------------------------------- 1 | # Raid1 2 | # by dejan@suse.de on 3 | # Fri Aug 24 17:01:40 CEST 2012 4 | 5 | CONFIG 6 | Agent Raid1 7 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 8 | InstallPackage mdadm 9 | HangTimeout 20 10 | 11 | VARIABLE 12 | OCFT_rundir="`get_rundir`" 13 | OCFT_disk0=$OCFT_rundir/resource-agents/ocft-Raid1-disk0 14 | OCFT_disk1=$OCFT_rundir/resource-agents/ocft-Raid1-disk1 15 | OCFT_disk2=$OCFT_rundir/resource-agents/ocft-Raid1-disk2 16 | OCFT_disk3=$OCFT_rundir/resource-agents/ocft-Raid1-disk3 17 | OCFT_raidconf=$OCFT_rundir/resource-agents/ocft-mdadm.conf 18 | OCFT_raiddev=/dev/md8 19 | OCFT_raiddev2=/dev/md9 20 | OCFT_loop0="`loopbackeddev make $OCFT_disk0 16M`" 21 | OCFT_loop1="`loopbackeddev make $OCFT_disk1 16M`" 22 | OCFT_loop2="`loopbackeddev make $OCFT_disk2 16M`" 23 | OCFT_loop3="`loopbackeddev make $OCFT_disk3 16M`" 24 | 25 | SETUP-AGENT 26 | mdadm --create $OCFT_raiddev -l 0 --raid-devices=2 $OCFT_loop0 $OCFT_loop1 27 | mdadm --create $OCFT_raiddev2 -l 0 --raid-devices=2 $OCFT_loop2 $OCFT_loop3 28 | echo DEVICE $OCFT_loop0 $OCFT_loop1 > $OCFT_raidconf 29 | echo DEVICE $OCFT_loop2 $OCFT_loop3 >> $OCFT_raidconf 30 | echo ARRAY $OCFT_raiddev devices=$OCFT_loop0,$OCFT_loop1 >> $OCFT_raidconf 31 | echo ARRAY $OCFT_raiddev2 devices=$OCFT_loop2,$OCFT_loop3 >> $OCFT_raidconf 32 | 33 | CLEANUP-AGENT 34 | mdadm --zero-superblock $OCFT_loop0 35 | mdadm --zero-superblock $OCFT_loop1 36 | mdadm --zero-superblock $OCFT_loop2 37 | mdadm --zero-superblock $OCFT_loop3 38 | mdadm --remove $OCFT_raiddev 2>/dev/null 39 | mdadm --remove $OCFT_raiddev2 2>/dev/null 40 | loopbackeddev unmake $OCFT_disk0 41 | loopbackeddev unmake $OCFT_disk1 42 | loopbackeddev unmake $OCFT_disk2 43 | loopbackeddev unmake $OCFT_disk3 44 | rm -f $OCFT_raidconf 45 | 46 | CASE-BLOCK required_args 47 | Env OCF_RESKEY_raidconf=$OCFT_raidconf 48 | Env OCF_RESKEY_raiddev=$OCFT_raiddev 49 | 50 | CASE-BLOCK default_status 51 | AgentRun stop 52 | 53 | CASE-BLOCK prepare 54 | Include required_args 55 | Include default_status 56 | 57 | CASE-BLOCK prepare_auto 58 | Include required_args 59 | Env OCF_RESKEY_raiddev="auto" 60 | Include default_status 61 | 62 | CASE-BLOCK prepare_multiple 63 | Include required_args 64 | Env OCF_RESKEY_raiddev="$OCFT_raiddev $OCFT_raiddev2" 65 | Include default_status 66 | 67 | CASE "check base env" 68 | Include prepare 69 | AgentRun start OCF_SUCCESS 70 | 71 | CASE "check base env: invalid 'OCF_RESKEY_raiddev'" 72 | Include prepare 73 | Env OCF_RESKEY_raiddev=/dev/no_such_device 74 | AgentRun start OCF_ERR_GENERIC 75 | 76 | CASE "check base env: unset 'OCF_RESKEY_raiddev'" 77 | Include prepare 78 | Unenv OCF_RESKEY_raiddev 79 | AgentRun start OCF_ERR_CONFIGURED 80 | 81 | CASE "normal start" 82 | Include prepare 83 | AgentRun start OCF_SUCCESS 84 | 85 | CASE "normal stop" 86 | Include prepare 87 | AgentRun start 88 | AgentRun stop OCF_SUCCESS 89 | 90 | CASE "double start" 91 | Include prepare 92 | AgentRun start 93 | AgentRun start OCF_SUCCESS 94 | 95 | CASE "double stop" 96 | Include prepare 97 | AgentRun stop OCF_SUCCESS 98 | 99 | CASE "monitor when running" 100 | Include prepare 101 | AgentRun start 102 | AgentRun monitor OCF_SUCCESS 103 | 104 | CASE "monitor when not running" 105 | Include prepare 106 | AgentRun monitor OCF_NOT_RUNNING 107 | 108 | CASE "normal start (auto)" 109 | Include prepare_auto 110 | AgentRun start OCF_SUCCESS 111 | AgentRun monitor OCF_SUCCESS 112 | 113 | CASE "normal stop (auto)" 114 | Include prepare_auto 115 | AgentRun start 116 | AgentRun stop OCF_SUCCESS 117 | AgentRun monitor OCF_NOT_RUNNING 118 | 119 | CASE "normal start (multiple)" 120 | Include prepare 121 | AgentRun start OCF_SUCCESS 122 | AgentRun monitor OCF_SUCCESS 123 | 124 | CASE "normal stop (multiple)" 125 | Include prepare 126 | Env OCF_RESKEY_raiddev="$OCFT_raiddev $OCFT_raiddev2" 127 | AgentRun start 128 | AgentRun stop OCF_SUCCESS 129 | AgentRun monitor OCF_NOT_RUNNING 130 | 131 | CASE "unimplemented command" 132 | Include prepare 133 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 134 | 135 | -------------------------------------------------------------------------------- /tools/ocft/SendArp: -------------------------------------------------------------------------------- 1 | # SendArp 2 | 3 | CONFIG 4 | Agent SendArp 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage resource-agents 7 | HangTimeout 15 8 | 9 | CASE-BLOCK required_args 10 | Env OCF_RESKEY_ip=127.0.0.1 11 | Env OCF_RESKEY_nic=lo 12 | Env OCF_RESKEY_background=false 13 | 14 | CASE-BLOCK default_status 15 | AgentRun stop 16 | 17 | CASE-BLOCK prepare 18 | Include required_args 19 | Include default_status 20 | 21 | CASE "check base env" 22 | Include prepare 23 | AgentRun start OCF_SUCCESS 24 | 25 | CASE "check base env: unset 'OCF_RESKEY_ip'" 26 | Include prepare 27 | Unenv OCF_RESKEY_ip 28 | AgentRun start OCF_ERR_CONFIGURED 29 | 30 | CASE "check base env: set invalid 'OCF_RESKEY_ip'" 31 | Include prepare 32 | Env OCF_RESKEY_ip=not_ip_address 33 | AgentRun start OCF_ERR_GENERIC 34 | 35 | CASE "check base env: unset 'OCF_RESKEY_nic'" 36 | Include prepare 37 | Unenv OCF_RESKEY_nic 38 | AgentRun start OCF_ERR_CONFIGURED 39 | 40 | CASE "check base env: set invalid 'OCF_RESKEY_nic'" 41 | Include prepare 42 | Env OCF_RESKEY_nic=not_nic 43 | AgentRun start OCF_ERR_GENERIC 44 | 45 | CASE "normal start" 46 | Include prepare 47 | AgentRun start OCF_SUCCESS 48 | 49 | CASE "normal stop" 50 | Include prepare 51 | AgentRun start 52 | AgentRun stop OCF_SUCCESS 53 | 54 | CASE "double start" 55 | Include prepare 56 | AgentRun start 57 | AgentRun start OCF_SUCCESS 58 | 59 | CASE "double stop" 60 | Include prepare 61 | AgentRun stop OCF_SUCCESS 62 | 63 | CASE "monitor with running" 64 | Include prepare 65 | AgentRun start 66 | AgentRun monitor OCF_SUCCESS 67 | 68 | CASE "monitor with not running" 69 | Include prepare 70 | AgentRun monitor OCF_NOT_RUNNING 71 | 72 | CASE "unimplemented command" 73 | Include prepare 74 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 75 | -------------------------------------------------------------------------------- /tools/ocft/VirtualDomain: -------------------------------------------------------------------------------- 1 | # VirtualDomain 2 | # by dejan@suse.de on 3 | # Tue Jul 8 12:48:03 CEST 2014 4 | 5 | CONFIG 6 | Agent VirtualDomain 7 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 8 | HangTimeout 20 9 | 10 | # set OCFT_config to the libvirt configuration file 11 | # the guest is going to be stopped and started 12 | VARIABLE 13 | OCFT_config=/etc/libvirt/qemu/sle11-sp3.xml 14 | 15 | CASE-BLOCK required_args 16 | Env OCF_RESKEY_config=$OCFT_config 17 | 18 | CASE-BLOCK unset_utilization 19 | Env OCF_RESKEY_autoset_utilization_host_memory=false 20 | Env OCF_RESKEY_autoset_utilization_hv_memory=false 21 | Env OCF_RESKEY_autoset_utilization_cpu=false 22 | 23 | CASE-BLOCK default_status 24 | AgentRun stop 25 | 26 | CASE-BLOCK prepare 27 | Include required_args 28 | Include unset_utilization 29 | Include default_status 30 | 31 | CASE "check base env" 32 | Include prepare 33 | AgentRun start OCF_SUCCESS 34 | 35 | CASE "check base env: invalid 'OCF_RESKEY_config'" 36 | Include prepare 37 | Env OCF_RESKEY_config=/no_such_file 38 | AgentRun start OCF_ERR_INSTALLED 39 | 40 | CASE "check base env: unset 'OCF_RESKEY_config'" 41 | Include prepare 42 | Unenv OCF_RESKEY_config 43 | AgentRun start OCF_ERR_CONFIGURED 44 | 45 | CASE "normal stop" 46 | Include prepare 47 | AgentRun start 48 | AgentRun stop OCF_SUCCESS 49 | 50 | CASE "double start" 51 | Include prepare 52 | AgentRun start 53 | AgentRun start OCF_SUCCESS 54 | 55 | CASE "double stop" 56 | Include prepare 57 | AgentRun stop OCF_SUCCESS 58 | 59 | CASE "monitor when running" 60 | Include prepare 61 | AgentRun start 62 | AgentRun monitor OCF_SUCCESS 63 | 64 | CASE "monitor when not running" 65 | Include prepare 66 | AgentRun monitor OCF_NOT_RUNNING 67 | 68 | CASE "unimplemented command" 69 | Include prepare 70 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 71 | 72 | -------------------------------------------------------------------------------- /tools/ocft/Xen: -------------------------------------------------------------------------------- 1 | # Xen 2 | # by dejan@suse.de on 3 | # Tue Jul 8 12:20:23 CEST 2014 4 | 5 | CONFIG 6 | Agent Xen 7 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 8 | HangTimeout 20 9 | 10 | # set OCFT_xmfile to the xen-xm format file 11 | # the guest is going to be stopped and started 12 | VARIABLE 13 | OCFT_xmfile=/etc/xen/vm/xen-f 14 | 15 | CASE-BLOCK required_args 16 | Env OCF_RESKEY_xmfile=$OCFT_xmfile 17 | 18 | CASE-BLOCK default_status 19 | AgentRun stop 20 | 21 | CASE-BLOCK prepare 22 | Include required_args 23 | Include default_status 24 | 25 | CASE "check base env" 26 | Include prepare 27 | AgentRun start OCF_SUCCESS 28 | 29 | CASE "check base env: invalid 'OCF_RESKEY_xmfile'" 30 | Include prepare 31 | Env OCF_RESKEY_xmfile=/no_such_file 32 | AgentRun start OCF_ERR_INSTALLED 33 | 34 | CASE "check base env: unset 'OCF_RESKEY_xmfile'" 35 | Include prepare 36 | Unenv OCF_RESKEY_xmfile 37 | AgentRun start OCF_ERR_INSTALLED 38 | 39 | CASE "normal stop" 40 | Include prepare 41 | AgentRun start 42 | AgentRun stop OCF_SUCCESS 43 | 44 | CASE "double start" 45 | Include prepare 46 | AgentRun start 47 | AgentRun start OCF_SUCCESS 48 | 49 | CASE "double stop" 50 | Include prepare 51 | AgentRun stop OCF_SUCCESS 52 | 53 | CASE "monitor when running" 54 | Include prepare 55 | AgentRun start 56 | AgentRun monitor OCF_SUCCESS 57 | 58 | CASE "monitor when not running" 59 | Include prepare 60 | AgentRun monitor OCF_NOT_RUNNING 61 | 62 | CASE "unimplemented command" 63 | Include prepare 64 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 65 | 66 | -------------------------------------------------------------------------------- /tools/ocft/Xinetd: -------------------------------------------------------------------------------- 1 | # Xinetd 2 | 3 | CONFIG 4 | Agent Xinetd 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage xinetd 7 | 8 | SETUP-AGENT 9 | sed -i /disable/s/yes/no/ /etc/xinetd.d/echo 10 | if which /etc/init.d/xinetd >/dev/null 2>&1; then 11 | /etc/init.d/xinetd start 12 | elif systemctl list-unit-files | grep -qs xinetd; then 13 | systemctl start xinetd 14 | fi 15 | 16 | CASE-BLOCK required_args 17 | Env OCF_RESKEY_service=discard 18 | 19 | CASE-BLOCK default_status 20 | AgentRun stop 21 | 22 | CASE-BLOCK prepare 23 | Include required_args 24 | Include default_status 25 | 26 | CASE "check base env" 27 | Include prepare 28 | AgentRun start OCF_SUCCESS 29 | 30 | CASE "check base env: unset 'OCF_RESKEY_protocol'" 31 | Include prepare 32 | Unenv OCF_RESKEY_service 33 | AgentRun start OCF_ERR_CONFIGURED 34 | 35 | CASE "normal start" 36 | Include prepare 37 | AgentRun start OCF_SUCCESS 38 | 39 | CASE "normal stop" 40 | Include prepare 41 | AgentRun start 42 | AgentRun stop OCF_SUCCESS 43 | 44 | CASE "double start" 45 | Include prepare 46 | AgentRun start 47 | AgentRun start OCF_SUCCESS 48 | 49 | CASE "double stop" 50 | Include prepare 51 | AgentRun stop OCF_SUCCESS 52 | 53 | CASE "monitor with running" 54 | Include prepare 55 | AgentRun start 56 | AgentRun monitor OCF_SUCCESS 57 | 58 | CASE "monitor with not running" 59 | Include prepare 60 | AgentRun monitor OCF_NOT_RUNNING 61 | 62 | CASE "unimplemented command" 63 | Include prepare 64 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 65 | -------------------------------------------------------------------------------- /tools/ocft/apache: -------------------------------------------------------------------------------- 1 | # apache 2 | # make sure that your apache configuration loads mod_status 3 | 4 | CONFIG 5 | Agent apache 6 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 7 | InstallPackage apache2 8 | HangTimeout 20 9 | 10 | SETUP-AGENT 11 | if systemctl list-unit-files 2>/dev/null | fgrep -q apache2.service; then 12 | systemctl start apache2.service 13 | systemctl stop apache2.service 14 | else 15 | /etc/init.d/apache2 start 16 | /etc/init.d/apache2 stop 17 | fi 18 | 19 | CASE-BLOCK default_status 20 | AgentRun stop 21 | 22 | CASE-BLOCK prepare 23 | Include default_status 24 | 25 | CASE "check base env" 26 | Include prepare 27 | AgentRun start OCF_SUCCESS 28 | 29 | CASE "check base env: set non-existing OCF_RESKEY_statusurl" 30 | Include prepare 31 | Env OCF_RESKEY_statusurl="yoyoyoyo" 32 | AgentRun start OCF_ERR_GENERIC 33 | 34 | CASE "check base env: set non-existing OCF_RESKEY_configfile" 35 | Include prepare 36 | Env OCF_RESKEY_configfile="/yoyoyoyo/nosuchfile" 37 | AgentRun start OCF_ERR_INSTALLED 38 | 39 | CASE "normal start" 40 | Include prepare 41 | AgentRun start OCF_SUCCESS 42 | 43 | CASE "normal stop" 44 | Include prepare 45 | AgentRun start 46 | AgentRun stop OCF_SUCCESS 47 | 48 | CASE "double start" 49 | Include prepare 50 | AgentRun start 51 | AgentRun start OCF_SUCCESS 52 | 53 | CASE "double stop" 54 | Include prepare 55 | AgentRun stop OCF_SUCCESS 56 | 57 | CASE "running monitor" 58 | Include prepare 59 | AgentRun start 60 | AgentRun monitor OCF_SUCCESS 61 | 62 | CASE "not running monitor" 63 | Include prepare 64 | AgentRun monitor OCF_NOT_RUNNING 65 | 66 | CASE "unimplemented command" 67 | Include prepare 68 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 69 | -------------------------------------------------------------------------------- /tools/ocft/exportfs: -------------------------------------------------------------------------------- 1 | # exportfs 2 | # 3 | # 4 | 5 | CONFIG 6 | Agent exportfs 7 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 8 | InstallPackage nfs-kernel-server 9 | HangTimeout 40 10 | 11 | SETUP-AGENT 12 | # nothing 13 | 14 | CASE-BLOCK set_testenv 15 | Env OCF_RESKEY_directory=/usr 16 | Env OCF_RESKEY_fsid=105 17 | Env OCF_RESKEY_clientspec="*" 18 | Env OCF_RESKEY_CRM_meta_timeout=30000 19 | 20 | CASE-BLOCK default_status 21 | AgentRun stop 22 | 23 | CASE-BLOCK prepare 24 | Include set_testenv 25 | Include default_status 26 | 27 | CASE "check base env" 28 | Include prepare 29 | AgentRun start OCF_SUCCESS 30 | 31 | CASE "check base env: invalid 'OCF_RESKEY_directory'" 32 | Include prepare 33 | Env OCF_RESKEY_directory=/no_such 34 | AgentRun start OCF_ERR_CONFIGURED 35 | 36 | CASE "check base env: non-decimal 'OCF_RESKEY_fsid'" 37 | Include prepare 38 | Env OCF_RESKEY_fsid="4f838db14f838db14f838db14f838db1" 39 | AgentRun start OCF_SUCCESS 40 | 41 | CASE "unimplemented command" 42 | Include prepare 43 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 44 | 45 | CASE "normal start" 46 | Include prepare 47 | AgentRun start OCF_SUCCESS 48 | 49 | CASE "normal stop" 50 | Include prepare 51 | AgentRun start 52 | AgentRun stop OCF_SUCCESS 53 | 54 | CASE "double start" 55 | Include prepare 56 | AgentRun start 57 | AgentRun start OCF_SUCCESS 58 | 59 | CASE "double stop" 60 | Include prepare 61 | AgentRun stop OCF_SUCCESS 62 | 63 | CASE "stop with no env" 64 | Include prepare 65 | Env OCF_RESKEY_directory=/no_such 66 | AgentRun stop OCF_SUCCESS 67 | 68 | CASE "started: monitor" 69 | Include prepare 70 | AgentRun start 71 | AgentRun monitor OCF_SUCCESS 72 | 73 | CASE "not started: monitor" 74 | Include prepare 75 | AgentRun monitor OCF_NOT_RUNNING 76 | -------------------------------------------------------------------------------- /tools/ocft/exportfs-multidir: -------------------------------------------------------------------------------- 1 | # exportfs 2 | # 3 | # 4 | 5 | CONFIG 6 | Agent exportfs 7 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 8 | InstallPackage nfs-kernel-server 9 | HangTimeout 40 10 | 11 | SETUP-AGENT 12 | # nothing 13 | 14 | CASE-BLOCK set_testenv 15 | Env OCF_RESKEY_directory="/usr /var" 16 | Env OCF_RESKEY_fsid=105 17 | Env OCF_RESKEY_clientspec="*" 18 | Env OCF_RESKEY_CRM_meta_timeout=30000 19 | 20 | CASE-BLOCK default_status 21 | AgentRun stop 22 | 23 | CASE-BLOCK prepare 24 | Include set_testenv 25 | Include default_status 26 | 27 | CASE "check base env" 28 | Include prepare 29 | AgentRun start OCF_SUCCESS 30 | 31 | CASE "check base env: invalid 'OCF_RESKEY_directory'" 32 | Include prepare 33 | Env OCF_RESKEY_directory=/no_such 34 | AgentRun start OCF_ERR_CONFIGURED 35 | 36 | CASE "check base env: invalid 'OCF_RESKEY_fsid'" 37 | Include prepare 38 | Env OCF_RESKEY_fsid=root 39 | AgentRun start OCF_ERR_CONFIGURED 40 | 41 | CASE "unimplemented command" 42 | Include prepare 43 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 44 | 45 | CASE "normal start" 46 | Include prepare 47 | AgentRun start OCF_SUCCESS 48 | 49 | CASE "normal stop" 50 | Include prepare 51 | AgentRun start 52 | AgentRun stop OCF_SUCCESS 53 | 54 | CASE "double start" 55 | Include prepare 56 | AgentRun start 57 | AgentRun start OCF_SUCCESS 58 | 59 | CASE "double stop" 60 | Include prepare 61 | AgentRun stop OCF_SUCCESS 62 | 63 | CASE "stop with no env" 64 | Include prepare 65 | Env OCF_RESKEY_directory="/usr /no_such" 66 | AgentRun stop OCF_SUCCESS 67 | 68 | CASE "started: monitor" 69 | Include prepare 70 | AgentRun start 71 | AgentRun monitor OCF_SUCCESS 72 | 73 | CASE "not started: monitor" 74 | Include prepare 75 | AgentRun monitor OCF_NOT_RUNNING 76 | -------------------------------------------------------------------------------- /tools/ocft/helpers.sh: -------------------------------------------------------------------------------- 1 | get_rundir() { 2 | local rundir 3 | rundir="`mount | grep '/run ' | awk '{print $3}'`" 4 | echo ${rundir:-"/var/run"} 5 | } 6 | 7 | loopbackeddev() { 8 | local action file size ctlfile 9 | 10 | action="$1" 11 | file="$2" 12 | size="$3" 13 | ctlfile=$HA_RSCTMP/`echo $file | tr / _` 14 | 15 | case "$action" in 16 | start|setup|make) 17 | if [ ! -f "$ctlfile" ]; then 18 | if [ -z "$size" ]; then 19 | echo "usage: $0 action file size" >&2 20 | exit 1 21 | fi 22 | loopdev=`losetup -f` 23 | if ! dd if=/dev/zero of=$file bs=1 count=0 seek=$size 2>/dev/null; then 24 | echo "$0: dd failed" >&2 25 | exit 1 26 | fi 27 | if ! losetup $loopdev $file; then 28 | echo "$0: losetup failed" >&2 29 | exit 1 30 | fi 31 | echo $loopdev | tee $ctlfile 32 | else 33 | cat $ctlfile 34 | fi 35 | ;; 36 | stop|undo|unmake) 37 | if [ -f "$ctlfile" ]; then 38 | losetup -d `cat $ctlfile` 39 | rm -f $file $ctlfile 40 | fi 41 | ;; 42 | esac 43 | } 44 | -------------------------------------------------------------------------------- /tools/ocft/iscsi: -------------------------------------------------------------------------------- 1 | # iscsi 2 | 3 | CONFIG 4 | Agent iscsi 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage open-iscsi targetcli 7 | HangTimeout 20 8 | 9 | VARIABLE 10 | OCFT_rundir="`get_rundir`" 11 | OCFT_disk="$OCFT_rundir/resource-agents/ocft-iscsi" 12 | OCFT_target="iqn.2003-01.org.linux-iscsi:ocft" 13 | OCFT_portal="127.0.0.1:3260" 14 | OCFT_loop="`loopbackeddev make $OCFT_disk 16M`" 15 | OCF_RESKEY_iqn=$OCFT_target 16 | OCF_RESKEY_portals=$OCFT_portal 17 | OCF_RESKEY_target_iqn=$OCFT_target 18 | OCF_RESKEY_path=$OCFT_loop 19 | OCF_RESKEY_lun=1 20 | 21 | SETUP-AGENT 22 | if systemctl list-unit-files 2>/dev/null | fgrep -q iscsid.service; then 23 | systemctl start iscsid.service 24 | else 25 | /etc/init.d/open-iscsi start 26 | fi 27 | if systemctl list-unit-files 2>/dev/null | fgrep -q target.service; then 28 | systemctl start target.service 29 | else 30 | /etc/init.d/target start 31 | fi 32 | export OCF_RESKEY_iqn=$OCFT_target 33 | export OCF_RESKEY_portals=$OCFT_portal 34 | export OCF_RESKEY_target_iqn=$OCFT_target 35 | export OCF_RESKEY_path=$OCFT_loop 36 | export OCF_RESKEY_lun=1 37 | /usr/lib/ocf/resource.d/heartbeat/iSCSITarget start 38 | /usr/lib/ocf/resource.d/heartbeat/iSCSILogicalUnit start 39 | 40 | CLEANUP-AGENT 41 | export OCF_RESKEY_iqn=$OCFT_target 42 | export OCF_RESKEY_portals=$OCFT_portal 43 | export OCF_RESKEY_target_iqn=$OCFT_target 44 | export OCF_RESKEY_path=$OCFT_loop 45 | export OCF_RESKEY_lun=1 46 | /usr/lib/ocf/resource.d/heartbeat/iSCSILogicalUnit stop 47 | /usr/lib/ocf/resource.d/heartbeat/iSCSITarget stop 48 | if systemctl list-unit-files 2>/dev/null | fgrep -q target.service; then 49 | systemctl stop target.service 50 | fi 51 | loopbackeddev unmake $OCFT_disk 52 | 53 | CASE-BLOCK required_args 54 | Env OCF_RESKEY_portal=$OCFT_portal 55 | Env OCF_RESKEY_target=$OCFT_target 56 | 57 | CASE-BLOCK default_status 58 | AgentRun stop 59 | 60 | CASE-BLOCK prepare 61 | Include required_args 62 | Include default_status 63 | 64 | CASE "check base env" 65 | Include prepare 66 | AgentRun start OCF_SUCCESS 67 | 68 | CASE "check base env: invalid 'OCF_RESKEY_portal'" 69 | Include prepare 70 | Unenv OCF_RESKEY_portal 71 | AgentRun start OCF_ERR_CONFIGURED 72 | 73 | CASE "check base env: unset 'OCF_RESKEY_target'" 74 | Include prepare 75 | Unenv OCF_RESKEY_target 76 | AgentRun start OCF_ERR_CONFIGURED 77 | 78 | CASE "normal start" 79 | Include prepare 80 | AgentRun start OCF_SUCCESS 81 | 82 | CASE "normal stop" 83 | Include prepare 84 | AgentRun start 85 | AgentRun stop OCF_SUCCESS 86 | 87 | CASE "double start" 88 | Include prepare 89 | AgentRun start 90 | AgentRun start OCF_SUCCESS 91 | 92 | CASE "double stop" 93 | Include prepare 94 | AgentRun stop OCF_SUCCESS 95 | 96 | CASE "monitor when running" 97 | Include prepare 98 | AgentRun start 99 | AgentRun monitor OCF_SUCCESS 100 | 101 | CASE "monitor when not running" 102 | Include prepare 103 | AgentRun monitor OCF_NOT_RUNNING 104 | 105 | CASE "unimplemented command" 106 | Include prepare 107 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 108 | 109 | -------------------------------------------------------------------------------- /tools/ocft/jboss: -------------------------------------------------------------------------------- 1 | # jboss 2 | # 3 | # NOTE: Clean up $jboss_home/standalone/log before running this test 4 | # otherwise creating the pid/log files may fail 5 | # in the test case with a different user. 6 | 7 | CONFIG 8 | Agent jboss 9 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 10 | HangTimeout 120 11 | 12 | # Note : Change setting by a version of JBoss. 13 | # 14 | VARIABLE 15 | # JBoss5 Environment require 16 | # jboss_version=5 17 | # jboss_home=/opt/jboss5/current 18 | # java_home=/usr/lib/jvm/java-1.6.0-openjdk.x86_64 19 | # user=jboss5 20 | # JBoss6 Environment require 21 | jboss_version=6 22 | jboss_home=/opt/jboss6/current 23 | java_home=/usr/lib/jvm/java-1.7.0-openjdk.x86_64 24 | user=jboss6 25 | 26 | CASE-BLOCK required_args_jboss 27 | Env OCF_RESKEY_jboss_home=${jboss_home} 28 | Env OCF_RESKEY_java_home=${java_home} 29 | Env OCF_RESKEY_jboss_version=${jboss_version} 30 | Env OCF_RESKEY_user=${user} 31 | 32 | CASE-BLOCK args_clear 33 | Unenv OCF_RESKEY_jboss_home 34 | Unenv OCF_RESKEY_java_home 35 | Unenv OCF_RESKEY_jboss_version 36 | Unenv OCF_RESKEY_user 37 | 38 | CASE-BLOCK default_status 39 | AgentRun stop 40 | 41 | CASE-BLOCK prepare_jboss 42 | Include required_args_jboss 43 | Include default_status 44 | 45 | # Test CASE 46 | # 47 | CASE "normal start jboss require_args (user:user)" 48 | Include prepare_jboss 49 | AgentRun start OCF_SUCCESS 50 | AgentRun monitor OCF_SUCCESS 51 | AgentRun stop OCF_SUCCESS 52 | AgentRun monitor OCF_NOT_RUNNING 53 | Include args_clear 54 | 55 | CASE "normal start jboss require_args (user:root)" 56 | Include prepare_jboss 57 | Unenv OCF_RESKEY_user 58 | AgentRun start OCF_SUCCESS 59 | AgentRun monitor OCF_SUCCESS 60 | AgentRun stop OCF_SUCCESS 61 | AgentRun monitor OCF_NOT_RUNNING 62 | Include args_clear 63 | 64 | CASE "error start jboss no jboss_home" 65 | Include prepare_jboss 66 | Unenv OCF_RESKEY_jboss_home 67 | AgentRun start OCF_ERR_INSTALLED 68 | Include args_clear 69 | 70 | CASE "error start jboss no java_home" 71 | Include prepare_jboss 72 | Unenv OCF_RESKEY_java_home 73 | AgentRun start OCF_ERR_INSTALLED 74 | Include args_clear 75 | 76 | CASE "error start jboss no java command" 77 | Include prepare_jboss 78 | Env OCF_RESKEY_java_home=/var 79 | AgentRun start OCF_ERR_INSTALLED 80 | AgentRun stop OCF_SUCCESS 81 | AgentRun monitor OCF_NOT_RUNNING 82 | Include args_clear 83 | 84 | -------------------------------------------------------------------------------- /tools/ocft/mysql: -------------------------------------------------------------------------------- 1 | # mysql 2 | 3 | CONFIG 4 | Agent mysql 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage mysql 7 | HangTimeout 20 8 | 9 | SETUP-AGENT 10 | if systemctl list-unit-files 2>/dev/null | fgrep -q mysql.service; then 11 | systemctl start mysql.service 12 | systemctl stop mysql.service 13 | else 14 | /etc/init.d/mysql start 15 | /etc/init.d/mysql stop 16 | fi 17 | 18 | CASE-BLOCK crm_setting 19 | Env OCF_RESKEY_CRM_meta_timeout=15000 20 | 21 | CASE-BLOCK default_status 22 | AgentRun stop 23 | 24 | CASE-BLOCK prepare 25 | Include crm_setting 26 | Include default_status 27 | 28 | CASE "check base env" 29 | Include prepare 30 | AgentRun start OCF_SUCCESS 31 | 32 | CASE "check base env: invalid 'OCF_RESKEY_binary'" 33 | Include prepare 34 | Env OCF_RESKEY_binary=no_such 35 | AgentRun start OCF_ERR_INSTALLED 36 | 37 | CASE "normal start" 38 | Include prepare 39 | AgentRun start OCF_SUCCESS 40 | 41 | CASE "normal stop" 42 | Include prepare 43 | AgentRun start 44 | AgentRun stop OCF_SUCCESS 45 | 46 | CASE "double start" 47 | Include prepare 48 | AgentRun start 49 | AgentRun start OCF_SUCCESS 50 | 51 | CASE "double stop" 52 | Include prepare 53 | AgentRun stop OCF_SUCCESS 54 | 55 | CASE "running monitor" 56 | Include prepare 57 | AgentRun start 58 | AgentRun monitor OCF_SUCCESS 59 | 60 | CASE "not running monitor" 61 | Include prepare 62 | AgentRun monitor OCF_NOT_RUNNING 63 | 64 | CASE "check lib file" 65 | Include prepare 66 | Bash chmod u-w /var/lib/mysql 67 | BashAtExit chmod u+w /var/lib/mysql 68 | AgentRun start OCF_ERR_PERM 69 | 70 | CASE "unimplemented command" 71 | Include prepare 72 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 73 | 74 | CASE "non-existent user" 75 | Include prepare 76 | Env OCF_RESKEY_user=no_user 77 | AgentRun start OCF_ERR_INSTALLED 78 | 79 | CASE "invalid user" 80 | Include prepare 81 | Env OCF_RESKEY_user=nobody 82 | AgentRun start OCF_ERR_PERM 83 | -------------------------------------------------------------------------------- /tools/ocft/mysql-proxy: -------------------------------------------------------------------------------- 1 | # mysql-proxy 2 | # by r.bhatia@ipax.at 3 | # 4 | # test cases (to implement): 5 | # 6 | # * /usr/sbin/ocf-tester -n mp -o binary="/usr/sbin/mysql-proxy" -o defaults_file="" -o parameters="--proxy-skip-profiling" \ 7 | # -o admin_address="127.0.0.1:4041" -o admin_username="root" -o admin_password="la" -o admin_lua_script="/usr/lib/mysql-proxy/lua/admin.lua" \ 8 | # -o proxy_backend_addresses="192.168.100.200:42006" -o proxy_address="/var/run/mysqld/mysqld.sock" /usr/lib/ocf/resource.d/heartbeat/mysql-proxy 9 | # 10 | # * OCF_CHECK_LEVEL 20 check 11 | 12 | CONFIG 13 | Agent mysql-proxy 14 | AgentRoot /usr/lib/ocf/resource.d/heartbeat/ 15 | InstallPackage mysql-proxy 16 | HangTimeout 20 17 | 18 | SETUP-AGENT 19 | # nothing 20 | 21 | CASE-BLOCK crm_setting 22 | Env OCF_RESKEY_CRM_meta_timeout=15000 23 | Env OCF_RESKEY_binary=/tmp/mysql-proxy 24 | Env OCF_RESKEY_admin_username=root 25 | Env OCF_RESKEY_admin_password=test123 26 | Env OCF_RESKEY_admin_lua_script=/usr/lib/mysql-proxy/lua/admin.lua 27 | 28 | CASE-BLOCK default_status 29 | AgentRun stop 30 | 31 | CASE-BLOCK prepare 32 | Bash [ ! -x /tmp/mysql-proxy ] && ln -s `which mysql-proxy` /tmp/mysql-proxy || true 33 | Include crm_setting 34 | 35 | CASE-BLOCK teardown 36 | AgentRun stop 37 | BashAtExit rm -f /tmp/mysql-proxy 38 | 39 | CASE "check base env" 40 | Include prepare 41 | AgentRun start OCF_SUCCESS 42 | Include teardown 43 | 44 | CASE "check base env: invalid 'OCF_RESKEY_binary'" 45 | Include prepare 46 | Env OCF_RESKEY_binary=no_such 47 | AgentRun start OCF_ERR_INSTALLED 48 | BashAtExit rm -f /tmp/mysql-proxy 49 | 50 | CASE "normal start" 51 | Include prepare 52 | AgentRun start OCF_SUCCESS 53 | Include teardown 54 | 55 | CASE "normal stop" 56 | Include prepare 57 | AgentRun start 58 | AgentRun stop OCF_SUCCESS 59 | Include teardown 60 | 61 | CASE "double start" 62 | Include prepare 63 | AgentRun start 64 | AgentRun start OCF_SUCCESS 65 | Include teardown 66 | 67 | CASE "double stop" 68 | Include prepare 69 | AgentRun stop OCF_SUCCESS 70 | 71 | CASE "running monitor" 72 | Include prepare 73 | AgentRun start 74 | AgentRun monitor OCF_SUCCESS 75 | Include teardown 76 | 77 | CASE "not running monitor" 78 | Include prepare 79 | AgentRun monitor OCF_NOT_RUNNING 80 | 81 | CASE "unimplemented command" 82 | Include prepare 83 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 84 | -------------------------------------------------------------------------------- /tools/ocft/named: -------------------------------------------------------------------------------- 1 | #named 2 | 3 | # To work properly this test requires that standard bind and bin-utils 4 | # packages installed. 5 | 6 | CONFIG 7 | Agent named 8 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 9 | InstallPackage bind 10 | InstallPackage bind-utils 11 | 12 | SETUP-AGENT 13 | /etc/init.d/named start 14 | /etc/init.d/named stop 15 | 16 | CASE-BLOCK crm_setting 17 | Env OCF_RESKEY_CRM_meta_timeout=15000 18 | 19 | CASE-BLOCK default_status 20 | AgentRun stop 21 | 22 | CASE-BLOCK prepare 23 | Include crm_setting 24 | Include default_status 25 | 26 | CASE "check base env" 27 | Include prepare 28 | AgentRun start OCF_SUCCESS 29 | 30 | CASE "check base env: invalid 'OCF_RESKEY_named'" 31 | Include prepare 32 | Env OCF_RESKEY_named=no_such 33 | AgentRun start OCF_ERR_INSTALLED 34 | 35 | CASE "normal start" 36 | Include prepare 37 | AgentRun start OCF_SUCCESS 38 | 39 | CASE "normal stop" 40 | Include prepare 41 | AgentRun start 42 | AgentRun stop OCF_SUCCESS 43 | 44 | CASE "double start" 45 | Include prepare 46 | AgentRun start 47 | AgentRun start OCF_SUCCESS 48 | 49 | CASE "double stop" 50 | Include prepare 51 | AgentRun stop OCF_SUCCESS 52 | 53 | CASE "running monitor" 54 | Include prepare 55 | AgentRun start 56 | AgentRun monitor OCF_SUCCESS 57 | 58 | CASE "not running monitor" 59 | Include prepare 60 | AgentRun monitor OCF_NOT_RUNNING 61 | 62 | CASE "unimplemented command" 63 | Include prepare 64 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 65 | 66 | CASE "non-existent user" 67 | Include prepare 68 | Env OCF_RESKEY_named_user=no_user 69 | AgentRun start OCF_ERR_INSTALLED 70 | -------------------------------------------------------------------------------- /tools/ocft/nfsserver: -------------------------------------------------------------------------------- 1 | # nfsserver 2 | 3 | CONFIG 4 | Agent nfsserver 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage nfs-kernel-server 7 | HangTimeout 20 8 | 9 | SETUP-AGENT 10 | INITSCRIPT="" 11 | if test -f /etc/init.d/nfsserver; then 12 | INITSCRIPT="/etc/init.d/nfsserver" 13 | fi 14 | true 15 | 16 | CASE-BLOCK required_args 17 | Env OCF_RESKEY_nfs_init_script=$INITSCRIPT 18 | 19 | CASE-BLOCK default_status 20 | AgentRun stop 21 | 22 | CASE-BLOCK prepare 23 | Include required_args 24 | Include default_status 25 | 26 | CASE "check base env" 27 | Include prepare 28 | AgentRun start OCF_SUCCESS 29 | 30 | CASE "check base env: invalid 'OCF_RESKEY_nfs_init_script'" 31 | Include prepare 32 | Env OCF_RESKEY_nfs_init_script=no_such_script 33 | AgentRun start OCF_ERR_INSTALLED 34 | 35 | CASE "check base env: invalid 'OCF_RESKEY_nfs_notify_cmd'" 36 | Include prepare 37 | Env OCF_RESKEY_nfs_notify_cmd=no_such_program 38 | AgentRun start OCF_ERR_INSTALLED 39 | 40 | CASE "normal start" 41 | Include prepare 42 | AgentRun start OCF_SUCCESS 43 | 44 | CASE "normal stop" 45 | Include prepare 46 | AgentRun start 47 | AgentRun stop OCF_SUCCESS 48 | 49 | CASE "double start" 50 | Include prepare 51 | AgentRun start 52 | AgentRun start OCF_SUCCESS 53 | 54 | CASE "double stop" 55 | Include prepare 56 | AgentRun stop OCF_SUCCESS 57 | 58 | CASE "monitor with running" 59 | Include prepare 60 | AgentRun start 61 | AgentRun monitor OCF_SUCCESS 62 | 63 | CASE "monitor with not running" 64 | Include prepare 65 | AgentRun monitor OCF_NOT_RUNNING 66 | 67 | CASE "unimplemented command" 68 | Include prepare 69 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 70 | -------------------------------------------------------------------------------- /tools/ocft/oracle: -------------------------------------------------------------------------------- 1 | # oracle 2 | # (based on db2) 3 | # 4 | # Created on an SLE11SP2 running oracle 11g 5 | # database sid is orcl 6 | # adapt this in set_testenv below 7 | # TODO: need oracle expert to break it, then test it 8 | # 9 | 10 | CONFIG 11 | Agent oracle 12 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 13 | HangTimeout 40 14 | 15 | SETUP-AGENT 16 | # nothing 17 | 18 | CASE-BLOCK set_testenv 19 | Env OCFT_sid=orcl 20 | 21 | CASE-BLOCK crm_setting 22 | Env OCF_RESKEY_sid=$OCFT_sid 23 | Env OCF_RESKEY_CRM_meta_timeout=30000 24 | 25 | CASE-BLOCK default_status 26 | AgentRun stop 27 | 28 | CASE-BLOCK prepare 29 | Include set_testenv 30 | Include crm_setting 31 | Include default_status 32 | 33 | CASE "check base env" 34 | Include prepare 35 | AgentRun start OCF_SUCCESS 36 | 37 | CASE "check base env: no 'OCF_RESKEY_sid'" 38 | Include prepare 39 | Env OCF_RESKEY_sid= 40 | AgentRun start OCF_ERR_CONFIGURED 41 | 42 | CASE "check base env: invalid 'OCF_RESKEY_home'" 43 | Include prepare 44 | Env OCF_RESKEY_home=/no_such 45 | AgentRun start OCF_ERR_INSTALLED 46 | 47 | CASE "unimplemented command" 48 | Include prepare 49 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 50 | 51 | CASE "normal start" 52 | Include prepare 53 | AgentRun start OCF_SUCCESS 54 | 55 | CASE "normal stop" 56 | Include prepare 57 | AgentRun start 58 | AgentRun stop OCF_SUCCESS 59 | 60 | CASE "double start" 61 | Include prepare 62 | AgentRun start 63 | AgentRun start OCF_SUCCESS 64 | 65 | CASE "double stop" 66 | Include prepare 67 | AgentRun stop OCF_SUCCESS 68 | 69 | CASE "started: monitor" 70 | Include prepare 71 | AgentRun start 72 | AgentRun monitor OCF_SUCCESS 73 | 74 | CASE "not started: monitor" 75 | Include prepare 76 | AgentRun monitor OCF_NOT_RUNNING 77 | 78 | CASE "try different ipcrm method" 79 | Include prepare 80 | Env OCF_RESKEY_ipcrm=none 81 | AgentRun start OCF_SUCCESS 82 | -------------------------------------------------------------------------------- /tools/ocft/pgsql: -------------------------------------------------------------------------------- 1 | # pgsql 2 | 3 | CONFIG 4 | Agent pgsql 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage postgresql-server 7 | HangTimeout 20 8 | 9 | SETUP-AGENT 10 | /etc/init.d/postgresql start 11 | /etc/init.d/postgresql stop 12 | 13 | CASE-BLOCK crm_setting 14 | Env OCF_RESKEY_CRM_meta_timeout=15000 15 | 16 | CASE-BLOCK default_status 17 | AgentRun stop 18 | 19 | CASE-BLOCK prepare 20 | Include crm_setting 21 | Include default_status 22 | 23 | CASE "check base env" 24 | Include prepare 25 | AgentRun start OCF_SUCCESS 26 | 27 | CASE "check base env: invalid 'OCF_RESKEY_pgctl'" 28 | Include prepare 29 | Env OCF_RESKEY_pgctl=no_such 30 | AgentRun start OCF_ERR_INSTALLED 31 | 32 | CASE "normal start" 33 | Include prepare 34 | AgentRun start OCF_SUCCESS 35 | 36 | CASE "normal stop" 37 | Include prepare 38 | AgentRun start 39 | AgentRun stop OCF_SUCCESS 40 | 41 | CASE "double start" 42 | Include prepare 43 | AgentRun start 44 | AgentRun start OCF_SUCCESS 45 | 46 | CASE "double stop" 47 | Include prepare 48 | AgentRun stop OCF_SUCCESS 49 | 50 | CASE "running monitor" 51 | Include prepare 52 | AgentRun start 53 | AgentRun monitor OCF_SUCCESS 54 | 55 | CASE "not running monitor" 56 | Include prepare 57 | AgentRun monitor OCF_NOT_RUNNING 58 | 59 | CASE "unimplemented command" 60 | Include prepare 61 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 62 | 63 | CASE "non-existent user" 64 | Include prepare 65 | Env OCF_RESKEY_pgdba=no_user 66 | AgentRun start OCF_ERR_INSTALLED 67 | 68 | CASE "invalid user" 69 | Include prepare 70 | Env OCF_RESKEY_pgdba=nobody 71 | AgentRun start OCF_ERR_PERM 72 | -------------------------------------------------------------------------------- /tools/ocft/portblock: -------------------------------------------------------------------------------- 1 | # portblock 2 | 3 | CONFIG 4 | Agent portblock 5 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 6 | InstallPackage iptables 7 | HangTimeout 15 8 | 9 | CASE-BLOCK required_args 10 | Env OCF_RESKEY_protocol=tcp 11 | Env OCF_RESKEY_portno=80 12 | Env OCF_RESKEY_action=block 13 | 14 | CASE-BLOCK default_status 15 | AgentRun stop 16 | 17 | CASE-BLOCK prepare 18 | Include required_args 19 | Include default_status 20 | 21 | CASE "check base env" 22 | Include prepare 23 | AgentRun start OCF_SUCCESS 24 | 25 | CASE "check base env: unset 'OCF_RESKEY_protocol'" 26 | Include prepare 27 | Unenv OCF_RESKEY_protocol 28 | AgentRun start OCF_ERR_CONFIGURED 29 | 30 | CASE "check base env: unset 'OCF_RESKEY_portno'" 31 | Include prepare 32 | Unenv OCF_RESKEY_portno 33 | AgentRun start OCF_ERR_CONFIGURED 34 | 35 | CASE "check base env: unset 'OCF_RESKEY_action'" 36 | Include prepare 37 | Unenv OCF_RESKEY_action 38 | AgentRun start OCF_ERR_CONFIGURED 39 | 40 | CASE "normal start" 41 | Include prepare 42 | AgentRun start OCF_SUCCESS 43 | 44 | CASE "normal stop" 45 | Include prepare 46 | AgentRun start 47 | AgentRun stop OCF_SUCCESS 48 | 49 | CASE "double start" 50 | Include prepare 51 | AgentRun start 52 | AgentRun start OCF_SUCCESS 53 | 54 | CASE "double stop" 55 | Include prepare 56 | AgentRun stop OCF_SUCCESS 57 | 58 | CASE "monitor with running" 59 | Include prepare 60 | AgentRun start 61 | AgentRun monitor OCF_SUCCESS 62 | 63 | CASE "monitor with not running" 64 | Include prepare 65 | AgentRun monitor OCF_NOT_RUNNING 66 | 67 | CASE "unimplemented command" 68 | Include prepare 69 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 70 | -------------------------------------------------------------------------------- /tools/ocft/postfix: -------------------------------------------------------------------------------- 1 | # postfix 2 | # by r.bhatia@ipax.at 3 | # 4 | # test cases (to implement): 5 | # 6 | # * /usr/sbin/ocf-tester -n post1 /usr/lib/ocf/resource.d/heartbeat/postfix; echo $? -> DONE 7 | # * /usr/sbin/ocf-tester -n post2 -o binary="/usr/sbin/postfix" \ 8 | # -o config_dir="" /usr/lib/ocf/resource.d/heartbeat/postfix; echo $? -> DONE 9 | # * /usr/sbin/ocf-tester -n post3 -o binary="/usr/sbin/postfix" \ 10 | # -o config_dir="/etc/postfix" /usr/lib/ocf/resource.d/heartbeat/postfix; echo $? -> DONE 11 | # * /usr/sbin/ocf-tester -n post4 -o binary="/usr/sbin/postfix" \ 12 | # -o config_dir="/root/postfix/" /usr/lib/ocf/resource.d/heartbeat/postfix; echo $? 13 | 14 | CONFIG 15 | Agent postfix 16 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 17 | InstallPackage postfix 18 | HangTimeout 20 19 | 20 | SETUP-AGENT 21 | # nothing 22 | 23 | CASE-BLOCK crm_setting 24 | Env OCF_RESKEY_CRM_meta_timeout=15000 25 | Env OCF_RESKEY_CRM_meta_interval=10000 26 | 27 | CASE-BLOCK default_status 28 | AgentRun stop 29 | 30 | CASE-BLOCK prepare 31 | Include crm_setting 32 | Include default_status 33 | 34 | CASE "check base env" 35 | Include prepare 36 | AgentRun start OCF_SUCCESS 37 | 38 | CASE "check base env: invalid 'OCF_RESKEY_binary'" 39 | Include prepare 40 | Env OCF_RESKEY_binary=no_such 41 | AgentRun start OCF_ERR_INSTALLED 42 | 43 | CASE "check base env: invalid 'OCF_RESKEY_config_dir'" 44 | Include prepare 45 | Env OCF_RESKEY_config_dir=no_such 46 | AgentRun start OCF_ERR_INSTALLED 47 | 48 | CASE "check base env: 'OCF_RESKEY_binary'" 49 | Include prepare 50 | Env OCF_RESKEY_binary=/usr/sbin/postfix 51 | AgentRun start 52 | AgentRun monitor OCF_SUCCESS 53 | 54 | CASE "check base env: 'OCF_RESKEY_config_dir' without trailing slash" 55 | Include prepare 56 | Env OCF_RESKEY_config_dir="/etc/postfix" 57 | AgentRun start 58 | AgentRun monitor OCF_SUCCESS 59 | 60 | CASE "check base env: 'OCF_RESKEY_config_dir' with trailing slash" 61 | Include prepare 62 | Env OCF_RESKEY_config_dir="/etc/postfix/" 63 | AgentRun start 64 | AgentRun monitor OCF_SUCCESS 65 | 66 | CASE "normal start" 67 | Include prepare 68 | AgentRun start OCF_SUCCESS 69 | 70 | CASE "normal stop" 71 | Include prepare 72 | AgentRun start 73 | AgentRun stop OCF_SUCCESS 74 | 75 | CASE "double start" 76 | Include prepare 77 | AgentRun start 78 | AgentRun start OCF_SUCCESS 79 | 80 | CASE "double stop" 81 | Include prepare 82 | AgentRun stop OCF_SUCCESS 83 | 84 | CASE "monitor a running resource" 85 | Include prepare 86 | AgentRun start 87 | AgentRun monitor OCF_SUCCESS 88 | 89 | CASE "(initial) probe a stopped resource" 90 | Include prepare 91 | Env OCF_RESKEY_CRM_meta_interval=0 92 | AgentRun monitor OCF_NOT_RUNNING 93 | 94 | CASE "(re-)probe a running resource" 95 | Include prepare 96 | Env OCF_RESKEY_CRM_meta_interval=0 97 | AgentRun start 98 | AgentRun monitor OCF_SUCCESS 99 | 100 | CASE "unimplemented command" 101 | Include prepare 102 | AgentRun no_cmd OCF_ERR_UNIMPLEMENTED 103 | -------------------------------------------------------------------------------- /tools/ocft/runocft: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | OCFTDIR=/usr/share/resource-agents/ocft 3 | CONFDIR=$OCFTDIR/configs 4 | 5 | prereq_run() { 6 | eval "$@" 7 | } 8 | prereq_prog() { 9 | which $@ 10 | } 11 | 12 | test_prereq() { 13 | local tp arg 14 | tp=`echo $prereq|sed 's/:.*//'` 15 | arg=`echo $prereq|sed 's/[a-z]*://'` 16 | prereq_$tp $arg >/dev/null 2>&1 17 | } 18 | 19 | rm -f ocft.FAILED 20 | rc=0 21 | while read f prereq; do 22 | if [ -n "$prereq" ] && ! test_prereq; then 23 | echo "$f: prerequisite not fulfilled, skipping" 24 | continue 25 | fi 26 | ocft make $f 27 | if ! ocft test $f; then 28 | echo $f >> ocft.FAILED 29 | rc=1 30 | fi 31 | done < $OCFTDIR/runocft.prereq 32 | 33 | if [ -f ocft.FAILED ]; then 34 | echo "The following ocft tests failed:" 35 | cat ocft.FAILED 36 | fi 37 | 38 | exit $rc 39 | -------------------------------------------------------------------------------- /tools/ocft/runocft.prereq: -------------------------------------------------------------------------------- 1 | apache 2 | db2 prog:~db2inst1/sqllib/bin/db2 3 | drbd.linbit run:false 4 | exportfs 5 | exportfs-multidir 6 | Filesystem 7 | IPaddr2 run:ip addr show dev eth0 8 | IPaddr2v4 run:ip addr show dev eth0 && ip addr show dev eth1 9 | IPaddr2v6 run:ip addr show dev eth0 && ip addr show dev eth1 10 | IPsrcaddr run:false 11 | IPv6addr run:ip addr show dev eth0 && ip addr show dev eth1 12 | iscsi 13 | jboss run:false 14 | LVM 15 | MailTo 16 | mysql 17 | mysql-proxy run:false 18 | named 19 | nfsserver 20 | oracle prog:sqlplus 21 | pgsql 22 | portblock 23 | postfix 24 | Raid1 25 | SendArp 26 | sg_persist run:false 27 | tomcat run:false 28 | VirtualDomain run:false 29 | Xen run:false 30 | Xinetd 31 | -------------------------------------------------------------------------------- /tools/ocft/tomcat: -------------------------------------------------------------------------------- 1 | # tomcat 2 | # 3 | # NOTE: Clean up $catalina_home/logs before running this test 4 | # otherwise creating the pid/log files may fail 5 | # in the test case with a different user. 6 | 7 | CONFIG 8 | Agent tomcat 9 | AgentRoot /usr/lib/ocf/resource.d/heartbeat 10 | HangTimeout 120 11 | 12 | VARIABLE 13 | # Adjust accrding to your configuration 14 | catalina_home=/opt/tomcat7 15 | tomcat_user=tomcat7 16 | java_home=/usr/lib/jvm/java-1.6.0-openjdk.x86_64 17 | 18 | CASE-BLOCK required_args_tomcat 19 | Env OCF_RESKEY_catalina_home=${catalina_home} 20 | Env OCF_RESKEY_tomcat_user=${tomcat_user} 21 | Env OCF_RESKEY_java_home=${java_home} 22 | 23 | CASE-BLOCK args_clear 24 | Unenv OCF_RESKEY_catalina_home 25 | Unenv OCF_RESKEY_tomcat_user 26 | Unenv OCF_RESKEY_java_home 27 | 28 | CASE-BLOCK default_status 29 | AgentRun stop 30 | 31 | CASE-BLOCK prepare_tomcat 32 | Include required_args_tomcat 33 | Include default_status 34 | 35 | # Test CASE 36 | # 37 | CASE "normal start tomcat require_args (user:user)" 38 | Include prepare_tomcat 39 | AgentRun start OCF_SUCCESS 40 | AgentRun monitor OCF_SUCCESS 41 | AgentRun stop OCF_SUCCESS 42 | AgentRun monitor OCF_NOT_RUNNING 43 | Include args_clear 44 | 45 | CASE "normal start tomcat require_args (user:root)" 46 | Include prepare_tomcat 47 | Unenv OCF_RESKEY_tomcat_user 48 | AgentRun start OCF_SUCCESS 49 | AgentRun monitor OCF_SUCCESS 50 | AgentRun stop OCF_SUCCESS 51 | AgentRun monitor OCF_NOT_RUNNING 52 | Include args_clear 53 | 54 | CASE "error start tomcat no catalina_home" 55 | Include prepare_tomcat 56 | Unenv OCF_RESKEY_catalina_home 57 | AgentRun start OCF_ERR_INSTALLED 58 | Include args_clear 59 | 60 | CASE "error start tomcat no java_home" 61 | Include prepare_tomcat 62 | Unenv OCF_RESKEY_java_home 63 | AgentRun start OCF_ERR_INSTALLED 64 | Include args_clear 65 | 66 | CASE "error start tomcat no java command" 67 | Include prepare_tomcat 68 | Env OCF_RESKEY_java_home=/var 69 | AgentRun start OCF_ERR_INSTALLED 70 | AgentRun stop OCF_SUCCESS 71 | AgentRun monitor OCF_NOT_RUNNING 72 | Include args_clear 73 | 74 | -------------------------------------------------------------------------------- /tools/sfex_init.8: -------------------------------------------------------------------------------- 1 | .TH SFEX_INIT "8" "May 2010" "sfex_init 1.0.3" "System Administration Utilities" 2 | .SH NAME 3 | sfex_init \- Part of the Linux-HA project 4 | .SH SYNOPSIS 5 | .B sfex_init 6 | [\fI-Lh\fR] \fR[\fI-n numlocks\fR]\fI device 7 | .SH DESCRIPTION 8 | Initialize Shared Disk File EXclusiveness Control Program (SF-EX) meta-data. 9 | .SH OPTIONS 10 | .TP 11 | \fB\-n\fR numlocks 12 | The number of storing lock data is specified by integer 13 | of one or more. When you want to control two or more resources by one 14 | meta-data, you set the value of two or more to numlocks. 15 | Default is 1. 16 | .TP 17 | \fBdevice\fR 18 | This is file path which stored meta-data. 19 | It is usually expressed in "/dev/...", because it is partition on the shared disk. 20 | -------------------------------------------------------------------------------- /tools/sfex_lib.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | * 3 | * Shared Disk File EXclusiveness Control Program(SF-EX) 4 | * 5 | * sfex_lib.h --- Prototypes for lib.c. 6 | * 7 | * Copyright (c) 2007 NIPPON TELEGRAPH AND TELEPHONE CORPORATION 8 | * 9 | * This program is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU General Public License 11 | * as published by the Free Software Foundation; either version 2 12 | * of the License, or (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301, USA. 23 | * 24 | * $Id$ 25 | * 26 | *-------------------------------------------------------------------------*/ 27 | 28 | #ifndef LIB_H 29 | #define LIB_H 30 | 31 | const char *get_progname(const char *argv0); 32 | char *get_nodename(void); 33 | void init_controldata(sfex_controldata *cdata, size_t blocksize, int numlocks); 34 | void init_lockdata(sfex_lockdata *ldata); 35 | void write_controldata(const sfex_controldata *cdata); 36 | int write_lockdata(const sfex_controldata *cdata, const sfex_lockdata *ldata, int index); 37 | int read_controldata(sfex_controldata *cdata); 38 | int read_lockdata(const sfex_controldata *cdata, sfex_lockdata *ldata, int index); 39 | int prepare_lock(const char *device); 40 | int lock_index_check(sfex_controldata * cdata, int index); 41 | 42 | #endif /* LIB_H */ 43 | --------------------------------------------------------------------------------