Re: [Linux-ha-dev] New ocft config file for IBM db2 resource agent

2011-02-15 Thread Tim Serong
On 2/15/2011 at 10:33 PM, Holger Teutsch  wrote: 
> > As a project, we may want to look into automating this step somehow too; 
> > I'm thinking that we could investigate using something like SUSE Studio 
> > (yeah, I know, I'm biased ;-) or something for easily creating and 
> > providing test environments ...? Anyone got comments on this? 
> >  
>  
> I can work on this, I assume shell/python will do. I'm afraid the 
> download has to be manual as you need to register... 

Once someone creates an appliance with SUSE Studio, the download
link works regardless of whether you're logged in or not.  Hopefully
this is not a hole anyone is planning to plug.

Regards,

Tim


-- 
Tim Serong 
Senior Clustering Engineer, OPS Engineering, Novell Inc.



___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


[Linux-ha-dev] [PATCH] doc/Clusters_from_Scratch - fix minor formating and convention issues

2011-02-15 Thread Michael Prokop
Hi,

attached patches address minor formating and convention issues.

regards,
-mika-
-- 
http://michael-prokop.at/  || http://adminzen.org/
http://grml-solutions.com/ || http://grml.org/
From 7989f0ba9bfe2bc28cd7556e559d059d5e9398b3 Mon Sep 17 00:00:00 2001
From: Michael Prokop 
Date: Thu, 10 Feb 2011 11:36:40 +0100
Subject: [PATCH 1/3] Ch-Stonith.xml: drop duplicated 'stonith -t external/ibmrsa -n command'

---
 Ch-Stonith.xml |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/Ch-Stonith.xml b/Ch-Stonith.xml
index 5b88f4c..eb8d76f 100644
--- a/Ch-Stonith.xml
+++ b/Ch-Stonith.xml
@@ -78,7 +78,6 @@
 			
 			
 
-stonith -t external/ibmrsa -n
 [root@pcmk-1 ~]# stonith -t external/ibmrsa -n
 hostname  ipaddr  userid  passwd  type
 
-- 
1.7.2.3

From f6bee2f4aedcd19de94536ef74ff8ff23ebdfb00 Mon Sep 17 00:00:00 2001
From: Michael Prokop 
Date: Thu, 10 Feb 2011 11:37:35 +0100
Subject: [PATCH 2/3] Ch-Active-Passive.xml: format crm configure cmd as userinput

---
 Ch-Active-Passive.xml |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Ch-Active-Passive.xml b/Ch-Active-Passive.xml
index 9f508bc..e278624 100644
--- a/Ch-Active-Passive.xml
+++ b/Ch-Active-Passive.xml
@@ -335,7 +335,7 @@ ClusterIP        (ocf::heartbeat:IPaddr):        Started pcmk-
 			
 			
 
-crm configure rsc_defaults resource-stickiness=100
+[root@pcmk-2 ~]# crm configure rsc_defaults resource-stickiness=100
 [root@pcmk-2 ~]# crm configure show
 node pcmk-1
 node pcmk-2
-- 
1.7.2.3

From b4dc2615812f2cd8cbf9691331a131ecd9f663f8 Mon Sep 17 00:00:00 2001
From: Michael Prokop 
Date: Thu, 10 Feb 2011 11:38:18 +0100
Subject: [PATCH 3/3] Ch-Active-Active.xml: drop /dev/vdb and use /dev/drbd1 consequently instead

---
 Ch-Active-Active.xml |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Ch-Active-Active.xml b/Ch-Active-Active.xml
index f655447..329cfd7 100644
--- a/Ch-Active-Active.xml
+++ b/Ch-Active-Active.xml
@@ -369,14 +369,13 @@ Clone Set: gfs-clone
 			
 			
 
-mkfs.gfs2 -p lock_dlm -j 2 -t pcmk:web /dev/drbd1
-[root@pcmk-1 ~]# mkfs.gfs2 -t pcmk:web -p lock_dlm -j 2 /dev/vdb 
-This will destroy any data on /dev/vdb.
+[root@pcmk-1 ~]# mkfs.gfs2 -p lock_dlm -j 2 -t pcmk:web /dev/drbd1
+This will destroy any data on /dev/drbd1.
 It appears to contain: data
 
 Are you sure you want to proceed? [y/n] y
 
-Device:                    /dev/vdb
+Device:                    /dev/drbd1
 Blocksize:                 4096
 Device Size                1.00 GB (131072 blocks)
 Filesystem Size:           1.00 GB (131070 blocks)
-- 
1.7.2.3



signature.asc
Description: Digital signature
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


[Linux-ha-dev] [PATCH] ocf-tester: redirect error messages to stderr

2011-02-15 Thread Michael Prokop
Hi,

agent's ocf-tester doesn't redirect error messages to stderr.
The attached patch addresses this issue.

regards,
-mika-
-- 
http://michael-prokop.at/  || http://adminzen.org/
http://grml-solutions.com/ || http://grml.org/
# HG changeset patch
# User Michael Prokop
# Date 1297775920 -3600
# Node ID a86054c616c67bdc36c86151a85587f114848951
# Parent  17f68c9e93cb76a411c8bc0da8917596cee95a55
ocf-tester: redirect error messages to stderr

The --help option isn't handled in the command line parsing and
therefore doesn't have the same option handling as the -h option.
As a result do not mention the --help option in the usage information.

diff -r 17f68c9e93cb -r a86054c616c6 tools/ocf-tester.in
--- a/tools/ocf-tester.in	Mon Feb 14 11:46:18 2011 +0100
+++ b/tools/ocf-tester.in	Tue Feb 15 14:18:40 2011 +0100
@@ -37,15 +37,22 @@
 num_errors=0
 
 usage() {
-echo "Tool for testing if a cluster resource is OCF compliant"
-echo ""
-echo "Usage: ocf-tester [-Lh] -n resource_name [-o name=value]* /full/path/to/resource/agent"
-echo ""
-echo "Options:"
-echo "  -h,--help		This text"
-echo "  -n name		Name of the resource"	
-echo "  -o name=value		Name and value of any parameters required by the agent"
-echo "  -L			Use lrmadmin/lrmd for tests"
+# make sure to output errors on stderr
+if [ $1 -ne 0 ] ; then
+usage_echo() { echo "$@" >&2 ; }
+else
+usage_echo() { echo "$@" ; }
+fi
+
+usage_echo "Tool for testing if a cluster resource is OCF compliant"
+usage_echo ""
+usage_echo "Usage: ocf-tester [-Lh] -n resource_name [-o name=value]* /full/path/to/resource/agent"
+usage_echo ""
+usage_echo "Options:"
+usage_echo "  -h   		This text"
+usage_echo "  -n name		Name of the resource"	
+usage_echo "  -o name=value		Name and value of any parameters required by the agent"
+usage_echo "  -L			Use lrmadmin/lrmd for tests"
 exit $1
 }
 
@@ -87,7 +94,7 @@
 	-v) verbose=1; shift;;
 	-?|--help) usage 0;;
 	--version) echo "@PACKAGE_VERSION@"; exit 0;;
