<div dir="ltr"><div>Alexey, thank you!<br><br></div><div>Now, it's clear for me.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">сб, 18 мая 2024 г. в 02:11, <<a href="mailto:alexey@pavlyuts.ru">alexey@pavlyuts.ru</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg4816520171025422718"><div lang="RU" style="overflow-wrap: break-word;"><div class="m_4816520171025422718WordSection1"><p class="MsoNormal"><span lang="EN-US">Hi Alexander,<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">AFAIK, Pacemaker itself only have deal with XML-based configuration database, shared across all cluster. Each time you call pcs or any other tool it takes XML (or part of it) from pacemaker, tweaks it and then push it back to Pacemaker. Each time XML is pushed, Pacemaker completely rethink the new config, look to the current state and schedule changes from current state to target state. I can’t point you to exact place in the docs where this described, but this from Pacemaker docs.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Therefore, each use of pcs command triggering this process immediately. Seems that some async-driven side effects may happen from this. Then, you may do ANY count of changes in one <b>stroke if Pacemaker got the new config with all these changes</b>. So, you need to enforce management tools FIRST prepare all changes and THEN push it all at once. And then you have no need to complete separate changes in background because the preparation is very fast. And final application will be done at max possible speed too.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Miroslav exampled how to manage bulk delete, but this is the <b>common way to manage massive change</b>. Any operations could be done! You take the Pacemaker CIB to a file, complete all the changes against the file instead write each one to CIB and then push the total back, then Pacemaker will schedule all changes.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">You may put ANY commands in any mix: add, change, delete, but use -f <filename> option for changes to be done against file. You may keep original to push diff (as at Miroslav example), or you may just push whole changed config, AFAIK, there no difference.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">###########################<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"># Make a copy of CIB into local file<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">pcs cluster cib config.xml<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US"># do changes against file<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">pcs -f config.xml resource add <blah-blah-blah><u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">pcs -f config.xml constraint <blah-blah-blah> <u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">pcs -f config.xml resource disable <id><u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">pcs -f config.xml resource remove <id><u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US"># And finally push the whole ‘configuration’ scope back (mind there no diff, but push only config scope)<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">pcs cluster cib-push config.xml –config<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">############################<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">And Pacemaker apply all changes at once.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Miroslav’s example taken from <a href="https://manpages.ubuntu.com/manpages/jammy/man8/pcs.8.html" target="_blank">pcs man page</a> for command ‘cluster cib-push’. My example works too.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Have a good failover! Means no failover at all )))<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Alex<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><div style="border-width:medium medium medium 1.5pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor blue;padding:0cm 0cm 0cm 4pt"><div><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0cm 0cm"><p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Users <<a href="mailto:users-bounces@clusterlabs.org" target="_blank">users-bounces@clusterlabs.org</a>> <b>On Behalf Of </b></span>Александр Руденко<span lang="EN-US"><br><b>Sent:</b> Friday, May 17, 2024 6:46 PM<br><b>To:</b> Cluster Labs - All topics related to open-source clustering welcomed <<a href="mailto:users@clusterlabs.org" target="_blank">users@clusterlabs.org</a>><br><b>Subject:</b> Re: [ClusterLabs] Disabled resources after parallel removing of group<u></u><u></u></span></p></div></div><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><div><div><div><p class="MsoNormal" style="margin-bottom:12pt">Miroslav, thank you! <br><br>It helps me understand that it's not a configuration issue.<u></u><u></u></p></div><p class="MsoNormal">BTW, is it okay to create new resources in parallel?<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt">On timeline it looks like:<u></u><u></u></p></div><div><p class="MsoNormal">pcs resource create resA1 .... --group groupA<u></u><u></u></p></div><div><p class="MsoNormal">pcs resource create resB1 .... --group groupB<br>resA1 Started<br>pcs resource create resA2 .... --group groupA<u></u><u></u></p></div><div><p class="MsoNormal">res B1 Started<br>pcs resource create resB2 .... --group groupB<u></u><u></u></p></div><div><p class="MsoNormal">res A2 Started<u></u><u></u></p></div><div><p class="MsoNormal">res B2 Started<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt">For now, it works okay)<u></u><u></u></p></div><div><p class="MsoNormal">In our case, cluster events like 'create' and 'remove' are generated by users, and for now we don't have any queue for operations. But now, I realized that we need a queue for 'remove' operations. Maybe we need a queue for 'create' operations to?<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">пт, 17 мая 2024 г. в 17:49, Miroslav Lisik <<a href="mailto:mlisik@redhat.com" target="_blank">mlisik@redhat.com</a>>:<u></u><u></u></p></div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><p class="MsoNormal">Hi Aleksandr!<br><br>It is not safe to use `pcs resource remove` command in parallel because<br>you run into the same issues as you already described. Processes run by<br>remove command are not synchronized.<br><br>Unfortunately, remove command does not support more than one resource<br>yet.<br><br>If you really need to remove resources at once you can use this method:<br>1. get the current cib configuration:<br>pcs cluster cib > original.xml<br><br>2. create a new copy of the file:<br>cp original.xml new.xml<br><br>3. disable all to be removed resources using -f option and new<br>configuration file:<br>pcs -f new.xml resource disable <resource id>...<br><br>4. remove resources using -f option and new configuration file:<br>pcs -f new.xml resource remove <resource id><br>...<br><br>5. push new cib configuration to the cluster<br>pcs cluster cib-push new.xml diff-against=original.xml<br><br><br>On 5/17/24 13:47, Александр Руденко wrote:<br>> Hi!<br>> <br>> I am new in the pacemaker world, and I, unfortunately, have problems <br>> with simple actions like group removal. Please, help me understand when <br>> I'm wrong.<br>> <br>> For simplicity I will use standard resources like IPaddr2 (but we have <br>> this problem on any type of our custom resources).<br>> <br>> I have 5 groups like this:<br>> <br>> Full List of Resources:<br>> * Resource Group: group-1:<br>> * ip-11 (ocf::heartbeat:IPaddr2): Started vdc16<br>> * ip-12 (ocf::heartbeat:IPaddr2): Started vdc16<br>> * Resource Group: group-2:<br>> * ip-21 (ocf::heartbeat:IPaddr2): Started vdc17<br>> * ip-22 (ocf::heartbeat:IPaddr2): Started vdc17<br>> * Resource Group: group-3:<br>> * ip-31 (ocf::heartbeat:IPaddr2): Started vdc18<br>> * ip-32 (ocf::heartbeat:IPaddr2): Started vdc18<br>> * Resource Group: group-4:<br>> * ip-41 (ocf::heartbeat:IPaddr2): Started vdc16<br>> * ip-42 (ocf::heartbeat:IPaddr2): Started vdc16<br>> <br>> Groups were created by next simple script:<br>> cat groups.sh<br>> pcs resource create ip-11 ocf:heartbeat:IPaddr2 ip=10.7.1.11 <br>> cidr_netmask=24 nic=lo op monitor interval=10s --group group-1<br>> pcs resource create ip-12 ocf:heartbeat:IPaddr2 ip=10.7.1.12 <br>> cidr_netmask=24 nic=lo op monitor interval=10s --group group-1<br>> <br>> pcs resource create ip-21 ocf:heartbeat:IPaddr2 ip=10.7.1.21 <br>> cidr_netmask=24 nic=lo op monitor interval=10s --group group-2<br>> pcs resource create ip-22 ocf:heartbeat:IPaddr2 ip=10.7.1.22 <br>> cidr_netmask=24 nic=lo op monitor interval=10s --group group-2<br>> <br>> pcs resource create ip-31 ocf:heartbeat:IPaddr2 ip=10.7.1.31 <br>> cidr_netmask=24 nic=lo op monitor interval=10s --group group-3<br>> pcs resource create ip-32 ocf:heartbeat:IPaddr2 ip=10.7.1.32 <br>> cidr_netmask=24 nic=lo op monitor interval=10s --group group-3<br>> <br>> pcs resource create ip-41 ocf:heartbeat:IPaddr2 ip=10.7.1.41 <br>> cidr_netmask=24 nic=lo op monitor interval=10s --group group-4<br>> pcs resource create ip-42 ocf:heartbeat:IPaddr2 ip=10.7.1.42 <br>> cidr_netmask=24 nic=lo op monitor interval=10s --group group-4<br>> <br>> Next, i try to remove all of these group in 'parallel':<br>> cat remove.sh<br>> pcs resource remove group-1 &<br>> sleep 0.2<br>> pcs resource remove group-2 &<br>> sleep 0.2<br>> pcs resource remove group-3 &<br>> sleep 0.2<br>> pcs resource remove group-4 &<br>> <br>> After this, every time I have a few resources in some groups which were <br>> not removed. It looks like:<br>> <br>> Full List of Resources:<br>> * Resource Group: group-2 (disabled):<br>> * ip-21 (ocf::heartbeat:IPaddr2): Stopped (disabled)<br>> * Resource Group: group-4 (disabled):<br>> * ip-41 (ocf::heartbeat:IPaddr2): Stopped (disabled)<br>> <br>> In logs, I can see success stopping all resources, but after stopping <br>> some resources it looks like pacemaker just 'forgot' about deletion and <br>> didn't.<br>> <br>> Cluster name: pacemaker1<br>> Cluster Summary:<br>> * Stack: corosync<br>> * Current DC: vdc16 (version 2.1.0-8.el8-7c3f660707) - partition with <br>> quorum<br>> * Last updated: Fri May 17 14:30:14 2024<br>> * Last change: Fri May 17 14:30:05 2024 by root via cibadmin on vdc16<br>> * 3 nodes configured<br>> * 2 resource instances configured (2 DISABLED)<br>> <br>> Node List:<br>> * Online: [ vdc16 vdc17 vdc18 ]<br>> <br>> Host OS is CentOS 8.4. Cluster with default settings. vdc16,vdc17,vdc18 <br>> are VMs with 4 vCPU.<br>> <br>> <br>> _______________________________________________<br>> Manage your subscription:<br>> <a href="https://lists.clusterlabs.org/mailman/listinfo/users" target="_blank">https://lists.clusterlabs.org/mailman/listinfo/users</a><br>> <br>> ClusterLabs home: <a href="https://www.clusterlabs.org/" target="_blank">https://www.clusterlabs.org/</a><br><br>_______________________________________________<br>Manage your subscription:<br><a href="https://lists.clusterlabs.org/mailman/listinfo/users" target="_blank">https://lists.clusterlabs.org/mailman/listinfo/users</a><br><br>ClusterLabs home: <a href="https://www.clusterlabs.org/" target="_blank">https://www.clusterlabs.org/</a><u></u><u></u></p></blockquote></div></div></div></div>_______________________________________________<br>
Manage your subscription:<br>
<a href="https://lists.clusterlabs.org/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.clusterlabs.org/mailman/listinfo/users</a><br>
<br>
ClusterLabs home: <a href="https://www.clusterlabs.org/" rel="noreferrer" target="_blank">https://www.clusterlabs.org/</a><br>
</div></blockquote></div>