[Pacemaker] [Question]View order of the node of crm_mon

Andrew Beekhof andrew at beekhof.net
Tue Feb 28 18:13:59 EST 2012


Could you try the following patch:

diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c
index 8890850..4fcd224 100644
--- a/lib/pengine/unpack.c
+++ b/lib/pengine/unpack.c
@@ -191,6 +191,15 @@ unpack_config(xmlNode * config, pe_working_set_t
* data_set)
     return TRUE;
 }

+static gint sort_nodes_uname(gconstpointer a, gconstpointer b)
+{
+    const node_t *na = a;
+    const node_t *nb = b;
+
+    return strcmp(na->details->uname, nb->details->uname);
+}
+
+
 gboolean
 unpack_nodes(xmlNode * xml_nodes, pe_working_set_t * data_set)
 {
@@ -286,7 +295,7 @@ unpack_nodes(xmlNode * xml_nodes, pe_working_set_t
* data_set)
             unpack_instance_attributes(data_set->input, xml_obj,
XML_TAG_UTILIZATION, NULL,

new_node->details->utilization, NULL, FALSE, data_set->now);

-            data_set->nodes = g_list_append(data_set->nodes, new_node);
+            data_set->nodes = g_list_insert_sorted(data_set->nodes,
new_node, sort_nodes_uname);
             crm_trace("Done with node %s", crm_element_value(xml_obj,
XML_ATTR_UNAME));
         }
     }


On Wed, Feb 29, 2012 at 9:42 AM, Andrew Beekhof <andrew at beekhof.net> wrote:
> On Tue, Feb 28, 2012 at 2:23 PM,  <nozawat at gmail.com> wrote:
>> Hi Andrew,
>>
>>> > I thought whether the configuration files could describe the condition of the sort.
>>>
>>> That seems like overkill.
>> I don't need me to there either.
>> Order of the output becomes unsettled now because it use g_hash_table.
>
> No, its a list:
>
> unpack.c
>            data_set->nodes = g_list_append(data_set->nodes, new_node);
>
> crm_mon.c
>    for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) {
>
>
>> I think that it becomes the order of host name, and there should be unity.
>>
>> Regards,
>> Tomo
>>
>> On Tue, 28 Feb 2012 13:54:38 +1100
>> Andrew Beekhof <andrew at beekhof.net> wrote:
>>
>>> 2012/2/28  <nozawat at gmail.com>:
>>> > Hi Andrew,
>>> >
>>> >> >> Basically the order comes from how they are listed in the xml.
>>> >> >> We could sort it if you like.
>>> >> > Can I set the configuration file and a parameter?
>>> >>
>>> >> I'm confused. Can you rephrase this?
>>> > I thought whether the configuration files could describe the condition of the sort.
>>>
>>> That seems like overkill.
>>>
>>> > For example, I thought whether conditions like the asc order of key information or a desc order could be described.
>>> >
>>> > Regards,
>>> > Tomo
>>> >
>>> > On Tue, 28 Feb 2012 12:36:00 +1100
>>> > Andrew Beekhof <andrew at beekhof.net> wrote:
>>> >
>>> >> 2012/2/28  <nozawat at gmail.com>:
>>> >> > Hi Andrew,
>>> >> >
>>> >> >> Basically the order comes from how they are listed in the xml.
>>> >> >> We could sort it if you like.
>>> >> > Can I set the configuration file and a parameter?
>>> >>
>>> >> I'm confused. Can you rephrase this?
>>> >>
>>> >> > Or do I edit xml file?
>>> >>
>>> >> That would also work.
>>> >>
>>> >> >
>>> >> > Regards,
>>> >> > Tomo
>>> >> >
>>> >> > On Mon, 27 Feb 2012 23:01:56 +1100
>>> >> > Andrew Beekhof <andrew at beekhof.net> wrote:
>>> >> >
>>> >> >> On Wed, Feb 22, 2012 at 3:47 PM, nozawat <nozawat at gmail.com> wrote:
>>> >> >> > Hi
>>> >> >> >
>>> >> >> > My environment is as follows.
>>> >> >> > Pacemaker-1.0.11+Heartbeat-3.0.5
>>> >> >> > I constitute a cluster in node-A and node-B.
>>> >> >> >
>>> >> >> > There is not the file in the following directories.
>>> >> >> > /var/lib/heartbeat
>>> >> >> > /var/lib/heartbeat/crm
>>> >> >> >
>>> >> >> > Therefore indication of crm_mon is as follows when I start 2 nodes at
>>> >> >> > the same time.
>>> >> >> > ------ crm_mon -----
>>> >> >> > ============
>>> >> >> > Last updated: XXX XXX XX XX:XX:XX XXXX
>>> >> >> > Stack: Heartbeat
>>> >> >> > Current DC: node-B (841b433a-70f1-483f-a80f-790f2026fd9d) - partition
>>> >> >> > with quorum
>>> >> >> > Version: 1.0.11-1554a83db0d3c3e546cfd3aaff6af1184f79ee87
>>> >> >> > 2 Nodes configured, unknown expected votes
>>> >> >> > 0 Resources configured.
>>> >> >> > ============
>>> >> >> >
>>> >> >> > Online: [ node-B node-A ]
>>> >> >> > --------------------------
>>> >> >> > View order may be reversed with other machines.
>>> >> >> > The indication order seems to be based on information of cib.
>>> >> >> >
>>> >> >> > Therefore it is a question.
>>> >> >> > What is the condition of the view order of crm_mon?
>>> >> >>
>>> >> >> Basically the order comes from how they are listed in the xml.
>>> >> >> We could sort it if you like.
>>> >> >>
>>> >> >> >
>>> >> >> > Regards,
>>> >> >> > Tomo
>>> >> >> >
>>> >> >> > _______________________________________________
>>> >> >> > 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://bugs.clusterlabs.org
>>> >> >>
>>> >> >> _______________________________________________
>>> >> >> 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://bugs.clusterlabs.org
>>> >> >
>>> >> > _______________________________________________
>>> >> > 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://bugs.clusterlabs.org
>>> >>
>>> >> _______________________________________________
>>> >> 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://bugs.clusterlabs.org
>>> >
>>> > _______________________________________________
>>> > 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://bugs.clusterlabs.org
>>>
>>> _______________________________________________
>>> 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://bugs.clusterlabs.org
>>
>>
>> _______________________________________________
>> 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://bugs.clusterlabs.org




More information about the Pacemaker mailing list