-	-*) echo "unknown option: $1"; usage 1;;
+	-*) echo "unknown option: $1" >&2; usage 1;;
 	*) done=1;;
 esac
 done
@@ -96,19 +103,19 @@
 if [ -d /usr/lib/ocf ]; then
 	export OCF_ROOT=/usr/lib/ocf
 else
-	echo "You must supply the location of OCF_ROOT (common location is /usr/lib/ocf)"
+	echo "You must supply the location of OCF_ROOT (common location is /usr/lib/ocf)" >&2
 	usage 1
 fi
 fi
 
 if [ "x" = "x$OCF_RESOURCE_INSTANCE" ]; then
-echo "You must give your resource a name, set OCF_RESOURCE_INSTANCE"
+echo "You must give your resource a name, set OCF_RESOURCE_INSTANCE" >&2
 usage 1
 fi
 
 agent=$1
 if [ ! -e $agent ]; then
-echo "You must provide the full path to your resource agent"
+echo "You must provide the full path to your resource agent" >&2
 usage 1
 fi
 stopped_rc=7
@@ -169,14 +176,14 @@
 if [ "$use_lrmd" = 1 ]; then
 	echo "Using lrmd/lrmadmin for all tests"
 	start_lrmd || {
-		echo "could not start lrmd"
+		echo "could not start lrmd" >&2
 		exit 1
 	}
 	trap '
 		[ "$lrmd_started" = 1 ] && $LRMD -k
 	' EXIT
 	add_resource || {
-		echo "failed to add resource to lrmd"
+		echo "failed to add resource to lrmd" >&2
 		exit 1
 	}
 fi
