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: mgmt by zhenh from
([email protected])
2. Linux-HA CVS: mgmt by zhenh from
([email protected])
3. Linux-HA CVS: mgmt by zhenh from
([email protected])
4. Linux-HA CVS: debian by zhenh from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Thu, 11 May 2006 00:25:44 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: mgmt by zhenh from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : zhenh
Host :
Project : linux-ha
Module : mgmt
Dir : linux-ha/mgmt/daemon
Modified Files:
mgmt_crm.c
Log Message:
move resource up or down in group
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/mgmt/daemon/mgmt_crm.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- mgmt_crm.c 11 May 2006 05:10:21 -0000 1.33
+++ mgmt_crm.c 11 May 2006 06:25:43 -0000 1.34
@@ -61,6 +61,7 @@
static char* on_del_rsc(char* argv[], int argc);
static char* on_cleanup_rsc(char* argv[], int argc);
static char* on_add_rsc(char* argv[], int argc);
+static char* on_move_rsc(char* argv[], int argc);
static char* on_add_grp(char* argv[], int argc);
static char* on_update_clone(char* argv[], int argc);
@@ -102,15 +103,14 @@
static resource_t* get_parent(resource_t* child);
static int get_fix(const char* rsc_id, char* prefix, char* suffix);
static const char* get_rsc_tag(resource_t* rsc);
+static int cl_msg_swap_offset(struct ha_msg* msg, int offset1, int offset2);
pe_working_set_t* cib_cached = NULL;
int cib_cache_enable = FALSE;
-#define GET_RESOURCE() if (argc != 2) { \
- return cl_strdup(MSG_FAIL"\nwrong parameter number"); \
- } \
- rsc = pe_find_resource(data_set->resources, argv[1]); \
+#define GET_RESOURCE() rsc = pe_find_resource(data_set->resources, argv[1]);
\
if (rsc == NULL) { \
+ free_data_set(data_set); \
return cl_strdup(MSG_FAIL"\nno such resource"); \
}
@@ -358,6 +358,7 @@
reg_msg(MSG_DEL_RSC, on_del_rsc);
reg_msg(MSG_CLEANUP_RSC, on_cleanup_rsc);
reg_msg(MSG_ADD_RSC, on_add_rsc);
+ reg_msg(MSG_MOVE_RSC, on_move_rsc);
reg_msg(MSG_ADD_GRP, on_add_grp);
reg_msg(MSG_ALL_RSC, on_get_all_rsc);
@@ -869,6 +870,106 @@
return cl_strdup(MSG_OK);
}
+
+int
+cl_msg_swap_offset(struct ha_msg* msg, int offset1, int offset2)
+{
+ char* name;
+ int nlen;
+ void* value;
+ int vlen;
+ int type;
+
+ name = msg->names[offset1];
+ nlen = msg->nlens[offset1];
+ value = msg->values[offset1];
+ vlen = msg->vlens[offset1];
+ type = msg->types[offset1];
+
+ msg->names[offset1] = msg->names[offset2];
+ msg->nlens[offset1] = msg->nlens[offset2];
+ msg->values[offset1] = msg->values[offset2];
+ msg->vlens[offset1] = msg->vlens[offset2];
+ msg->types[offset1] = msg->types[offset2];
+
+ msg->names[offset2] = name;
+ msg->nlens[offset2] = nlen;
+ msg->values[offset2] = value;
+ msg->vlens[offset2] = vlen;
+ msg->types[offset2] = type;
+
+ return HA_OK;
+}
+
+char*
+on_move_rsc(char* argv[], int argc)
+{
+ int i, rc, pos = -1;
+ int first_child = -1;
+ int last_child = -1;
+ const char* child_id;
+ struct ha_msg* child;
+ resource_t* rsc;
+ resource_t* parent;
+ pe_working_set_t* data_set;
+ crm_data_t* output = NULL;
+
+ data_set = get_data_set();
+ GET_RESOURCE()
+ parent = get_parent(rsc);
+ if (parent == NULL || parent->variant != pe_group) {
+ free_data_set(data_set);
+ return cl_strdup(MSG_FAIL);
+ }
+ for (i=0; i < parent->xml->nfields ; i++){
+ if (STRNCMP_CONST(parent->xml->names[i], "primitive")!=0) {
+ continue;
+ }
+ child = (struct ha_msg*)parent->xml->values[i];
+ if (first_child == -1) {
+ first_child = i;
+ }
+ last_child = i;
+ child_id = ha_msg_value(child,"id");
+ if (strcmp(child_id, argv[1]) == 0) {
+ mgmt_log(LOG_INFO,"find %s !",child_id);
+ pos = i;
+ }
+ }
+ if (STRNCMP_CONST(argv[2],"up")==0) {
+ if (pos-1<first_child) {
+ free_data_set(data_set);
+ return cl_strdup(MSG_FAIL);
+ }
+ cl_msg_swap_offset(parent->xml, pos-1, pos);
+ }
+ if (STRNCMP_CONST(argv[2],"down")==0) {
+ {
+ if (pos+1>last_child) {
+ free_data_set(data_set);
+ return cl_strdup(MSG_FAIL);
+ }
+ cl_msg_swap_offset(parent->xml, pos, pos+1);
+ }
+ else {
+ free_data_set(data_set);
+ return cl_strdup(MSG_FAIL);
+ }
+ mgmt_log(LOG_INFO, "xml:%s",dump_xml_formatted(parent->xml));
+ free_data_set(data_set);
+
+ rc = cib_conn->cmds->variant_op(
+ cib_conn, CIB_OP_REPLACE, NULL,"resources",
+ parent->xml, &output, cib_sync_call);
+
+ if (rc < 0) {
+ return failed_msg(output, rc);
+ }
+ free_xml(output);
+
+ return cl_strdup(MSG_OK);
+}
+
char*
on_add_grp(char* argv[], int argc)
{
------------------------------
Message: 2
Date: Thu, 11 May 2006 00:44:06 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: mgmt by zhenh from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : zhenh
Host :
Project : linux-ha
Module : mgmt
Dir : linux-ha/mgmt/daemon
Modified Files:
mgmt_crm.c
Log Message:
fix a mistype
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/mgmt/daemon/mgmt_crm.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- mgmt_crm.c 11 May 2006 06:25:43 -0000 1.34
+++ mgmt_crm.c 11 May 2006 06:44:06 -0000 1.35
@@ -944,7 +944,6 @@
cl_msg_swap_offset(parent->xml, pos-1, pos);
}
if (STRNCMP_CONST(argv[2],"down")==0) {
- {
if (pos+1>last_child) {
free_data_set(data_set);
return cl_strdup(MSG_FAIL);
------------------------------
Message: 3
Date: Thu, 11 May 2006 00:44:51 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: mgmt by zhenh from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : zhenh
Host :
Project : linux-ha
Module : mgmt
Dir : linux-ha/mgmt/daemon
Modified Files:
mgmt_crm.c
Log Message:
fix a mistype
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/mgmt/daemon/mgmt_crm.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- mgmt_crm.c 11 May 2006 06:44:06 -0000 1.35
+++ mgmt_crm.c 11 May 2006 06:44:51 -0000 1.36
@@ -943,7 +943,7 @@
}
cl_msg_swap_offset(parent->xml, pos-1, pos);
}
- if (STRNCMP_CONST(argv[2],"down")==0) {
+ else if (STRNCMP_CONST(argv[2],"down")==0) {
if (pos+1>last_child) {
free_data_set(data_set);
return cl_strdup(MSG_FAIL);
------------------------------
Message: 4
Date: Thu, 11 May 2006 01:02:49 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: debian by zhenh from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : zhenh
Host :
Project : linux-ha
Module : debian
Dir : linux-ha/debian
Modified Files:
heartbeat-2.files
Log Message:
move resource up or down in group in GUI
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/debian/heartbeat-2.files,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- heartbeat-2.files 9 May 2006 06:03:07 -0000 1.14
+++ heartbeat-2.files 11 May 2006 07:02:48 -0000 1.15
@@ -69,6 +69,7 @@
usr/lib/heartbeat/cts/OCFMSDummy
usr/lib/heartbeat/cts/extracttests.py
usr/lib/heartbeat/default-resource.png
+usr/lib/heartbeat/down-resource.png
usr/lib/heartbeat/exit.png
usr/lib/heartbeat/findif
usr/lib/heartbeat/ha.png
@@ -137,6 +138,7 @@
usr/lib/heartbeat/stop-resource.png
usr/lib/heartbeat/tengine
usr/lib/heartbeat/ttest
+usr/lib/heartbeat/up-resource.png
usr/lib/libapphb.so.0
usr/lib/libapphb.so.0.0.0
usr/lib/libccmclient.so.1
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 30, Issue 29
********************************************