Send Linux-ha-cvs mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."
Today's Topics:
1. Linux-HA CVS: lib by andrew from
([email protected])
2. Linux-HA CVS: cts by andrew from
([email protected])
3. Linux-HA CVS: crm by andrew from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Sun, 9 Apr 2006 08:38:31 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : lib
Dir : linux-ha/lib/crm/common
Modified Files:
xml.c
Log Message:
Cleanup do_id_check()
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/xml.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -3 -r1.70 -r1.71
--- xml.c 9 Apr 2006 12:55:44 -0000 1.70
+++ xml.c 9 Apr 2006 14:38:31 -0000 1.71
@@ -1,4 +1,4 @@
-/* $Id: xml.c,v 1.70 2006/04/09 12:55:44 andrew Exp $ */
+/* $Id: xml.c,v 1.71 2006/04/09 14:38:31 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -2217,19 +2217,10 @@
crm_free(new_uuid_s);
}
-gboolean
-do_id_check(crm_data_t *xml_obj, GHashTable *id_hash)
+static gboolean
+tag_needs_id(const char *tag_name)
{
int lpc = 0;
- char *lookup_id = NULL;
- gboolean modified = FALSE;
-
- const char *tag_id = NULL;
- const char *tag_name = NULL;
- const char *lookup_value = NULL;
-
- gboolean created_hash = FALSE;
-
const char *allowed_list[] = {
XML_TAG_CIB,
XML_TAG_FRAGMENT,
@@ -2237,17 +2228,50 @@
XML_CIB_TAG_RESOURCES,
XML_CIB_TAG_CONSTRAINTS,
XML_CIB_TAG_STATUS,
- XML_CIB_TAG_LRM,
XML_LRM_TAG_RESOURCES,
- XML_TAG_PARAMS,
"operations",
};
+
+ for(lpc = 0; lpc < DIMOF(allowed_list); lpc++) {
+ if(safe_str_eq(tag_name, allowed_list[lpc])) {
+ /* this tag is never meant to have an ID */
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+static gboolean
+non_unique_allowed(const char *tag_name)
+{
+ int lpc = 0;
const char *non_unique[] = {
XML_LRM_TAG_RESOURCE,
XML_LRM_TAG_RSC_OP,
};
-
+
+ for(lpc = 0; lpc < DIMOF(non_unique); lpc++) {
+ if(safe_str_eq(tag_name, non_unique[lpc])) {
+ /* this tag can have a non-unique ID */
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+gboolean
+do_id_check(crm_data_t *xml_obj, GHashTable *id_hash)
+{
+ char *lookup_id = NULL;
+ gboolean modified = FALSE;
+
+ char *old_id = NULL;
+ const char *tag_id = NULL;
+ const char *tag_name = NULL;
+ const char *lookup_value = NULL;
+
+ gboolean created_hash = FALSE;
+
if(xml_obj == NULL) {
return FALSE;
@@ -2267,60 +2291,55 @@
tag_id = ID(xml_obj);
tag_name = TYPE(xml_obj);
+ if(tag_id != NULL) {
+ old_id = crm_strdup(tag_id);
+ }
xml_prop_iter(
xml_obj, local_prop_name, local_prop_value,
+
+ if(tag_needs_id(tag_name) == FALSE) {
+ break;
+
+ } else if(tag_id != NULL && non_unique_allowed(tag_name)){
+ break;
- if(safe_str_eq(local_prop_name, XML_DIFF_MARKER)) {
+ } else if(safe_str_eq(local_prop_name, XML_DIFF_MARKER)) {
crm_err("Detected "XML_DIFF_MARKER" attribute");
continue;
}
-
+
lookup_id = NULL;
- if(ID(xml_obj) != NULL) {
- for(lpc = 0; lpc < DIMOF(non_unique); lpc++) {
- if(safe_str_eq(tag_name, non_unique[lpc])) {
- /* this tag can have a non-unique ID */
- break;
- }
- }
- if(lpc < DIMOF(non_unique)) {
- break;
- }
+ if(tag_id != NULL) {
lookup_id = crm_concat(tag_name, tag_id, '-');
lookup_value = g_hash_table_lookup(id_hash, lookup_id);
- if(lookup_value != NULL) {
- char *old_id = crm_strdup(tag_id);
- modified = TRUE;
- assign_uuid(xml_obj);
- tag_id = ID(xml_obj);
- crm_err("\"id\" collision detected..."
- " Multiple '%s' entries with id=\"%s\","
- " assigned id=\"%s\"",
- tag_name, old_id, tag_id);
- }
- g_hash_table_insert(
- id_hash, lookup_id, crm_strdup(tag_id));
- break;
- }
-
- for(lpc = 0; lpc < DIMOF(allowed_list); lpc++) {
- if(safe_str_eq(tag_name, allowed_list[lpc])) {
- /* this tag is never meant to have an ID */
+ if(lookup_value == NULL) {
+ g_hash_table_insert(
+ id_hash, lookup_id, crm_strdup(tag_id));
break;
}
}
- if(lpc < DIMOF(allowed_list)) {
- break;
- }
+
modified = TRUE;
- crm_err("%s object with attributes but no ID field detected.",
- tag_name);
+ crm_free(lookup_id);
assign_uuid(xml_obj);
+ tag_id = ID(xml_obj);
+
+ /* the first attribute was enough to do everything needed */
break;
-
);
+ if(safe_str_neq(tag_id, old_id)) {
+ crm_err("\"id\" collision detected... Multiple '%s' entries"
+ " with id=\"%s\", assigned id=\"%s\"",
+ tag_name, old_id, tag_id);
+
+ } else if(old_id == NULL &&& tag_id != NULL) {
+ crm_err("Detected <%s.../> with attributes but no ID field",
+ tag_name);
+ }
+ crm_free(old_id);
+
if(created_hash) {
g_hash_table_destroy(id_hash);
}
------------------------------
Message: 2
Date: Sun, 9 Apr 2006 08:39:55 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: cts by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : cts
Dir : linux-ha/cts
Modified Files:
CIB.py.in
Log Message:
Make sure the id is unique
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cts/CIB.py.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- CIB.py.in 9 Apr 2006 13:15:11 -0000 1.11
+++ CIB.py.in 9 Apr 2006 14:39:54 -0000 1.12
@@ -146,7 +146,7 @@
<op id="%s-1" name="monitor" interval="5s" timeout="20s"/>
<op id="%s-2" name="start" timeout="40s"/>
</operations>
- <instance_attributes id="ip-2">
+ <instance_attributes id="%s">
<attributes>
<nvpair id="%s-1" name="ip" value="%s"/>
</attributes>
@@ -233,7 +233,7 @@
for node in self.CM.Env["nodes"]:
ip = self.NextIP()
per_node_resources = self.per_node_resource_template % \
- ("rsc_"+node, "rsc_"+node, "rsc_"+node, "rsc_"+node, ip)
+ ("rsc_"+node, "rsc_"+node, "rsc_"+node, "rsc_"+node,
"rsc_"+node, ip)
per_node_constraint = self.per_node_constraint_template % \
("rsc_"+node, "rsc_"+node, "rsc_"+node, "rsc_"+node, node)
------------------------------
Message: 3
Date: Sun, 9 Apr 2006 08:49:33 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: crm by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : crm
Dir : linux-ha/crm/crmd
Modified Files:
lrm.c
Log Message:
Include an ID for <lrm> tags
Use the DC's version when constructing resource updates
- fall back to the one stored in the operation if the is no DC set
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/lrm.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -3 -r1.181 -r1.182
--- lrm.c 5 Apr 2006 13:42:23 -0000 1.181
+++ lrm.c 9 Apr 2006 14:49:33 -0000 1.182
@@ -344,8 +344,11 @@
return TRUE;
}
- caller_version = g_hash_table_lookup(op->params, XML_ATTR_CRM_VERSION);
- crm_debug_3("Caller version: %s", caller_version);
+ caller_version = fsa_our_dc_version;
+ CRM_CHECK(fsa_our_dc_version != NULL,
+ caller_version = g_hash_table_lookup(
+ op->params, XML_ATTR_CRM_VERSION));
+ crm_debug_3("DC version: %s", caller_version);
if(safe_str_eq(op->op_type, CRMD_ACTION_NOTIFY)) {
const char *n_type = g_hash_table_lookup(
@@ -663,6 +666,7 @@
!shut_down, __FUNCTION__);
xml_data = create_xml_node(xml_state, XML_CIB_TAG_LRM);
+ crm_xml_add(xml_data, XML_ATTR_ID, fsa_our_uuid);
rsc_list = create_xml_node(xml_data, XML_LRM_TAG_RESOURCES);
/* Build a list of active (not always running) resources */
@@ -1027,6 +1031,7 @@
fsa_our_uname, NULL, NULL, NULL, NULL, NULL, FALSE,
__FUNCTION__);
iter = create_xml_node(update, XML_CIB_TAG_LRM);
+ crm_xml_add(iter, XML_ATTR_ID, fsa_our_uuid);
iter = create_xml_node(iter, XML_LRM_TAG_RESOURCES);
iter = create_xml_node(iter, XML_LRM_TAG_RESOURCE);
@@ -1358,6 +1363,7 @@
fsa_our_uname, NULL, NULL, NULL, NULL, NULL, FALSE,
__FUNCTION__);
iter = create_xml_node(update, XML_CIB_TAG_LRM);
+ crm_xml_add(iter, XML_ATTR_ID, fsa_our_uuid);
iter = create_xml_node(iter, XML_LRM_TAG_RESOURCES);
iter = create_xml_node(iter, XML_LRM_TAG_RESOURCE);
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 29, Issue 45
********************************************