@@ -396,7 +403,7 @@
 fi
 
 if [ $num_errors -gt 0 ]; then
-echo Tests failed: $agent failed $num_errors tests
+echo "Tests failed: $agent failed $num_errors tests" >&2
 exit 1
 else 
 echo $agent passed all tests


signature.asc
Description: Digital signature
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


[Linux-ha-dev] [PATCH] Use ${OCF_ROOT} instead of hardcoding /usr/lib/ocf

2011-02-15 Thread Michael Prokop
Hi,

attached patches address the consequent usage of ${OCF_ROOT} and
@OCF_ROOT_DIR@ in glue's hb_report/hb_report.in and
lrm/test/regression.sh.in to avoid hardcoding /usr/lib/ocf/.

regards,
-mika-
-- 
http://michael-prokop.at/  || http://adminzen.org/
http://grml-solutions.com/ || http://grml.org/
# HG changeset patch
# User Michael Prokop
# Date 1297809449 -3600
# Node ID 371f210a682f36cb373fa4dffbee5f403f6995a5
# Parent  3e3d209f9217f8e517ed1ab8bb2fdd576cc864be
Use ${OCF_ROOT} instead of hardcoding /usr/lib/ocf

diff -r 3e3d209f9217 -r 371f210a682f lrm/test/regression.sh.in
--- a/lrm/test/regression.sh.in	Mon Jan 31 10:15:04 2011 +0100
+++ b/lrm/test/regression.sh.in	Tue Feb 15 23:37:29 2011 +0100
@@ -93,7 +93,7 @@
 export HA_logfile HA_debugfile HA_use_logd HA_logfacility
 
 mkdir -p $OUTDIR
-. /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs
+. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
 
 args=`getopt hq $*`
 [ $? -ne 0 ] && usage
# HG changeset patch
# User Michael Prokop
# Date 1297809486 -3600
# Node ID e51235c51d094122ee3fa6055147bcc8cd301791
# Parent  371f210a682f36cb373fa4dffbee5f403f6995a5
Use @OCF_ROOT_DIR@ instead of hardcoding /usr/lib/ocf

diff -r 371f210a682f -r e51235c51d09 hb_report/hb_report.in
--- a/hb_report/hb_report.in	Tue Feb 15 23:37:29 2011 +0100
+++ b/hb_report/hb_report.in	Tue Feb 15 23:38:06 2011 +0100
@@ -577,7 +577,7 @@
 sys_info() {
 	cluster_info
 	hb_report -V # our info
-	echo "resource-agents: `grep 'Build version:' /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs`"
+	echo "resource-agents: `grep 'Build version:' @OCF_ROOT_DIR@/resource.d/heartbeat/.ocf-shellfuncs`"
 	crm_info
 	pkg_ver $PACKAGES
 	echo "Platform: `uname`"


signature.asc
Description: Digital signature
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] [patch] Filesystem RA: Do not throw error when cman is used.

2011-02-15 Thread Dejan Muhamedagic
Hi,

On Mon, Feb 14, 2011 at 01:50:43PM -0500, Andres Rodriguez wrote:
> While trying to setup a OCFS2 cluster using pacemaker+corosync+cman, we
> found that the RA was unable to mount the FS because it didn't detect the
> "cluster type", in this case cman.
> 
> The attached patch provided by Andrew Beekhof fixes the issue.

Thanks for the patch. Applied.

Cheers,

Dejan

> diff -r 71b1377f907c heartbeat/Filesystem
> --- a/heartbeat/Filesystem Wed Oct 06 17:29:35 2010 +0200
> +++ b/heartbeat/Filesystem Mon Feb 14 16:42:25 2011 +0100
> @@ -307,7 +307,9 @@ ocfs2_init()
>   # not need this:
> 
>   OCFS2_SLES10=""
> - if [ "X$HA_cluster_type" != "Xopenais" ]; then
> + if [ "X$HA_cluster_type" = "Xcman" ]; then
> +return
> + elif [ "X$HA_cluster_type" != "Xopenais" ]; then
>   if grep -q "SUSE Linux Enterprise Server 10" /etc/SuSE-release >/dev/null
> 2>&1 ; then
>   OCFS2_SLES10="yes"
>   ocf_log info "$DEVICE: Enabling SLES10 compatibility mode for OCFS2."
> 
> -- 
> Andres Rodriguez (RoAkSoAx)
> Ubuntu MOTU Developer
> Systems Engineer

