[ClusterLabs] pcs stonith update <id> <args> problems

kgaillot at redhat.com kgaillot at redhat.com
Fri Jul 16 10:48:50 EDT 2021


On Thu, 2021-07-15 at 18:02 -0400, Digimer wrote:
> Hi all,
> 
>   I've got a predicament... I want to update a stonith resource to
> remove an argument. Specifically, when resource move nodes, I want to
> change the stonith delay to favour the new host. This involves adding
> the 'delay="x"' argument to one stonith resource, and removing it
> from
> the other;

There are two better ways to do what you want that don't involve
changing the configuration every time.

(1) Priority fencing delay:

https://clusterlabs.org/pacemaker/doc/2.1/Pacemaker_Explained/singlehtml/index.html#cluster-options

This was added in 2.0.4, and does exactly what you want. Just set the
priority meta-attribute on your resources, and the priority-fencing-
delay cluster property.

(1) Attribute-based rules:

https://clusterlabs.org/pacemaker/doc/2.1/Pacemaker_Explained/singlehtml/index.html#document-rules

If you don't have 2.0.4, you can use rules instead. pcs might not
support it, though, so you might need to configure the XML.

* Configure an ocf:pacemaker:attribute resource that's colocated with
your main resource (this just sets a node attribute wherever it's
active)

* Configure the stonith delay in a rule-based attribute block, with a 0
delay if the node attribute is "active" and a higher delay if it's
"inactive"


> Example;
> 
> ====
> # pcs cluster cib | grep -B7 -A7 '"delay"'
>       <primitive class="stonith" id="ipmilan_node1"
> type="fence_ipmilan">
>         <instance_attributes id="ipmilan_node1-instance_attributes">
>           <nvpair id="ipmilan_node1-instance_attributes-ipaddr"
> name="ipaddr" value="10.201.17.1"/>
>           <nvpair id="ipmilan_node1-instance_attributes-password"
> name="password" value="xxx"/>
>           <nvpair id="ipmilan_node1-instance_attributes-
> pcmk_host_list"
> name="pcmk_host_list" value="an-a02n01"/>
>           <nvpair id="ipmilan_node1-instance_attributes-username"
> name="username" value="admin"/>
>           <nvpair id="ipmilan_node1-instance_attributes-delay"
> name="delay" value="15"/>
>         </instance_attributes>
>         <operations>
>           <op id="ipmilan_node1-monitor-interval-60" interval="60"
> name="monitor"/>
>         </operations>
>       </primitive>
> ====
> 
> Here, the stonith resource 'ipmilan_node1' has the delay="15".
> 
> If I run:
> 
> ====
> # pcs stonith update ipmilan_node1 fence_ipmilan ipaddr="10.201.17.1"
> password="xxx" username="admin"; echo $?
> 0
> ====
> 
> I see nothing happen in journald, and the delay argument remains in
> the
> 'pcs cluster cib' output. If, however, I do;
> 
> ====
> # /usr/sbin/pcs stonith update ipmilan_node1 fence_ipmilan
> ipaddr="10.201.17.1" password="xxx" username="admin" delay="0"; echo
> $?
> 0
> ====
> 
> I can see in journald that the CIB was updated and can confirm in
> 'pcs
> cluster cib' that the 'delay' value becomes '0'. So it seems that, if
> an
> argument previously existed and is NOT specified in an update, it is
> not
> removed.
> 
> Is this intentional for some reason? If so, how would I remove the
> delay
> attribute? I've got a fairly complex stonith config, with stonith
> levels. Deleting and recreating the config would be non-trivial.
> 
> Pacemaker v2.1.0, pcs v0.10.8.181-47e9, CentOS Stream 8.
> 
> digimer
> 
-- 
Ken Gaillot <kgaillot at redhat.com>



More information about the Users mailing list