summaryrefslogtreecommitdiffstats
path: root/tools/ocft/Raid1
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tools/ocft/Raid1134
1 files changed, 134 insertions, 0 deletions
diff --git a/tools/ocft/Raid1 b/tools/ocft/Raid1
new file mode 100644
index 0000000..462b9b9
--- /dev/null
+++ b/tools/ocft/Raid1
@@ -0,0 +1,134 @@
+# Raid1
+# by dejan@suse.de on
+# Fri Aug 24 17:01:40 CEST 2012
+
+CONFIG
+ Agent Raid1
+ AgentRoot /usr/lib/ocf/resource.d/heartbeat
+ InstallPackage mdadm
+ HangTimeout 20
+
+VARIABLE
+ OCFT_rundir="`get_rundir`"
+ OCFT_disk0=$OCFT_rundir/resource-agents/ocft-Raid1-disk0
+ OCFT_disk1=$OCFT_rundir/resource-agents/ocft-Raid1-disk1
+ OCFT_disk2=$OCFT_rundir/resource-agents/ocft-Raid1-disk2
+ OCFT_disk3=$OCFT_rundir/resource-agents/ocft-Raid1-disk3
+ OCFT_raidconf=$OCFT_rundir/resource-agents/ocft-mdadm.conf
+ OCFT_raiddev=/dev/md8
+ OCFT_raiddev2=/dev/md9
+ OCFT_loop0="`loopbackeddev make $OCFT_disk0 16M`"
+ OCFT_loop1="`loopbackeddev make $OCFT_disk1 16M`"
+ OCFT_loop2="`loopbackeddev make $OCFT_disk2 16M`"
+ OCFT_loop3="`loopbackeddev make $OCFT_disk3 16M`"
+
+SETUP-AGENT
+ mdadm --create $OCFT_raiddev -l 0 --raid-devices=2 $OCFT_loop0 $OCFT_loop1
+ mdadm --create $OCFT_raiddev2 -l 0 --raid-devices=2 $OCFT_loop2 $OCFT_loop3
+ echo DEVICE $OCFT_loop0 $OCFT_loop1 > $OCFT_raidconf
+ echo DEVICE $OCFT_loop2 $OCFT_loop3 >> $OCFT_raidconf
+ echo ARRAY $OCFT_raiddev devices=$OCFT_loop0,$OCFT_loop1 >> $OCFT_raidconf
+ echo ARRAY $OCFT_raiddev2 devices=$OCFT_loop2,$OCFT_loop3 >> $OCFT_raidconf
+
+CLEANUP-AGENT
+ mdadm --zero-superblock $OCFT_loop0
+ mdadm --zero-superblock $OCFT_loop1
+ mdadm --zero-superblock $OCFT_loop2
+ mdadm --zero-superblock $OCFT_loop3
+ mdadm --remove $OCFT_raiddev 2>/dev/null
+ mdadm --remove $OCFT_raiddev2 2>/dev/null
+ loopbackeddev unmake $OCFT_disk0
+ loopbackeddev unmake $OCFT_disk1
+ loopbackeddev unmake $OCFT_disk2
+ loopbackeddev unmake $OCFT_disk3
+ rm -f $OCFT_raidconf
+
+CASE-BLOCK required_args
+ Env OCF_RESKEY_raidconf=$OCFT_raidconf
+ Env OCF_RESKEY_raiddev=$OCFT_raiddev
+
+CASE-BLOCK default_status
+ AgentRun stop
+
+CASE-BLOCK prepare
+ Include required_args
+ Include default_status
+
+CASE-BLOCK prepare_auto
+ Include required_args
+ Env OCF_RESKEY_raiddev="auto"
+ Include default_status
+
+CASE-BLOCK prepare_multiple
+ Include required_args
+ Env OCF_RESKEY_raiddev="$OCFT_raiddev $OCFT_raiddev2"
+ Include default_status
+
+CASE "check base env"
+ Include prepare
+ AgentRun start OCF_SUCCESS
+
+CASE "check base env: invalid 'OCF_RESKEY_raiddev'"
+ Include prepare
+ Env OCF_RESKEY_raiddev=/dev/no_such_device
+ AgentRun start OCF_ERR_GENERIC
+
+CASE "check base env: unset 'OCF_RESKEY_raiddev'"
+ Include prepare
+ Unenv OCF_RESKEY_raiddev
+ 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 "normal start (auto)"
+ Include prepare_auto
+ AgentRun start OCF_SUCCESS
+ AgentRun monitor OCF_SUCCESS
+
+CASE "normal stop (auto)"
+ Include prepare_auto
+ AgentRun start
+ AgentRun stop OCF_SUCCESS
+ AgentRun monitor OCF_NOT_RUNNING
+
+CASE "normal start (multiple)"
+ Include prepare
+ AgentRun start OCF_SUCCESS
+ AgentRun monitor OCF_SUCCESS
+
+CASE "normal stop (multiple)"
+ Include prepare
+ Env OCF_RESKEY_raiddev="$OCFT_raiddev $OCFT_raiddev2"
+ AgentRun start
+ AgentRun stop OCF_SUCCESS
+ AgentRun monitor OCF_NOT_RUNNING
+
+CASE "unimplemented command"
+ Include prepare
+ AgentRun no_cmd OCF_ERR_UNIMPLEMENTED
+