> diff -r 71b1377f907c heartbeat/Filesystem
> --- a/heartbeat/FilesystemWed Oct 06 17:29:35 2010 +0200
> +++ b/heartbeat/FilesystemMon Feb 14 16:42:25 2011 +0100
> @@ -307,7 +307,9 @@ ocfs2_init()
>   # not need this:
>  
>   OCFS2_SLES10=""
> - if [ "X$HA_cluster_type" != "Xopenais" ]; then
> + if [ "X$HA_cluster_type" = "Xcman" ]; then
> + return
> + elif [ "X$HA_cluster_type" != "Xopenais" ]; then
>   if grep -q "SUSE Linux Enterprise Server 10" /etc/SuSE-release 
> >/dev/null 2>&1 ; then
>   OCFS2_SLES10="yes"
>   ocf_log info "$DEVICE: Enabling SLES10 compatibility 
> mode for OCFS2."

> ___
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] New ocft config file for IBM db2 resource agent

2011-02-15 Thread Holger Teutsch
On Tue, 2011-02-15 at 11:22 +0100, Lars Marowsky-Bree wrote:
> On 2011-02-15T09:49:07, Holger Teutsch  wrote:
> 
> > Hi,
> > please find enclosed an ocft config for db2 for review and inclusion
> > into the project if appropriate.
> > 
> > The current 1.0.4 agent passes the tests 8-) .
> 
> Excellent! Thank you very much for this contribution!
> 
> I do owe you lunch now, don't I ;-)
> 
> 
> > # A virtual machine with 1200MB RAM is sufficient
> > #
> > # - download an eval version of DB2 server from IBM
> > # - create an user "db2inst1" in group "db2inst1"
> > #
> > # As root
> > # - install DB2 software in some location
> > # - create instance
> > #   cd /instance
> > #   ./db2icrt -s ese -u db2inst1 db2inst1
> > # - adapt profile of db2inst1 as instructed by db2icrt
> 
> As a project, we may want to look into automating this step somehow too;
> I'm thinking that we could investigate using something like SUSE Studio
> (yeah, I know, I'm biased ;-) or something for easily creating and
> providing test environments ...? Anyone got comments on this?
> 
> 

I can work on this, I assume shell/python will do. I'm afraid the
download has to be manual as you need to register...

> Regards,
> Lars
> 


___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] New ocft config file for IBM db2 resource agent

2011-02-15 Thread Holger Teutsch
On Tue, 2011-02-15 at 10:58 +0100, Andrew Beekhof wrote:
> On Tue, Feb 15, 2011 at 10:50 AM, Dejan Muhamedagic  
> wrote:
> > Hi Holger,
> >
> > On Tue, Feb 15, 2011 at 09:49:07AM +0100, Holger Teutsch wrote:
> >> Hi,
> >> please find enclosed an ocft config for db2 for review and inclusion
> >> into the project if appropriate.
> >
> > Wonderful! This is the first time somebody contributed an ocft
> > testcase.
> 
> Looks like lmb owes somebody lunch :-)

Hopefully he extends his invitation to some quoting guru who is able to
rewrite the bash commands below without using a temporary file...

> 
> >> CASE "killed instance: monitor"
> >> Include prepare
> >> AgentRun start OCF_SUCCESS
> >> AgentRun monitor OCF_SUCCESS
> >> BashAtExit rm /tmp/ocft-helper1
> >> Bash echo "su $OCFT_instance -c '. 
> >> ~$OCFT_instance/sqllib/db2profile; db2nkill 0 >/dev/null 2>&1'" > 
> >> /tmp/ocft-helper1
> >> Bash sh -x /tmp/ocft-helper1


___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] New ocft config file for IBM db2 resource agent

2011-02-15 Thread Lars Marowsky-Bree
On 2011-02-15T09:49:07, Holger Teutsch  wrote:

> Hi,
> please find enclosed an ocft config for db2 for review and inclusion
> into the project if appropriate.
> 
> The current 1.0.4 agent passes the tests 8-) .

Excellent! Thank you very much for this contribution!

I do owe you lunch now, don't I ;-)


> # A virtual machine with 1200MB RAM is sufficient
> #
> # - download an eval version of DB2 server from IBM
> # - create an user "db2inst1" in group "db2inst1"
> #
> # As root
> # - install DB2 software in some location
> # - create instance
> #   cd /instance
> #   ./db2icrt -s ese -u db2inst1 db2inst1
> # - adapt profile of db2inst1 as instructed by db2icrt

