diff --git a/tools/ocft/Filesystem b/tools/ocft/Filesystem index 75203d73a..0b4d7813f 100644 --- a/tools/ocft/Filesystem +++ b/tools/ocft/Filesystem @@ -1,110 +1,113 @@ # Filesystem # by dejan@suse.de on # Tue Feb 15 18:50:04 CET 2011 +# +# NB: Replace /var/run below with /run if your system mounts /run +# as tmpfs! CONFIG Agent Filesystem AgentRoot /usr/lib/ocf/resource.d/heartbeat HangTimeout 20 VARIABLE OCFT_fs=/var/run/resource-agents/ocft-Filesystem-fs OCFT_loop=/dev/loop7 OCFT_dir=/var/run/resource-agents/ocft-Filesystem-mnt SETUP-AGENT losetup $OCFT_loop 2>/dev/null && exit 1 rmdir $OCFT_dir 2>/dev/null || true mkdir $OCFT_dir dd if=/dev/zero of=$OCFT_fs bs=1 count=0 seek=16M 2>/dev/null mke2fs -j -Fq -m 0 $OCFT_fs losetup $OCFT_loop $OCFT_fs CLEANUP-AGENT rmdir $OCFT_dir rm $OCFT_fs losetup -d $OCFT_loop CASE-BLOCK required_args Env OCF_RESKEY_device=$OCFT_loop Env OCF_RESKEY_fstype=ext3 Env OCF_RESKEY_directory=$OCFT_dir CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include required_args Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: invalid 'OCF_RESKEY_device'" Include prepare Env OCF_RESKEY_device=/dev/no_such_device AgentRun start OCF_ERR_INSTALLED CASE "check base env: unset 'OCF_RESKEY_device'" Include prepare Unenv OCF_RESKEY_device AgentRun start OCF_ERR_CONFIGURED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "monitor when running" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "monitor when not running" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "monitor depth 10 when running" Include prepare AgentRun start Env OCF_CHECK_LEVEL=10 AgentRun monitor OCF_SUCCESS CASE "monitor depth 20 with running" Include prepare AgentRun start Env OCF_CHECK_LEVEL=20 AgentRun monitor OCF_SUCCESS CASE "start insert failure (remove device)" Include prepare Bash losetup -d $OCFT_loop BashAtExit losetup $OCFT_loop $OCFT_fs AgentRun start OCF_ERR_GENERIC CASE "monitor depth 20 insert failure (r/o fs)" Include prepare AgentRun start Bash mount -o remount,ro $OCFT_dir BashAtExit mount -o remount,rw $OCFT_dir Env OCF_CHECK_LEVEL=20 AgentRun monitor OCF_ERR_GENERIC CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED diff --git a/tools/ocft/apache b/tools/ocft/apache index e93904471..b2219ec26 100644 --- a/tools/ocft/apache +++ b/tools/ocft/apache @@ -1,63 +1,63 @@ # apache # make sure that your apache configuration loads mod_status CONFIG Agent apache AgentRoot /usr/lib/ocf/resource.d/heartbeat InstallPackage apache2 HangTimeout 20 SETUP-AGENT - /etc/init.d/apache2 start - /etc/init.d/apache2 stop + rcapache2 start + rcapache2 stop CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: set non-existing OCF_RESKEY_statusurl" Include prepare Env OCF_RESKEY_statusurl="yoyoyoyo" AgentRun start OCF_ERR_GENERIC CASE "check base env: set non-existing OCF_RESKEY_configfile" Include prepare Env OCF_RESKEY_configfile="/yoyoyoyo/nosuchfile" AgentRun start OCF_ERR_INSTALLED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "running monitor" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "not running monitor" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED diff --git a/tools/ocft/iscsi b/tools/ocft/iscsi index c1325a1c6..7b0452a6c 100644 --- a/tools/ocft/iscsi +++ b/tools/ocft/iscsi @@ -1,82 +1,82 @@ # iscsi CONFIG Agent iscsi AgentRoot /usr/lib/ocf/resource.d/heartbeat InstallPackage open-iscsi InstallPackage iscsitarget HangTimeout 20 VARIABLE OCFT_disk=/var/run/resource-agents/ocft-iscsi OCFT_target="iqn.2011-03.ocft.localhost:disk0" OCFT_portal="127.0.0.1:3260" SETUP-AGENT dd if=/dev/zero of=$OCFT_disk bs=1024k count=1 2>/dev/null echo Target $OCFT_target >> /etc/ietd.conf echo " Lun 0 Path=$OCFT_disk,Type=fileio" >> /etc/ietd.conf - /etc/init.d/iscsitarget start - /etc/init.d/open-iscsi start - /etc/init.d/iscsitarget restart + rciscsitarget start + rcopen-iscsi start + rciscsitarget restart CLEANUP-AGENT rm -f $OCFT_disk sed -i "/^Target $OCFT_target/,+1d" /etc/ietd.conf CASE-BLOCK required_args Env OCF_RESKEY_portal=$OCFT_portal Env OCF_RESKEY_target=$OCFT_target CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include required_args Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: invalid 'OCF_RESKEY_portal'" Include prepare Unenv OCF_RESKEY_portal AgentRun start OCF_ERR_CONFIGURED CASE "check base env: unset 'OCF_RESKEY_target'" Include prepare Unenv OCF_RESKEY_target AgentRun start OCF_ERR_CONFIGURED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "monitor when running" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "monitor when not running" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED diff --git a/tools/ocft/mysql b/tools/ocft/mysql index 27fcb587a..bae0dc723 100644 --- a/tools/ocft/mysql +++ b/tools/ocft/mysql @@ -1,77 +1,77 @@ # mysql CONFIG Agent mysql AgentRoot /usr/lib/ocf/resource.d/heartbeat InstallPackage mysql HangTimeout 20 SETUP-AGENT - /etc/init.d/mysql start - /etc/init.d/mysql stop + rcmysql start + rcmysql stop CASE-BLOCK crm_setting Env OCF_RESKEY_CRM_meta_timeout=15000 CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include crm_setting Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: invalid 'OCF_RESKEY_binary'" Include prepare Env OCF_RESKEY_binary=no_such AgentRun start OCF_ERR_INSTALLED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "running monitor" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "not running monitor" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "check lib file" Include prepare Bash chmod u-w /var/lib/mysql BashAtExit chmod u+w /var/lib/mysql AgentRun start OCF_ERR_PERM CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED CASE "non-existent user" Include prepare Env OCF_RESKEY_user=no_user AgentRun start OCF_ERR_INSTALLED CASE "invalid user" Include prepare Env OCF_RESKEY_user=nobody AgentRun start OCF_ERR_PERM diff --git a/tools/ocft/named b/tools/ocft/named index 90a4351bc..15024a8bb 100644 --- a/tools/ocft/named +++ b/tools/ocft/named @@ -1,69 +1,69 @@ #named # To work properly this test requires that standard bind and bin-utils # packages installed. CONFIG Agent named AgentRoot /usr/lib/ocf/resource.d/heartbeat InstallPackage bind InstallPackage bind-utils SETUP-AGENT - /etc/init.d/named start - /etc/init.d/named stop + rcnamed start + rcnamed stop CASE-BLOCK crm_setting Env OCF_RESKEY_CRM_meta_timeout=15000 CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include crm_setting Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: invalid 'OCF_RESKEY_named'" Include prepare Env OCF_RESKEY_named=no_such AgentRun start OCF_ERR_INSTALLED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "running monitor" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "not running monitor" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED CASE "non-existent user" Include prepare Env OCF_RESKEY_named_user=no_user AgentRun start OCF_ERR_INSTALLED diff --git a/tools/ocft/pgsql b/tools/ocft/pgsql index 9944b09e4..abab33fe0 100644 --- a/tools/ocft/pgsql +++ b/tools/ocft/pgsql @@ -1,71 +1,71 @@ # pgsql CONFIG Agent pgsql AgentRoot /usr/lib/ocf/resource.d/heartbeat InstallPackage postgresql-server HangTimeout 20 SETUP-AGENT - /etc/init.d/postgresql start - /etc/init.d/postgresql stop + rcpostgresql start + rcpostgresql stop CASE-BLOCK crm_setting Env OCF_RESKEY_CRM_meta_timeout=15000 CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include crm_setting Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: invalid 'OCF_RESKEY_pgctl'" Include prepare Env OCF_RESKEY_pgctl=no_such AgentRun start OCF_ERR_INSTALLED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "running monitor" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "not running monitor" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED CASE "non-existent user" Include prepare Env OCF_RESKEY_pgdba=no_user AgentRun start OCF_ERR_INSTALLED CASE "invalid user" Include prepare Env OCF_RESKEY_pgdba=nobody AgentRun start OCF_ERR_PERM