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
diff -urN pacemaker-1.1.ORG/shell/modules/cibconfig.py pacemaker-1.1.MOD/shell/modules/cibconfig.py --- pacemaker-1.1.ORG/shell/modules/cibconfig.py 2011-05-12 11:13:54.000000000 +0900 +++ pacemaker-1.1.MOD/shell/modules/cibconfig.py 2011-05-12 10:33:48.814021045 +0900 @@ -321,6 +321,30 @@ except: pass return [] +def replace_node_id(cli_list): + if not cli_list or cli_list[0][0] != "node": + return None + uname = find_value(cli_list[0][1],"uname") + id = find_value(cli_list[0][1],"id") + if uname and uname == id: + nodes = get_conf_elem(cibdump2doc("nodes"),"nodes") + if nodes: + common_debug("cli_list: %s"%cli_list) + for c in nodes.childNodes: + if (not is_element(c) or c.tagName != "node" or + c.getAttribute("uname") != uname): + continue + node_id = c.getAttribute("id").encode('ascii') + if not node_id: + continue + for x in cli_list[0][1]: + if x[0] == "id" and x[1] != node_id: + common_debug("id_replace: <%s> to <%s>"%(x[1],node_id)) + x[1] = node_id + common_debug("cli_list: %s"%cli_list) + return node_id + return id + class CibObjectSetCli(CibObjectSet): ''' Edit or display a set of cib objects (using cli notation). @@ -375,7 +399,7 @@ err_buf.incr_lineno() cli_list = cp.parse(cli_text) if cli_list: - id = find_value(cli_list[0][1],"id") + id = replace_node_id(cli_list) if id: if id in id_list: common_err("duplicate element %s" % id) @@ -2060,6 +2084,7 @@ if obj_type == "op": return self.add_op(cli_list) if obj_type == "node": + obj_id = replace_node_id(cli_list) obj = self.find_object(obj_id) # make an exception and allow updating nodes if obj:
_______________________________________________ Pacemaker mailing list: Pacemaker@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