Send Linux-ha-cvs mailing list submissions to linux-ha-cvs@lists.linux-ha.org
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: crm by andrew from (linux-ha-cvs@lists.linux-ha.org) 2. Linux-HA CVS: crm by andrew from (linux-ha-cvs@lists.linux-ha.org) 3. Linux-HA CVS: crm by andrew from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Fri, 5 May 2006 06:52:44 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org 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/admin Modified Files: cibadmin.c Log Message: Make -U an alias for -M... -M is the behaviour people are expecting anyway -C should be used to create objects =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/admin/cibadmin.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -3 -r1.50 -r1.51 --- cibadmin.c 2 May 2006 10:10:58 -0000 1.50 +++ cibadmin.c 5 May 2006 12:52:43 -0000 1.51 @@ -1,4 +1,4 @@ -/* $Id: cibadmin.c,v 1.50 2006/05/02 10:10:58 andrew Exp $ */ +/* $Id: cibadmin.c,v 1.51 2006/05/05 12:52:43 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> @@ -194,8 +194,6 @@ cib_action = CIB_OP_SYNC; break; case 'U': - cib_action = CIB_OP_UPDATE; - break; case 'M': cib_action = CIB_OP_MODIFY; break; ------------------------------ Message: 2 Date: Fri, 5 May 2006 06:53:36 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org 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/admin Modified Files: crm_resource.c Log Message: A fallback for -C if the resource has been deleted =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/admin/crm_resource.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -3 -r1.23 -r1.24 --- crm_resource.c 3 May 2006 09:01:52 -0000 1.23 +++ crm_resource.c 5 May 2006 12:53:35 -0000 1.24 @@ -1,4 +1,4 @@ -/* $Id: crm_resource.c,v 1.23 2006/05/03 09:01:52 andrew Exp $ */ +/* $Id: crm_resource.c,v 1.24 2006/05/05 12:53:35 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> @@ -266,7 +266,8 @@ static int delete_lrm_rsc( - IPC_Channel *crmd_channel, const char *host_uname, const char *rsc_id) + IPC_Channel *crmd_channel, const char *host_uname, + const char *rsc_id, const char *rsc_long_id) { HA_Message *cmd = NULL; crm_data_t *msg_data = NULL; @@ -281,6 +282,7 @@ rsc = create_xml_node(msg_data, XML_CIB_TAG_RESOURCE); crm_xml_add(rsc, XML_ATTR_ID, rsc_id); + crm_xml_add(rsc, XML_ATTR_ID_LONG, rsc_long_id); params = create_xml_node(msg_data, XML_TAG_ATTRS); crm_xml_add(params, XML_ATTR_CRM_VERSION, CRM_FEATURE_SET); @@ -636,7 +638,8 @@ rsc = pe_find_resource(data_set.resources, rsc_id); if(rsc != NULL) { rsc_id = rsc->id; - } else { + + } else if(rsc_cmd != 'C') { rc = cib_NOTEXISTS; } @@ -771,11 +774,13 @@ } else if(rsc_cmd == 'C') { resource_t *rsc = pe_find_resource(data_set.resources, rsc_id); if(rsc != NULL) { - delete_lrm_rsc(crmd_channel, host_uname, rsc->graph_name); + delete_lrm_rsc(crmd_channel, host_uname, rsc->id, rsc->long_name); sleep(10); refresh_lrm(crmd_channel, host_uname); } else { - rc = cib_NOTEXISTS; + delete_lrm_rsc(crmd_channel, host_uname, rsc_id, NULL); + sleep(10); + refresh_lrm(crmd_channel, host_uname); } } else { ------------------------------ Message: 3 Date: Fri, 5 May 2006 06:54:34 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org 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/cib Modified Files: messages.c Log Message: Allow replace to work on any object in the CIB not only entire sections =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/messages.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -3 -r1.75 -r1.76 --- messages.c 20 Apr 2006 15:43:23 -0000 1.75 +++ messages.c 5 May 2006 12:54:33 -0000 1.76 @@ -1,4 +1,4 @@ -/* $Id: messages.c,v 1.75 2006/04/20 15:43:23 andrew Exp $ */ +/* $Id: messages.c,v 1.76 2006/05/05 12:54:33 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -61,9 +61,6 @@ crm_data_t *local_cib, crm_data_t *update_command, crm_data_t *failed, int operation, const char *section); -enum cib_errors replace_section( - const char *section, crm_data_t *tmpCib, crm_data_t *command); - gboolean check_generation(crm_data_t *newCib, crm_data_t *oldCib); gboolean update_results( @@ -477,6 +474,7 @@ const char *op, int options, const char *section, crm_data_t *input, crm_data_t *existing_cib, crm_data_t **result_cib, crm_data_t **answer) { + const char *tag = NULL; gboolean send_notify = FALSE; gboolean verbose = FALSE; enum cib_errors result = cib_ok; @@ -485,17 +483,23 @@ op, crm_str(section)); *answer = NULL; + if (input == NULL) { + return cib_NOOBJECT; + } + + tag = crm_element_name(input); + if (options & cib_verbose) { verbose = TRUE; } if(safe_str_eq(XML_CIB_TAG_SECTION_ALL, section)) { section = NULL; + + } else if(safe_str_eq(tag, section)) { + section = NULL; } - if (input == NULL) { - result = cib_NOOBJECT; - - } else if(section == NULL) { + if(safe_str_eq(tag, XML_TAG_CIB)) { int updates = 0; int epoch = 0; int admin_epoch = 0; @@ -515,6 +519,7 @@ } else if(replace_admin_epoch > admin_epoch) { /* no more checks */ + } else if(replace_epoch < epoch) { reason = XML_ATTR_GENERATION; @@ -538,10 +543,14 @@ send_notify = TRUE; } else { + crm_data_t *obj_root = NULL; *result_cib = copy_xml(existing_cib); - result = replace_section(section, *result_cib, input); + obj_root = get_object_root(section, *result_cib); + if(replace_xml_child(NULL, obj_root, input, FALSE) == FALSE) { + crm_debug_2("No matching object to replace"); + result = cib_NOTEXISTS; - if(safe_str_eq(section, XML_CIB_TAG_STATUS)) { + } else if(safe_str_eq(section, XML_CIB_TAG_STATUS)) { send_notify = TRUE; } } @@ -579,7 +588,7 @@ crm_validate_data(input); crm_validate_data(*result_cib); - if(delete_xml_child(NULL, obj_root, input) == FALSE) { + if(replace_xml_child(NULL, obj_root, input, TRUE) == FALSE) { crm_debug_2("No matching object to delete"); } @@ -711,42 +720,6 @@ return result; } - -enum cib_errors -replace_section( - const char *section, crm_data_t *tmpCib, crm_data_t *new_section) -{ - crm_data_t *old_section = NULL; - - /* find the old and new versions of the section */ - old_section = get_object_root(section, tmpCib); - - if(old_section == NULL) { - crm_err("The CIB is corrupt, cannot replace missing section %s", - section); - return cib_NOSECTION; - - } else if(new_section == NULL) { - crm_err("The CIB is corrupt, cannot set section %s to nothing", - section); - return cib_NOSECTION; - } - - xml_child_iter( - old_section, a_child, - free_xml_from_parent(old_section, a_child); - ); - - copy_in_properties(old_section, new_section); - - xml_child_iter( - new_section, a_child, - add_node_copy(old_section, a_child); - ); - - return cib_ok; -} - #define cib_update_xml_macro(parent, xml_update) \ if(operation == CIB_UPDATE_OP_DELETE) { \ rc = delete_cib_object(parent, xml_update); \ ------------------------------ _______________________________________________ Linux-ha-cvs mailing list Linux-ha-cvs@lists.linux-ha.org http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs End of Linux-ha-cvs Digest, Vol 30, Issue 9 *******************************************