Hi Dejan,

(2011/06/22 16:02), Dejan Muhamedagic wrote:
Hi Kazunori-san,

On Wed, Jun 22, 2011 at 02:14:04PM +0900, Kazunori INOUE wrote:
Hi Dejan,

Thank you for the response.
All right. We'll wait.

The issue is somewhat more serious, probably. All elements from
the CIB are referenced by the id, which was thought to be
universally the id attribute. But, with nodes, it should be the
uname attribute. Such an exception may be expensive, I'm not sure
yet.

There is one question.
I found that node's attribute was set correctly in following CLI which
specified "$id=<UUID>".

# cat test2.cli
node $id="0cd9d2df-13fa-4b11-93d3-27a57192caeb" srv-a1 utilization capacity="1"
#

It is not listed in the document, but is not it right usage?
http://www.clusterlabs.org/doc/crm_cli.html#cmdhelp_configure_node

If it is right, I think that the node command that does not specify "$id"
only has to do the same behavior as the node command that specifies "$id".
Therefore, I replace the id (in cli_list list variable) of the parsed
arguments of the node command..

Best Regards,
Kazunori INOUE

Cheers,

Dejan

Then, I revised a patch a little.
(The result to be provided is the same as the first patch.)

# hg diff -r 22acba43e041 shell/modules/cibconfig.py
diff -r 22acba43e041 shell/modules/cibconfig.py
--- a/shell/modules/cibconfig.py        Tue Jun 07 17:18:05 2011 +0200
+++ b/shell/modules/cibconfig.py        Wed Jun 22 13:37:31 2011 +0900
@@ -318,6 +318,22 @@
      except: pass
      return []

+def replace_node_id(cli_list):
+    head = cli_list[0]
+    id = find_value(head[1],"id")
+    if head[0] != "node":
+        return
+    common_debug("cli_list: %s"%cli_list)
+    for obj in [obj for obj in cib_factory.cib_objects if obj.obj_type == 
head[0]]:
+        uname = obj.node.getAttribute("uname")
+        # The following conditions means 'Heartbeat stack' and '$id is not 
specified'
+        if obj.obj_id != uname and uname == id:
+            for x in [x for x in head[1] if x[0] == "id"]:
+                common_debug("replace node's id:<%s>  
to<%s>"%(x[1],obj.obj_id))
+                x[1] = obj.obj_id.encode('ascii')
+                common_debug("cli_list: %s"%cli_list)
+                return
+
  class CibObjectSetCli(CibObjectSet):
      '''
      Edit or display a set of cib objects (using cli notation).
@@ -372,6 +388,7 @@
              err_buf.incr_lineno()
              cli_list = cp.parse(cli_text)
              if cli_list:
+                replace_node_id(cli_list)
                  id = find_value(cli_list[0][1],"id")
                  if id:
                      if id in id_list:
@@ -2058,6 +2075,8 @@
          if obj_type == "op":
              return self.add_op(cli_list)
          if obj_type == "node":
+            replace_node_id(cli_list)
+            obj_id = find_value(head[1],"id")
              obj = self.find_object(obj_id)
              # make an exception and allow updating nodes
              if obj:
#

Best Regards,
Kazunori INOUE

(2011/06/21 21:59), Dejan Muhamedagic wrote:
Hi Kazunori-san,

Apologies for not getting back to you sooner.

On Mon, Jun 06, 2011 at 06:17:31PM +0900, Kazunori INOUE wrote:
Hi,

(2011/05/27 19:32), Lars Ellenberg wrote:

Oh no.
Now you have duplicated all nodes, and will always get "unclean" nodes.

Is this some variant of:
http://www.clusterlabs.org/wiki/Initial_Configuration#A_Special_Note_for_People_Switching_Cluster_Stacks

Could that be the root cause of your duplicate node instances with
different ids?

Yes.
Corosync uses uname (output of 'uname -n') as ID of the node, and
Heartbeat uses UUID as ID of the node. Therefore, on Heartbeat stack,
unclean node is added when I loaded the following CLI.
# cat test1.cli
node srv-a1 utilization capacity="1"
#

Attached "crm_configure_node_for_hb.patch" replaces ID of node (uname)
with UUID, after parsing the node ('node srv-a1 utilization capacity="1"')
command.
# crm -d configure load update test1.cli
(snip)
DEBUG: 1: cli_list: [['node', [['uname', 'srv-a1'], ['id', 'srv-a1']]], 
['utilization', [['capacity', '1']]]]
DEBUG: 1: id_replace:<srv-a1>   to<0cd9d2df-13fa-4b11-93d3-27a57192caeb>
DEBUG: 1: cli_list: [['node', [['uname', 'srv-a1'], ['id', 
'0cd9d2df-13fa-4b11-93d3-27a57192caeb']]], ['utilization', [['capacity', '1']]]]
(snip)

In other words attached patch will get the same result as loading
following cli.
# cat test2.cli
node $id="0cd9d2df-13fa-4b11-93d3-27a57192caeb" utilization capacity="1"
#
Is not this patch effective?

Took a look at the patch, but I still need to investigate this
further. Unfortunately, my schedule got really tight lately.
I'll try to get to it as soon as I can.

Cheers,

Dejan

_______________________________________________
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

_______________________________________________
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

Reply via email to