[Pacemaker] Proper way to migrate multistate resource?

Chet Burgess cfb at liquidreality.org
Wed Feb 8 17:58:16 EST 2012

On Feb 7, 2012, at 4:54 , Lars Ellenberg wrote:

> On Mon, Feb 06, 2012 at 04:48:26PM -0800, Chet Burgess wrote:
>> Greetings,
>> I'm some what new to pacemaker and have been playing around with a
>> number of configurations in a lab. Most recently I've been testing a
>> multistate resource using the ofc:pacemaker:Stateful example RA.
>> While I've gotten the agent to work and notice that if I shutdown or
>> kill a node the resources migrate I can't seem to figure out the
>> proper way to migrate the resource between nodes when they are both
>> up. 
>> For regular resources I've used "crm resource migrate <rsc>" without
>> issue. However when I try this with a multistate resource it doesn't
>> seem to work. When I run the command it just puts the slave node into
>> a stopped state. If I try and tell it to migrate specifically to the
>> slave node it claims to already be running their (which I suppose in a
>> sense it is).
> the crm shell does not support roles for the "move" or "migrate" command
> (yet; maybe in newer versions. Dejan?).
> What you need to do is set a location constraint on the role.
> * force master role off from one node:
> 	location you-name-it resource-id \
> 		rule $role=Master -inf: \
> 		#uname eq node-where-it-should-be-slave
> * or force master role off from all but one node,
>   note the double negation in this one:
> 	location you-name-it resource-id \
> 		rule $role=Master -inf: \
> 		#uname ne node-where-it-should-be-master

	OK I finally got around to testing this today. Both scenarios described above worked as described. Thank you.

	One minor hitch though. When I remove the constraint the resource goes back to the original (and preferred by the configuration) node. With my non-multistate resources when I remove the constraint the resource remains on the node it was moved to until it is forced to move again with another constraint (eg. what "crm resource migrate" does).

	I have the default resource-stickiness set to 100 and my location constraints for setting the preferred node use 10 for the preferred node and 0 for all other nodes.  I tried setting resource-stickiness to 100 directly on the primitive for the resource and on the ms definition of the resource but still had the same results.  I event tried setting the resource-stickiness to infinity with no result.

	So clearly my understanding of the scoring is somewhat flawed. I've added my sample config again at the end of the message. Any pointers as to what I'm doing wrong with my scoring and resource-stickiness? Happy to provide any other details, or output from logs if needed.

	Thank you again for your assistance.

crm configure show:

node tst3.local1.mc.metacloud.com
node tst4.local1.mc.metacloud.com
primitive stateful-test ocf:pacemaker:Stateful \
	op monitor interval="30s" role="Slave" \
	op monitor interval="31s" role="Master"
ms ms-test stateful-test \
	meta clone-node-max="1" notify="false" master-max="1" master-node-max="1"
location ms-test_constraint_1 ms-test 10: tst3.local1.mc.metacloud.com
location ms-test_constraint_2 ms-test 0: tst4.local1.mc.metacloud.com
property $id="cib-bootstrap-options" \
	cluster-infrastructure="openais" \
	dc-version="1.1.5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f" \
	last-lrm-refresh="1325273678" \
	expected-quorum-votes="2" \
	no-quorum-policy="ignore" \
rsc_defaults $id="rsc-options" \

Chet Burgess
cfb at liquidreality.org

More information about the Pacemaker mailing list