[Pacemaker] [PATCH] crm shell (configure node) for Heartbeat stack

Kazunori INOUE inouekazu at intellilink.co.jp
Fri May 27 08:45:51 UTC 2011


Hi Dejan,

Thanks for the advice.
Is your advice to be done as follows?

# diff cibconfig.py.ORG cibconfig.py -urN
--- cibconfig.py.ORG	2011-04-28 12:23:55.000000000 +0900
+++ cibconfig.py	2011-05-27 12:00:27.427168202 +0900
@@ -1514,6 +1514,16 @@
      def import_cib(self):
          'Parse the current CIB (from cibadmin -Q).'
          self.doc,cib = read_cib(cibdump2doc)
+        common_debug("import_cib >BEFORE:\n%s"%(get_conf_elem(self.doc,"nodes").toprettyxml(indent='  ',newl='')))
+        nodes = get_conf_elem(self.doc,"nodes")
+        if nodes:
+            for c in nodes.childNodes:
+                if not is_element(c) or c.tagName != "node":
+                    continue
+                uname = c.getAttribute("uname").encode('ascii')
+                if uname:
+                    c.setAttribute("id",uname)
+        common_debug("import_cib >AFTER:\n%s"%(get_conf_elem(self.doc,"nodes").toprettyxml(indent='  ',newl='')))
          if not self.doc:
              return False
          if not cib:
#
# crm -d configure load update test1.cli
DEBUG: import_cib >BEFORE:
<nodes>
         <node id="68057c1e-6a5e-402b-be84-c56b98d5c985" type="normal" uname="srv-a2"/>
         <node id="0cd9d2df-13fa-4b11-93d3-27a57192caeb" type="normal" uname="srv-a1"/>
     </nodes>
DEBUG: import_cib >AFTER:
<nodes>
         <node id="srv-a2" type="normal" uname="srv-a2"/>
         <node id="srv-a1" type="normal" uname="srv-a1"/>
     </nodes>
DEBUG: obj srv-a2 node: <node id="srv-a2" type="normal" uname="srv-a2"/>

DEBUG: obj srv-a1 node: <node id="srv-a1" type="normal" uname="srv-a1"/>

(snip)
#

This is it, srv-a1 and srv-a2 are added as unclean node.

# crm configure show
node srv-a2
node srv-a1 \
         utilization capacity="1"
node $id="68057c1e-6a5e-402b-be84-c56b98d5c985" srv-a2
node $id="0cd9d2df-13fa-4b11-93d3-27a57192caeb" srv-a1
property $id="cib-bootstrap-options" \
         dc-version="1.1.5-1.25.el6-5bdfc629f35af0305bb87676297d81251f0511ea" \
         cluster-infrastructure="Heartbeat"
#

Best Regards,
Kazunori INOUE

(2011/05/20 0:29), Dejan Muhamedagic wrote:
> Hi Kazunori-san,
>
> On Thu, May 12, 2011 at 03:22:31PM +0900, Kazunori INOUE wrote:
>> Hi all,
>>
>> We found that crm shell (configure node) failed on Heartbeat-3.0.4 stack.
>> I attached a patch for crm shell in Pacemaker-1.1 (e872eeb39a5f).
>>
>> [failed case]
>> (1) Set node's attributes/utilization with crm shell
>>      ('crm configure load update cli-file').
>>
>>      # service heartbeat start
>>      # cat test1.cli
>>      node srv-a1 utilization capacity="1"
>>      #
>>      # crm configure load update test1.cli
>>      # crm_mon -1
>>      ============
>>      Last updated: Thu May 12 13:16:49 2011
>>      Stack: Heartbeat
>>      Current DC: srv-a2 (68057c1e-6a5e-402b-be84-c56b98d5c985) - partition with quorum
>>      Version: 1.1.5-1.25.el6-5bdfc629f35af0305bb87676297d81251f0511ea
>>      3 Nodes configured, unknown expected votes
>>      0 Resources configured.
>>      ============
>>
>>   ->  Node srv-a1: UNCLEAN (offline)
>>      Online: [ srv-a2 srv-a1 ]
>>
>>      #
>>      # crm configure show
>>      node $id="68057c1e-6a5e-402b-be84-c56b98d5c985" srv-a2
>>      node $id="0cd9d2df-13fa-4b11-93d3-27a57192caeb" srv-a1
>>      node srv-a1 \
>>              utilization capacity="1"
>>      property $id="cib-bootstrap-options" \
>>              dc-version="1.1.5-1.25.el6-5bdfc629f35af0305bb87676297d81251f0511ea" \
>>              cluster-infrastructure="Heartbeat"
>>      #
>>
>>
>>      In following CLI, node's attribute was set correctly.
>>      However, it is inconvenient to specify ID of the cluster node.
>>      # cat test2.cli
>>      node $id="0cd9d2df-13fa-4b11-93d3-27a57192caeb" \
>>      srv-a1 utilization capacity="1"
>>      #
>>
>> (2) Set node's attributes/utilization with crm shell
>>      ('crm configure node xxx').
>>
>>      # service heartbeat start
>>      # crm configure node srv-a1 attributes attr1=val1
>>      # crm_mon -A1
>>      ============
>>      Last updated: Thu May 12 11:56:17 2011
>>      Stack: Heartbeat
>>      Current DC: srv-a2 (68057c1e-6a5e-402b-be84-c56b98d5c985) - partition with quorum
>>      Version: 1.1.5-1.25.el6-5bdfc629f35af0305bb87676297d81251f0511ea
>>      3 Nodes configured, unknown expected votes
>>      0 Resources configured.
>>      ============
>>
>>   ->  Node srv-a1: UNCLEAN (offline)
>>      Online: [ srv-a2 srv-a1 ]
>>
>>      Node Attributes:
>>      * Node srv-a2:
>>   ->  * Node srv-a1:
>>      #
>>
>> Regards,
>> Kazunori INOUE
>
> OK, I can imagine what's going on, but I'm not so sure about the
> proposed patch. Instead of fixing the id of the node afterwards
> it should have the right value from the beginning, i.e. after
> parsing XML. Or would there be other issues because of that?
>
> Cheers,
>
> Dejan
>
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker




More information about the Pacemaker mailing list