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: crm by andrew from
([email protected])
2. Linux-HA CVS: crm by andrew from
([email protected])
3. Linux-HA CVS: crm by andrew from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Wed, 18 Jan 2006 13:08:31 -0700 (MST)
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/pengine
Modified Files:
unpack.c
Log Message:
Look for cluster preferences by name not id
Fix the spelling of symmetric in some test cases
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/unpack.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -3 -r1.152 -r1.153
--- unpack.c 10 Jan 2006 13:46:41 -0000 1.152
+++ unpack.c 18 Jan 2006 20:08:31 -0000 1.153
@@ -1,4 +1,4 @@
-/* $Id: unpack.c,v 1.152 2006/01/10 13:46:41 andrew Exp $ */
+/* $Id: unpack.c,v 1.153 2006/01/18 20:08:31 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -212,10 +212,19 @@
param_value(GHashTable *hash, crm_data_t * parent, const char *name)
{
const char *value = NULL;
+ const char *pref_name = NULL;
crm_data_t * a_default = NULL;
if(parent != NULL) {
- a_default = find_entity(parent, XML_CIB_TAG_NVPAIR, name);
+ crm_validate_data(parent);
+ xml_child_iter_filter(
+ parent, a_child, XML_CIB_TAG_NVPAIR,
+ pref_name = crm_element_value(a_child,
XML_NVPAIR_ATTR_NAME);
+ if(safe_str_eq(name, pref_name)) {
+ a_default = a_child;
+ break;
+ }
+ );
}
if(a_default == NULL) {
------------------------------
Message: 2
Date: Wed, 18 Jan 2006 13:08:32 -0700 (MST)
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/pengine/testcases
Modified Files:
attrs3.xml attrs5.xml rsc_dep10.xml
Log Message:
Look for cluster preferences by name not id
Fix the spelling of symmetric in some test cases
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/testcases/attrs3.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- attrs3.xml 6 Jul 2005 12:36:45 -0000 1.10
+++ attrs3.xml 18 Jan 2006 20:08:31 -0000 1.11
@@ -3,7 +3,7 @@
<cib>
<configuration>
<crm_config>
- <nvpair id="symmetric_cluster" name="symetric_cluster" value="false"/>
+ <nvpair id="symmetric_cluster" name="symmetric_cluster" value="false"/>
<nvpair id="no_quorum_policy" name="no_quorum_policy" value="ignore"/>
</crm_config>
<nodes>
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/testcases/attrs5.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- attrs5.xml 6 Jul 2005 12:36:45 -0000 1.11
+++ attrs5.xml 18 Jan 2006 20:08:31 -0000 1.12
@@ -3,7 +3,7 @@
<cib>
<configuration>
<crm_config>
- <nvpair id="symmetric_cluster" name="symetric_cluster" value="false"/>
+ <nvpair id="symmetric_cluster" name="symmetric_cluster" value="false"/>
<nvpair id="no_quorum_policy" name="no_quorum_policy" value="ignore"/>
</crm_config>
<nodes>
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/testcases/rsc_dep10.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- rsc_dep10.xml 6 Jul 2005 12:36:46 -0000 1.9
+++ rsc_dep10.xml 18 Jan 2006 20:08:31 -0000 1.10
@@ -4,7 +4,7 @@
<cib>
<configuration>
<crm_config>
- <nvpair id="symmetric_cluster" name="symetric_cluster" value="false"/>
+ <nvpair id="symmetric_cluster" name="symmetric_cluster" value="false"/>
<nvpair id="no_quorum_policy" name="no_quorum_policy" value="ignore"/>
</crm_config>
<nodes>
------------------------------
Message: 3
Date: Thu, 19 Jan 2006 08:37:51 -0700 (MST)
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/admin
Modified Files:
crm_resource.c
Log Message:
Add the ability to get a resource's value for a named parameter or property
(Properties are things like type, class, is_managed. Anything at the same
level as its id field)
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/admin/crm_resource.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- crm_resource.c 13 Nov 2005 21:46:58 -0000 1.9
+++ crm_resource.c 19 Jan 2006 15:37:50 -0000 1.10
@@ -1,4 +1,4 @@
-/* $Id: crm_resource.c,v 1.9 2005/11/13 21:46:58 andrew Exp $ */
+/* $Id: crm_resource.c,v 1.10 2006/01/19 15:37:50 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
@@ -65,7 +65,7 @@
char *our_pid = NULL;
IPC_Channel *crmd_channel = NULL;
-#define OPTARGS "V?SLRQDCPp:WMUr:H:v:t:"
+#define OPTARGS "V?SLRQDCPp:WMUr:H:v:t:g:G:g:"
static int
do_find_resource(const char *rsc, pe_working_set_t *data_set)
@@ -141,6 +141,68 @@
return 1;
}
+static int
+dump_resource_attr(
+ const char *rsc, const char *attr, pe_working_set_t *data_set)
+{
+ crm_data_t *attrs = create_xml_node(NULL, "fake");
+ node_t *current = NULL;
+ resource_t *the_rsc = pe_find_resource(data_set->resources, rsc);
+ const char *value = NULL;
+
+ if(the_rsc == NULL) {
+ return cib_NOTEXISTS;
+ }
+
+ if(g_list_length(the_rsc->running_on) == 1) {
+ current = the_rsc->running_on->data;
+
+ } else if(g_list_length(the_rsc->running_on) > 1) {
+ fprintf(stderr, "%s is active on more than one node,"
+ " returning the default value for %s\n",
+ the_rsc->id, value);
+ }
+
+ unpack_instance_attributes(
+ the_rsc->xml, XML_TAG_ATTR_SETS, current, the_rsc->parameters,
+ NULL, 0, data_set);
+
+ if(the_rsc->parameters != NULL) {
+ crm_debug("Looking up %s in %s", attr, the_rsc->id);
+ value = g_hash_table_lookup(the_rsc->parameters, attr);
+ }
+ if(value != NULL) {
+ fprintf(stdout, "%s\n", value);
+ return 1;
+
+ } else {
+ /* debug */
+ g_hash_table_foreach(the_rsc->parameters, hash2field, attrs);
+ }
+ return cib_NOTEXISTS;
+}
+
+
+static int
+dump_resource_prop(
+ const char *rsc, const char *attr, pe_working_set_t *data_set)
+{
+ const char *value = NULL;
+ resource_t *the_rsc = pe_find_resource(data_set->resources, rsc);
+
+ if(the_rsc == NULL) {
+ return cib_NOTEXISTS;
+ }
+
+ value = crm_element_value(the_rsc->xml, attr);
+
+ if(value != NULL) {
+ fprintf(stdout, "%s\n", value);
+ return 1;
+ }
+ return cib_NOTEXISTS;
+}
+
static void
resource_ipc_connection_destroy(gpointer user_data)
{
@@ -375,6 +437,8 @@
{"locate", 0, 0, 'W'},
{"migrate", 0, 0, 'M'},
{"un-migrate", 0, 0, 'U'},
+ {"get-parameter",1, 0, 'G'},
+ {"get-property",1, 0, 'g'},
{"resource",1, 0, 'r'},
{"host-uname", 1, 0, 'H'},
{"host-uuid", 1, 0, 'h'},
@@ -446,6 +510,18 @@
prop_name = optarg;
rsc_cmd = flag;
break;
+
+ case 'g':
+ crm_debug_2("Option %c => %s", flag, optarg);
+ prop_name = optarg;
+ rsc_cmd = flag;
+ break;
+
+ case 'G':
+ crm_debug_2("Option %c => %s", flag, optarg);
+ prop_name = optarg;
+ rsc_cmd = flag;
+ break;
case 'W':
rsc_cmd = flag;
@@ -518,9 +594,11 @@
}
if(rsc_cmd == 'L' || rsc_cmd == 'W' || rsc_cmd == 'D' || rsc_cmd == 'Q'
- || rsc_cmd == 'p' || rsc_cmd == 'M' || rsc_cmd == 'U') {
+ || rsc_cmd == 'p' || rsc_cmd == 'M' || rsc_cmd == 'U'
+ || rsc_cmd == 'G' || rsc_cmd == 'g') {
cib_conn = cib_new();
- rc = cib_conn->cmds->signon(cib_conn, crm_system_name,
cib_command);
+ rc = cib_conn->cmds->signon(
+ cib_conn, crm_system_name, cib_command);
set_working_set_defaults(&data_set);
if(rsc_cmd != 'D' && rsc_cmd != 'U') {
@@ -554,6 +632,14 @@
CRM_DEV_ASSERT(rsc_id != NULL);
rc = dump_resource(rsc_id, &data_set);
+ } else if(rsc_cmd == 'G') {
+ CRM_DEV_ASSERT(rsc_id != NULL);
+ rc = dump_resource_attr(rsc_id, prop_name, &data_set);
+
+ } else if(rsc_cmd == 'g') {
+ CRM_DEV_ASSERT(rsc_id != NULL);
+ rc = dump_resource_prop(rsc_id, prop_name, &data_set);
+
} else if(rsc_cmd == 'U') {
rc = migrate_resource(rsc_id, NULL, NULL, cib_conn);
@@ -696,7 +782,13 @@
fprintf(stream, "\t--%s (-%c)\t: Refresh the CIB from the LRM\n"
"\t\t\t Optional: -H\n", "refresh", 'R');
fprintf(stream, "\t--%s (-%c) <string>\t: "
- "Set the named property for a resource\n"
+ "Get the named parameter for a resource\n"
+ "\t\t\t Requires: -r\n", "get-parameter", 'G');
+ fprintf(stream, "\t--%s (-%c) <string>\t: "
+ "Get the named property (eg. class, type, is_managed) a
resource\n"
+ "\t\t\t Requires: -r\n", "get-property", 'g');
+ fprintf(stream, "\t--%s (-%c) <string>\t: "
+ "Set the named property (not parameter) for a resource\n"
"\t\t\t Requires: -r, -t, -v", "set-property", 'p');
fprintf(stream, "\nOptions\n");
fprintf(stream, "\t--%s (-%c) <string>\t: Resource ID\n", "resource",
'r');
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 26, Issue 45
********************************************