As a project, we may want to look into automating this step somehow too;
I'm thinking that we could investigate using something like SUSE Studio
(yeah, I know, I'm biased ;-) or something for easily creating and
providing test environments ...? Anyone got comments on this?


Regards,
Lars

-- 
Architect Storage/HA, OPS Engineering, Novell, Inc.
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde

___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] New ocft config file for IBM db2 resource agent

2011-02-15 Thread Andrew Beekhof
On Tue, Feb 15, 2011 at 10:50 AM, Dejan Muhamedagic  wrote:
> Hi Holger,
>
> On Tue, Feb 15, 2011 at 09:49:07AM +0100, Holger Teutsch wrote:
>> Hi,
>> please find enclosed an ocft config for db2 for review and inclusion
>> into the project if appropriate.
>
> Wonderful! This is the first time somebody contributed an ocft
> testcase.

Looks like lmb owes somebody lunch :-)

>> The current 1.0.4 agent passes the tests 8-) .
>
> I've never doubted that either.
>
> Cheers,
>
> Dejan
>
>>
>> Regards
>> Holger
>>
>>
>>
>
>> # db2
>> #
>> # This test assumes a db2 ESE instance with two partions and a database.
>> # Default is instance=db2inst1, database=ocft
>> # adapt this in set_testenv below
>> #
>> # Simple steps to generate a test environment (if you don't have one):
>> #
>> # A virtual machine with 1200MB RAM is sufficient
>> #
>> # - download an eval version of DB2 server from IBM
>> # - create an user "db2inst1" in group "db2inst1"
>> #
>> # As root
>> # - install DB2 software in some location
>> # - create instance
>> #   cd /instance
>> #   ./db2icrt -s ese -u db2inst1 db2inst1
>> # - adapt profile of db2inst1 as instructed by db2icrt
>> #
>> # As db2inst1
>> #      # allow to run with small memory footprint
>> #      db2set DB2_FCM_SETTINGS=FCM_MAXIMIZE_SET_SIZE:FALSE
>> #      db2start
>> #      db2start dbpartitionnum 1 add dbpartitionnum hostname $(uname -n) 
>> port 1 without tablespaces
>> #      db2stop
>> #      db2start
>> #      db2 create database ocft
>> # Done
>> # In order to install a real cluster refer to 
>> http://www.linux-ha.org/wiki/db2_(resource_agent)
>>
>> CONFIG
>>         HangTimeout 40
>>
>> SETUP-AGENT
>>         # nothing
>>
>> CASE-BLOCK set_testenv
>>         Var OCFT_instance=db2inst1
>>         Var OCFT_db=ocft
>>
>> CASE-BLOCK crm_setting
>>         Var OCF_RESKEY_instance=$OCFT_instance
>>       Var OCF_RESKEY_CRM_meta_timeout=3
>>
>> CASE-BLOCK default_status
>>       AgentRun stop
>>
>> CASE-BLOCK prepare
>>         Include set_testenv
>>       Include crm_setting
>>       Include default_status
>>
>> CASE "check base env"
>>       Include prepare
>>       AgentRun start OCF_SUCCESS
>>
>> CASE "check base env: invalid 'OCF_RESKEY_instance'"
>>       Include prepare
>>       Var OCF_RESKEY_instance=no_such
>>       AgentRun start OCF_ERR_INSTALLED
>>
>> CASE "invalid instance config"
>>       Include prepare
>>       Bash eval mv ~$OCFT_instance/sqllib ~$OCFT_instance/sqllib-
>>       BashAtExit eval mv ~$OCFT_instance/sqllib- ~$OCFT_instance/sqllib
>>       AgentRun start OCF_ERR_INSTALLED
>>
>> CASE "unimplemented command"
>>       Include prepare
>>       AgentRun no_cmd OCF_ERR_UNIMPLEMENTED
>>
>> 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 "started: monitor"
>>       Include prepare
>>       AgentRun start
>>       AgentRun monitor OCF_SUCCESS
>>
>> CASE "not started: monitor"
>>       Include prepare
>>       AgentRun monitor OCF_NOT_RUNNING
>>
>> CASE "killed instance: monitor"
>>         Include prepare
>>         AgentRun start OCF_SUCCESS
>>         AgentRun monitor OCF_SUCCESS
>>         BashAtExit rm /tmp/ocft-helper1
>>         Bash echo "su $OCFT_instance -c '. 
>> ~$OCFT_instance/sqllib/db2profile; db2nkill 0 >/dev/null 2>&1'" > 
>> /tmp/ocft-helper1
>>         Bash sh -x /tmp/ocft-helper1
>>         AgentRun monitor OCF_NOT_RUNNING
>>
>> CASE "overload param instance by admin"
>>         Include prepare
>>         Var OCF_RESKEY_instance=no_such
>>         Var OCF_RESKEY_admin=$OCFT_instance
>>         AgentRun start OCF_SUCCESS
>>
>> CASE "check start really activates db"
>>         Include prepare
>>         AgentRun start OCF_SUCCESS
>>
>>         BashAtExit rm /tmp/ocft-helper2
>>         Bash echo "su $OCFT_instance -c '. 
>> ~$OCFT_instance/sqllib/db2profile; db2 get snapshot for database on 
>> $OCFT_db>/dev/null'" > /tmp/ocft-helper2
>>         Bash sh -x /tmp/ocft-helper2
>>
>> CASE "multipartion test"
>>         Include prepare
>>         AgentRun start OCF_SUCCESS
>>         AgentRun monitor OCF_SUCCESS
>>
>>         # start does not start partion 1
>>         Var OCF_RESKEY_dbpartitionnum=1
>>         AgentRun monitor OCF_NOT_RUNNING
>>
>>         # now start 1
>>         AgentRun start OCF_SUCCESS
>>         AgentRun monitor OCF_SUCCESS
>>
>>         # now stop 1
>>         AgentRun stop OCF_SUCCESS
>>         AgentRun monitor OCF_NOT_RUNNING
>>
>>         # does not affect 0
>>         Var OCF_RESKEY_dbpartitionnum=0
>>         AgentRun monitor OCF_SUCCESS
>>
>> # fault injection does not work on the 1.0.4 client due to a hardcoded path
>> CASE "simulate hanging db2stop (not meaningful fo

