Cluster Project branch, master, updated. gfs-kernel_0_1_22-75-gbee9018
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".
The branch, master has been updated
via bee9018146ab3200d1691621dc4bd648670ece09 (commit)
via 11aa8972e4fcf7524647f55237bd46a7b7489e6b (commit)
from febfaf415cb873716ff5f105f873ec8401607a29 (commit)Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit bee9018146ab3200d1691621dc4bd648670ece09
Author: Christine Caulfield <[email protected]> Date: Tue Mar 18 13:11:47 2008 +0000
[CMAN] Make cman cope with the new objdb structure
Now the /cluster bits are held on the objdb below "cluster" we need to look for everything (well, nearly everything) under there.
Also add a 'cman_tool dump-db' command which is only built in DEBUG mode.
commit 11aa8972e4fcf7524647f55237bd46a7b7489e6b
Author: Christine Caulfield <[email protected]> Date: Tue Mar 18 13:10:22 2008 +0000
[CCS] Fix the config loader for good
We were removing the "/cluster" top level domain to allow /cluster/totem and other random ais bits to be at the top level of the objdb since aisexec expects to find them there.
This is not clean in several way because it would break queries like:
/cluster/child::* by returning a bunch of top levels objdb that are internal to aisexec and we don't want to expose to everybody. This is achieved by doing a few tricks here and there.. best would be to allow objdb symlinking.
First we load the special bits for aisexec at the top level by using the right path within the xml config and then we load (again) the whole configuration.
The final result will have some duplicates entries but for now we can live with that. The overhead is minimal.
-----------------------------------------------------------------------
Summary of changes:
ccs/ccsais/config.c | 46 ++++++--------------------- cman/cman_tool/cman_tool.h | 1 + cman/cman_tool/main.c | 32 ++++++++++++++++++- cman/daemon/cman-preconfig.c | 71 +++++++++++++++++++++++++----------------- cman/daemon/cmanconfig.c | 23 ++++++++----- cman/daemon/cnxman-socket.h | 1 + cman/daemon/commands.c | 16 +++++++++- cman/daemon/nodelist.h | 14 +++++--- cman/lib/libcman.c | 10 ++++++ cman/lib/libcman.h | 3 ++ 10 files changed, 136 insertions(+), 81 deletions(-)
ccs/ccsais/config.c +10 -36
@@ -83,14 +83,14 @@ static int should_alloc(int ccs_fd, char *key)char path[256 ];char *str =NULL ; -sprintf (path,"/cluster/%s/@*" , key); +sprintf (path,"%s/@*" , key); keyerror =ccs_get_list (ccs_fd, path, &str);if (str) {free (str); str =NULL ; } -sprintf (path,"/cluster/%s/child::*" , key); +sprintf (path,"%s/child::*" , key); childerr =ccs_get_list (ccs_fd, path, &str);if (str)free (str);
@@ -116,7 +116,7 @@ static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsignedif (should_alloc (ccs_fd, key) || always_create) objdb->object_create (parent, &object_handle, object,strlen (object)); -sprintf (path,"/cluster/%s/@*" , key); +sprintf (path,"%s/@*" , key);/* Get the keys */ for (;;)
@@ -143,7 +143,7 @@ static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsignedCCS can't cope with recursive queries so we have to store the result of the subkey search */ memset (subkeys,0 ,sizeof (subkeys)); -sprintf (path,"/cluster/%s/child::*" , key); +sprintf (path,"%s/child::*" , key);for (;;) {char *equal;
@@ -229,7 +229,6 @@ static int init_config(struct objdb_iface_ver0 *objdb, char *error_string) {int cd;char *cname =NULL ; -char *str;/* Connect to ccsd */ if (getenv ("CCS_CLUSTER_NAME" )) {
@@ -244,40 +243,15 @@ static int init_config(struct objdb_iface_ver0 *objdb, char *error_string) }/* These first few are just versions of openais.conf */ -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"totem" ,"totem" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"logging" ,"logging" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"event" ,"event" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"aisexec" ,"aisexec" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"amf" ,"amf" ,1 ); +read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"totem" ,"/cluster/totem" ,1 ); +read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"logging" ,"/cluster/logging" ,1 ); +read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"event" ,"/cluster/event" ,1 ); +read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"aisexec" ,"/cluster/aisexec" ,1 ); +read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"amf" ,"/cluster/amf" ,1 );/* This is stuff specific to us, eg quorum device timeout */ -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"cman" ,"cman" ,1 ); - -/* Nodes information */ -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"clusternodes" ,"clusternodes" ,1 ); - -/* all the others */ -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"quorumd" ,"quorumd" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"fence_xvmd" ,"fence_xvmd" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"fencedevices" ,"fencedevices" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"dlm" ,"dlm" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"gfs_controld" ,"gfs_controld" ,1 ); -read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"rm" ,"rm" ,1 ); - -/* Also get cluster name and config version number */ -if (!ccs_get (cd,CONFIG_VERSION_PATH , &str)) { - objdb->object_key_create (OBJECT_PARENT_HANDLE , -"config_version" ,strlen ("config_version" ), - str,strlen (str)+1 ); -free (str); - } +read_config_for (cd, objdb,OBJECT_PARENT_HANDLE ,"cluster" ,"/cluster" ,1 ); -if (!ccs_get (cd,CONFIG_NAME_PATH , &str)) { - objdb->object_key_create (OBJECT_PARENT_HANDLE , -"name" ,strlen ("name" ), - str,strlen (str)+1 ); -free (str); - }ccs_disconnect (cd);return 0 ; }
cman/cman_tool/cman_tool.h +1 -0
@@ -76,6 +76,7 @@ struct commandlinechar *interfaces[MAX_INTERFACES ];char *override_nodename;char *key_filename; +char *filename;char *format_opts;char *config_lcrso;int votes;
cman/cman_tool/main.c +31 -1
@@ -34,6 +34,7 @@#define OP_NODES 9#define OP_SERVICES 10#define OP_DEBUG 11 +#define OP_DUMP_OBJDB 12static void print_usage (int subcmd)
@@ -708,6 +709,19 @@ static void set_debuglog(commandline_t *comline)cman_finish (h); } +#ifdef DEBUG +static void dump_objdb (commandline_t *comline) +{ +cman_handle_t h; + + h =open_cman_handle (1 ); + +if (cman_dump_objdb (h, comline->filename)) +perror ("dump objdb failed" ); + +cman_finish (h); +} +#endif static int get_int_arg (char argopt,char *arg) {
@@ -913,6 +927,18 @@ static void decode_arguments(int argc, char *argv[], commandline_t *comline)if (comline->operation)die ("can't specify two operations" ); comline->operation =OP_DEBUG ; +#ifdef DEBUG + }else if (strcmp (argv[optind],"dump-db" ) ==0 ) { +if (comline->operation) +die ("can't specify two operations" ); + comline->operation =OP_DUMP_OBJDB ; +if (!argv[optind+1 ]) +die ("no filename given" ); + comline->filename =strdup (argv[optind+1 ]); +if (comline->filename[0 ] !='/' ) +die ("dump filename must be an absolute path" ); + optind++; +#endif }else if (strcmp (argv[optind],"remove" ) ==0 ) { comline->remove = TRUE; }else if (strcmp (argv[optind],"force" ) ==0 ) {
@@ -1031,8 +1057,12 @@ int main(int argc, char *argv[])case OP_DEBUG :set_debuglog (&comline);break ; +#ifdef DEBUG +case OP_DUMP_OBJDB : +dump_objdb (&comline); + break; } - +#endif exit (EXIT_SUCCESS ); }
cman/daemon/cman-preconfig.c +42 -29
201 lines not on this page · raw message
cman/daemon/cmanconfig.c +14 -9
@@ -41,6 +41,7 @@ static char cluster_name[MAX_CLUSTER_NAME_LEN + 1];static unsigned int expected_votes;static char *our_nodename;static int our_votes; +static unsigned int cluster_parent_handle;/* Get all the cluster node names from objdb and * add them to our node list.
@@ -58,11 +59,11 @@ int read_cman_nodes(struct objdb_iface_ver0 *objdb, unsigned int *config_versionchar *nodename;/* New config version */ -objdb_get_int (objdb,OBJECT_PARENT_HANDLE ,"config_version" , config_version); +objdb_get_int (objdb, cluster_parent_handle,"config_version" , config_version); - objdb->object_find_reset (OBJECT_PARENT_HANDLE ); + objdb->object_find_reset (cluster_parent_handle); -if (objdb->object_find (OBJECT_PARENT_HANDLE , +if (objdb->object_find (cluster_parent_handle,"cman" ,strlen ("cman" ), &object_handle) ==0 ) {
@@ -77,7 +78,7 @@ int read_cman_nodes(struct objdb_iface_ver0 *objdb, unsigned int *config_versionclear_reread_flags ();/* Get the nodes list */ - nodes_handle =nodeslist_init (objdb, &parent_handle); + nodes_handle =nodeslist_init (objdb, cluster_parent_handle, &parent_handle); do { if (objdb_get_string(objdb, nodes_handle, "name", &nodename)) { log_printf(LOG_ERR, "Cannot get node name");
@@ -149,7 +150,7 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)unsigned int node_object;/* Cluster name */ -if (objdb_get_string (objdb,OBJECT_PARENT_HANDLE ,"name" , &cname)) { +if (objdb_get_string (objdb, cluster_parent_handle,"name" , &cname)) {log_printf (LOG_ERR ,"cannot find cluster name in config file" );write_cman_pipe ("Can't find cluster name in CCS" ); error = -ENOENT ;
@@ -175,7 +176,7 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)unsigned int nodes_handle;unsigned int parent_handle; - nodes_handle =nodeslist_init (objdb, &parent_handle); + nodes_handle =nodeslist_init (objdb, cluster_parent_handle, &parent_handle); do { int votes;
@@ -195,8 +196,8 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb) nodes_handle =nodeslist_next (objdb, parent_handle); }while (nodes_handle); - objdb->object_find_reset (OBJECT_PARENT_HANDLE ); -if (objdb->object_find (OBJECT_PARENT_HANDLE , + objdb->object_find_reset (cluster_parent_handle); +if (objdb->object_find (cluster_parent_handle,"cman" ,strlen ("cman" ), &object_handle) ==0 ) {
@@ -214,7 +215,7 @@ static int get_cman_join_info(struct objdb_iface_ver0 *objdb)log_printf (LOG_INFO ,"Using override votes %d\n" , votes); } - node_object =nodelist_byname (objdb, our_nodename); + node_object =nodelist_byname (objdb, cluster_parent_handle, our_nodename);if (!node_object) {log_printf (LOG_ERR ,"unable to find votes for %s" , our_nodename);write_cman_pipe ("Unable to find votes for node in CCS" );
@@ -291,6 +292,10 @@ int read_cman_config(struct objdb_iface_ver0 *objdb, unsigned int *config_versio {int error; + objdb->object_find_reset (OBJECT_PARENT_HANDLE ); + objdb->object_find (OBJECT_PARENT_HANDLE , +"cluster" ,strlen ("cluster" ), &cluster_parent_handle); +read_cman_nodes (objdb, config_version,1 ); error =get_cman_join_info (objdb);if (error) {
cman/daemon/cnxman-socket.h +1 -0
@@ -54,6 +54,7 @@#define CMAN_CMD_STOP_CONFCHG 0x000000c1#define CMAN_CMD_SET_DIRTY 0x800000c2#define CMAN_CMD_SET_DEBUGLOG 0x800000c3 +#define CMAN_CMD_DUMP_OBJDB 0x800000c4#define CMAN_CMD_DATA 0x00000100#define CMAN_CMD_BIND 0x00000101
cman/daemon/commands.c +15 -1
@@ -1230,6 +1230,7 @@ int process_command(struct connection *con, int cmd, char *cmdbuf,struct cl_version cnxman_version;char *outbuf = *retbuf;int value; +FILE *dumpfile;P_MEMB ("command to process is %x\n" , cmd);
@@ -1260,7 +1261,20 @@ int process_command(struct connection *con, int cmd, char *cmdbuf,set_debuglog (value); err =0 ;break ; - +#ifdef DEBUG +case CMAN_CMD_DUMP_OBJDB : +P_MEMB ("CC: Dump_objdb: filename = %s\n" , cmdbuf); + dumpfile =fopen (cmdbuf,"w+" ); +if (dumpfile) { + global_objdb->object_dump (OBJECT_PARENT_HANDLE , dumpfile); +fclose (dumpfile); + err =0 ; + } +else { + err = -errno; + } +break ; +#endif case CMAN_CMD_START_CONFCHG : con->confchg =1 ; err =0 ;
cman/daemon/nodelist.h +9 -5
@@ -12,12 +12,14 @@/* Helper functions for navigating the nodes list */ -static unsigned int nodeslist_init (struct objdb_iface_ver0 *objdb,unsigned int *parent_handle) +static unsigned int nodeslist_init (struct objdb_iface_ver0 *objdb, +unsigned int cluster_parent_handle, +unsigned int *parent_handle) {unsigned int object_handle; - objdb->object_find_reset (OBJECT_PARENT_HANDLE ); -if (objdb->object_find (OBJECT_PARENT_HANDLE , + objdb->object_find_reset (cluster_parent_handle); +if (objdb->object_find (cluster_parent_handle,"clusternodes" ,strlen ("clusternodes" ), &object_handle) ==0 ) {
@@ -47,13 +49,15 @@ static unsigned int nodeslist_next(struct objdb_iface_ver0 *objdb, unsigned intreturn 0 ; } -static unsigned int nodelist_byname (struct objdb_iface_ver0 *objdb,char *name) +static unsigned int nodelist_byname (struct objdb_iface_ver0 *objdb, +unsigned int cluster_parent_handle, +char *name) {char *nodename;unsigned int nodes_handle;unsigned int parent_handle; - nodes_handle =nodeslist_init (objdb, &parent_handle); + nodes_handle =nodeslist_init (objdb, cluster_parent_handle, &parent_handle);while (nodes_handle) {if (objdb_get_string (objdb, nodes_handle,"name" , &nodename)) {log_printf (LOG_ERR ,"Cannot get node name" );
cman/lib/libcman.c +10 -0
@@ -1112,3 +1112,13 @@ int cman_node_fenced(cman_handle_t handle, int nodeid, uint64_t time, char *agenstrcpy (f.fence_agent, agent);return info_call (h,CMAN_CMD_UPDATE_FENCE_INFO , &f,sizeof (f),NULL ,0 ); } + +#ifdef DEBUG +int cman_dump_objdb (cman_handle_t handle,char *filename) +{ +struct cman_handle *h = (struct cman_handle *)handle; +VALIDATE_HANDLE (h); + +return info_call (h,CMAN_CMD_DUMP_OBJDB , filename,strlen (filename)+1 ,NULL ,0 ); +} +#endif
cman/lib/libcman.h +3 -0
@@ -337,6 +337,9 @@ int cman_get_fenceinfo(cman_handle_t handle, int nodeid, uint64_t *fence_time, i/* Get stuff for cman_tool. Nobody else should use this */ int cman_get_extra_info (cman_handle_t handle,cman_extra_info_t *info,int maxlen); +/* Dump the objdb contents (only works if compiled with DEBUG enabled) */ +int cman_dump_objdb (cman_handle_t handle,char *filename); +/* * ----------------------------------------------------------------------------- * Admin functions. You will need privileges and have a handle created by
hooks/post-receive
--
Cluster Project