Dne 16. 07. 21 v 6:35 Andrei Borzenkov napsal(a):
On 16.07.2021 01:02, 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;

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?

Yes, this is intentional. As far as I remember, update commands in pcs have always worked this way:
* do not change attributes not specified in the command
* if an attribute is specified with an empty value, remove the attribute from cluster configuration * else set specified value of the specified attribute in cluster configuration

This means you only need to specify attributes you want to change. You don't need to bother with attributes you want to keep unchanged.

If you want to delete the delay attribute, you can do it like this:
pcs stonith update ipmilan_node1 delay=
This will remove delay and keep all the other attributes unchanged.

I'm not sure why this principle is not documented in pcs man page. We can fix that, though.

Note that specifying a stonith agent in the update command does nothing (which is expected) and is silently ignored by pcs (which is a bug).

Regards,
Tomas


According to similar discussion a couple of days ago, you set attribute
to empty value: delay=""
_______________________________________________
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/


_______________________________________________
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/

Reply via email to