Re: [Linux-ha-dev] New ocft config file for IBM db2 resource agent

2011-02-15 Thread Dejan Muhamedagic
Hi Holger,

On Tue, Feb 15, 2011 at 09:49:07AM +0100, Holger Teutsch wrote:
> Hi,
> please find enclosed an ocft config for db2 for review and inclusion
> into the project if appropriate.

Wonderful! This is the first time somebody contributed an ocft
testcase.

> The current 1.0.4 agent passes the tests 8-) .

I've never doubted that either.

Cheers,

Dejan

> 
> Regards
> Holger
> 
> 
> 

> # db2
> #
> # This test assumes a db2 ESE instance with two partions and a database.
> # Default is instance=db2inst1, database=ocft
> # adapt this in set_testenv below
> #
> # Simple steps to generate a test environment (if you don't have one):
> #
> # A virtual machine with 1200MB RAM is sufficient
> #
> # - download an eval version of DB2 server from IBM
> # - create an user "db2inst1" in group "db2inst1"
> #
> # As root
> # - install DB2 software in some location
> # - create instance
> #   cd /instance
> #   ./db2icrt -s ese -u db2inst1 db2inst1
> # - adapt profile of db2inst1 as instructed by db2icrt
> #
> # As db2inst1
> #  # allow to run with small memory footprint
> #  db2set DB2_FCM_SETTINGS=FCM_MAXIMIZE_SET_SIZE:FALSE
> #  db2start
> #  db2start dbpartitionnum 1 add dbpartitionnum hostname $(uname -n) port 
> 1 without tablespaces
> #  db2stop
> #  db2start
> #  db2 create database ocft
> # Done
> # In order to install a real cluster refer to 
> http://www.linux-ha.org/wiki/db2_(resource_agent)
> 
> CONFIG
> HangTimeout 40
> 
> SETUP-AGENT
> # nothing
> 
> CASE-BLOCK set_testenv
> Var OCFT_instance=db2inst1
> Var OCFT_db=ocft
> 
> CASE-BLOCK crm_setting
> Var OCF_RESKEY_instance=$OCFT_instance
>   Var OCF_RESKEY_CRM_meta_timeout=3
> 
> CASE-BLOCK default_status
>   AgentRun stop
> 
> CASE-BLOCK prepare
> Include set_testenv
>   Include crm_setting
>   Include default_status
> 
> CASE "check base env"
>   Include prepare
>   AgentRun start OCF_SUCCESS
> 
> CASE "check base env: invalid 'OCF_RESKEY_instance'"
>   Include prepare
>   Var OCF_RESKEY_instance=no_such
>   AgentRun start OCF_ERR_INSTALLED
> 
> CASE "invalid instance config"
>   Include prepare
>   Bash eval mv ~$OCFT_instance/sqllib ~$OCFT_instance/sqllib-
>   BashAtExit eval mv ~$OCFT_instance/sqllib- ~$OCFT_instance/sqllib
>   AgentRun start OCF_ERR_INSTALLED
> 
> CASE "unimplemented command"
>   Include prepare
>   AgentRun no_cmd OCF_ERR_UNIMPLEMENTED
> 
> 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 "started: monitor"
>   Include prepare
>   AgentRun start
>   AgentRun monitor OCF_SUCCESS
> 
> CASE "not started: monitor"
>   Include prepare
>   AgentRun monitor OCF_NOT_RUNNING
> 
> CASE "killed instance: monitor"
> Include prepare
> AgentRun start OCF_SUCCESS
> AgentRun monitor OCF_SUCCESS
> BashAtExit rm /tmp/ocft-helper1
> Bash echo "su $OCFT_instance -c '. ~$OCFT_instance/sqllib/db2profile; 
> db2nkill 0 >/dev/null 2>&1'" > /tmp/ocft-helper1
> Bash sh -x /tmp/ocft-helper1
> AgentRun monitor OCF_NOT_RUNNING
> 
> CASE "overload param instance by admin"
> Include prepare
> Var OCF_RESKEY_instance=no_such
> Var OCF_RESKEY_admin=$OCFT_instance
> AgentRun start OCF_SUCCESS
> 
> CASE "check start really activates db"
> Include prepare
> AgentRun start OCF_SUCCESS
> 
> BashAtExit rm /tmp/ocft-helper2
> Bash echo "su $OCFT_instance -c '. ~$OCFT_instance/sqllib/db2profile; 
> db2 get snapshot for database on $OCFT_db>/dev/null'" > /tmp/ocft-helper2
> Bash sh -x /tmp/ocft-helper2
> 
> CASE "multipartion test"
> Include prepare
> AgentRun start OCF_SUCCESS
> AgentRun monitor OCF_SUCCESS
> 
> # start does not start partion 1
> Var OCF_RESKEY_dbpartitionnum=1
> AgentRun monitor OCF_NOT_RUNNING
> 
> # now start 1
> AgentRun start OCF_SUCCESS
> AgentRun monitor OCF_SUCCESS
> 
> # now stop 1
> AgentRun stop OCF_SUCCESS
> AgentRun monitor OCF_NOT_RUNNING
> 
> # does not affect 0
> Var OCF_RESKEY_dbpartitionnum=0
> AgentRun monitor OCF_SUCCESS
> 
> # fault injection does not work on the 1.0.4 client due to a hardcoded path
> CASE "simulate hanging db2stop (not meaningful for 1.0.4 agent)"
> Include prepare
> AgentRun start OCF_SUCCESS
> Bash [ ! -f /usr/local/bin/db2stop ]
> BashAtExit rm /usr/local/bin/db2stop
> Bash echo -e "#!/bin/sh\necho fake db2stop\nsleep 1" > 
> /usr/local/bi

[Linux-ha-dev] New ocft config file for IBM db2 resource agent

2011-02-15 Thread Holger Teutsch
Hi,
please find enclosed an ocft config for db2 for review and inclusion
into the project if appropriate.

The current 1.0.4 agent passes the tests 8-) .

Regards
Holger



# db2
#
# This test assumes a db2 ESE instance with two partions and a database.
# Default is instance=db2inst1, database=ocft
# adapt this in set_testenv below
#
# Simple steps to generate a test environment (if you don't have one):
#
# A virtual machine with 1200MB RAM is sufficient
#
# - download an eval version of DB2 server from IBM
# - create an user "db2inst1" in group "db2inst1"
#
# As root
# - install DB2 software in some location
# - create instance
#   cd /instance
#   ./db2icrt -s ese -u db2inst1 db2inst1
# - adapt profile of db2inst1 as instructed by db2icrt
#
# As db2inst1
#  # allow to run with small memory footprint
#  db2set DB2_FCM_SETTINGS=FCM_MAXIMIZE_SET_SIZE:FALSE
#  db2start
#  db2start dbpartitionnum 1 add dbpartitionnum hostname $(uname -n) port 1 
without tablespaces
#  db2stop
#  db2start
#  db2 create database ocft
# Done
# In order to install a real cluster refer to 
http://www.linux-ha.org/wiki/db2_(resource_agent)

