diff --git a/tools/ocft/Raid1 b/tools/ocft/Raid1 index e32e538ed..a8e50c5ac 100644 --- a/tools/ocft/Raid1 +++ b/tools/ocft/Raid1 @@ -1,93 +1,132 @@ # 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_disk0=/var/run/resource-agents/ocft-Raid1-disk0 OCFT_disk1=/var/run/resource-agents/ocft-Raid1-disk1 + OCFT_disk2=/var/run/resource-agents/ocft-Raid1-disk2 + OCFT_disk3=/var/run/resource-agents/ocft-Raid1-disk3 OCFT_raidconf=/var/run/resource-agents/ocft-mdadm.conf OCFT_raiddev=/dev/md8 + OCFT_raiddev2=/dev/md9 OCFT_loop0=/dev/loop6 OCFT_loop1=/dev/loop7 + OCFT_loop2=/dev/loop4 + OCFT_loop3=/dev/loop5 SETUP-AGENT losetup $OCFT_loop0 2>/dev/null && exit 1 losetup $OCFT_loop1 2>/dev/null && exit 1 + losetup $OCFT_loop2 2>/dev/null && exit 1 + losetup $OCFT_loop3 2>/dev/null && exit 1 dd if=/dev/zero of=$OCFT_disk0 bs=1 count=0 seek=16M 2>/dev/null dd if=/dev/zero of=$OCFT_disk1 bs=1 count=0 seek=16M 2>/dev/null + dd if=/dev/zero of=$OCFT_disk2 bs=1 count=0 seek=16M 2>/dev/null + dd if=/dev/zero of=$OCFT_disk3 bs=1 count=0 seek=16M 2>/dev/null losetup $OCFT_loop0 $OCFT_disk0 losetup $OCFT_loop1 $OCFT_disk1 + losetup $OCFT_loop2 $OCFT_disk2 + losetup $OCFT_loop3 $OCFT_disk3 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 losetup -d $OCFT_loop0 losetup -d $OCFT_loop1 + losetup -d $OCFT_loop2 + losetup -d $OCFT_loop3 rm $OCFT_disk0 $OCFT_disk1 $OCFT_raidconf + rm $OCFT_disk2 $OCFT_disk3 CASE-BLOCK required_args Env OCF_RESKEY_raidconf=$OCFT_raidconf Env OCF_RESKEY_raiddev=$OCFT_raiddev +CASE-BLOCK auto_args + Env OCF_RESKEY_raidconf=$OCFT_raidconf + Env OCF_RESKEY_raiddev=auto + CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include required_args Include default_status +CASE-BLOCK prepare_auto + Include auto_args + 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 "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED