Many thanks to Yan, Eddie and Serge!

What I am trying to do is to implement a CLI command to migrate the resource
to the backup node.
From the replies, my understand is: there is no single command can do that.
No matter what, I need to do:
  1. "standby on node1"
  2. after a while
  3. "standby off node1"
       or
  1. "crm_source -M -r node1"
  2. after a while
  3. "crm_source -M -r node1 -U"

Any existing tool  can promptly inform me that the "step 1" is done?

I am sending messages to heartbeat mgmt module because I did not know
crm_tools. Looks the crm_admin tools
are you guys recommend, is that correct?

Thanks!

On 4/30/07, Serge Dubrouski <[EMAIL PROTECTED]> wrote:

Once I wrote this simple script to simplify start/stop/move and other
operations on resources:

#!/bin/sh
#
# Description:  A simple script to simplify some Linux-HA commands
#
#
# Author:       Serge Dubrouski
#


usage() {
    echo "Usage: hares -[start|stop|manage|unmanage|move|unmove]
resource [-to node]"
    exit 1
}


moveResource() {
    if [ $# -lt 2 ] || [ $1 != "-to" ]
    then
        usage
    fi

    echo "Moving $res to $2"

    crm_resource -M -r $res -H $2
}


if [ $# -lt 2 ]
then
    usage
fi

case $1 in
    -[sS][tT][oO][pP])
                    echo "Trying to stop resource $2"
                    cibadmin -M -o resources -X "<nvpair
id=\"${2}_role\" value=\"Stopped\"/>"
                    break;;
    -[sS][tT][aA][rR][tT])
                    echo "Trying to start resource $2"
                    cibadmin -M -o resources -X "<nvpair
id=\"${2}_role\" value=\"Started\"/>"
                    break;;
    -[mM][aA][nN][aA][gG][eE])
                    echo "Putting $2 into MANAGED state"
                    crm_resource -p is_managed -r $2 -t primitive -v true
                    break;;
    -[uU][nN][mM][aA][nN][aA][gG][eE] )
                    echo "Putting $2 into UNMANAGED state"
                    crm_resource -p is_managed -r $2 -t primitive -v false
                    break;;
    -[mM][oO][vV][eE] )
                    res=$2
                    shift; shift
                    moveResource $*
                    break;;
    -[uU][nN][mM][oO][vV][eE])
                    echo "UnMove $2"
                    crm_resource -U -r $2
                    break;;
    * ) usage;;
esac



On 4/30/07, Tao Yu <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am a new user of heartbeat.
>
> I configure a cluster with two nodes, and I want to move resource from
> current running node to the other one. From the mgmt_common.h, I can not
> figure out which message I should send to the mgmt module so I do the
> following:
>      1. send "standby on" to current running node (node1)
>      2. wait for some time, then send "standby off" to node1, to make
sure
> it could fail over back.
>
> Is there a single command can having this done?
>
> Thanks,
> Tao
> _______________________________________________
> Linux-HA mailing list
> [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to