CONFIG
HangTimeout 40

SETUP-AGENT
# nothing

CASE-BLOCK set_testenv
Var OCFT_instance=db2inst1
Var OCFT_db=ocft

CASE-BLOCK crm_setting
Var OCF_RESKEY_instance=$OCFT_instance
Var OCF_RESKEY_CRM_meta_timeout=3

CASE-BLOCK default_status
AgentRun stop

CASE-BLOCK prepare
Include set_testenv
Include crm_setting
Include default_status

CASE "check base env"
Include prepare
AgentRun start OCF_SUCCESS

CASE "check base env: invalid 'OCF_RESKEY_instance'"
Include prepare
Var OCF_RESKEY_instance=no_such
AgentRun start OCF_ERR_INSTALLED

CASE "invalid instance config"
Include prepare
Bash eval mv ~$OCFT_instance/sqllib ~$OCFT_instance/sqllib-
BashAtExit eval mv ~$OCFT_instance/sqllib- ~$OCFT_instance/sqllib
AgentRun start OCF_ERR_INSTALLED

CASE "unimplemented command"
Include prepare
AgentRun no_cmd OCF_ERR_UNIMPLEMENTED

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 "started: monitor"
Include prepare
AgentRun start
AgentRun monitor OCF_SUCCESS

CASE "not started: monitor"
Include prepare
AgentRun monitor OCF_NOT_RUNNING

CASE "killed instance: monitor"
Include prepare
AgentRun start OCF_SUCCESS
AgentRun monitor OCF_SUCCESS
BashAtExit rm /tmp/ocft-helper1
Bash echo "su $OCFT_instance -c '. ~$OCFT_instance/sqllib/db2profile; 
db2nkill 0 >/dev/null 2>&1'" > /tmp/ocft-helper1
Bash sh -x /tmp/ocft-helper1
AgentRun monitor OCF_NOT_RUNNING

CASE "overload param instance by admin"
Include prepare
Var OCF_RESKEY_instance=no_such
Var OCF_RESKEY_admin=$OCFT_instance
AgentRun start OCF_SUCCESS

CASE "check start really activates db"
Include prepare
AgentRun start OCF_SUCCESS

BashAtExit rm /tmp/ocft-helper2
Bash echo "su $OCFT_instance -c '. ~$OCFT_instance/sqllib/db2profile; 
db2 get snapshot for database on $OCFT_db>/dev/null'" > /tmp/ocft-helper2
Bash sh -x /tmp/ocft-helper2

CASE "multipartion test"
Include prepare
AgentRun start OCF_SUCCESS
AgentRun monitor OCF_SUCCESS

# start does not start partion 1
Var OCF_RESKEY_dbpartitionnum=1
AgentRun monitor OCF_NOT_RUNNING

# now start 1
AgentRun start OCF_SUCCESS
AgentRun monitor OCF_SUCCESS

# now stop 1
AgentRun stop OCF_SUCCESS
AgentRun monitor OCF_NOT_RUNNING

# does not affect 0
Var OCF_RESKEY_dbpartitionnum=0
AgentRun monitor OCF_SUCCESS

# fault injection does not work on the 1.0.4 client due to a hardcoded path
CASE "simulate hanging db2stop (not meaningful for 1.0.4 agent)"
Include prepare
AgentRun start OCF_SUCCESS
Bash [ ! -f /usr/local/bin/db2stop ]
BashAtExit rm /usr/local/bin/db2stop
Bash echo -e "#!/bin/sh\necho fake db2stop\nsleep 1" > 
/usr/local/bin/db2stop
Bash chmod +x /usr/local/bin/db2stop
AgentRun stop OCF_SUCCESS

# fault injection does not work on the 1.0.4 client due to a hardcoded path
CASE "simulate not stopping db2stop (not meaningful for 1.0.4 agent)"
Include prepare
AgentRun start OCF_SUCCESS
Bash [ ! -f /usr/local/bin/db2stop ]
BashAtExit rm /usr/local/bin/db2stop
Bash echo -e "#!/bin/sh\necho fake db2stop\nexit 0" > 
/usr/local/bin/db2stop