From: Aneesh K. K.V <ane...@di...> - 2002-10-31 04:23:37
|
On Wed, 2002-10-30 at 23:49, John Byrne wrote: > Aneesh Kumar K.V wrote: > > Hi, > > > > But rc.nodedown is installed only for SSI and is also installed at a > > location dependent on distro( /etc/rc.d for redhat and /etc/init.d for > > debian. ) How do you want to handle this ? > > > > -aneesh > > Someone complained about me deleting it and a bug was opened under CI > about it. I'm finally fixing it. The exact complaint was that the > cluster_start command calls it and it wasn't there. I'm not sure where > or how the cluster_start script is supposed to be used. > > John > In the case of CI we use cluster_start to start the CI subsystem. CI doesn't make use of ramdisk. I guess noded purpose was to execute some command in the UP nodes when some nodes goes down and in this case set the state of the node that went down as DOWN (/usr/sbin/clusternode_setstate $1 DOWN ). But the location of the rc.nodedown script is distro dependent. One solution is to set the state of the node went down by using library( libcluster.so, clusternode_setinfo ) rather than rc.nodedown. --- noded.c.old Wed Oct 30 06:47:25 2002 +++ noded.c Mon Oct 31 05:52:36 2050 @@ -64,8 +64,6 @@ /* prototypes */ void daemonize(void); void do_nodedown(clusternode_t); -void execute_files(clusternode_t, char *); -void execute_commands(clusternode_t, char *); char *states[] = { "UNDEFINED", "NEVERUP", @@ -231,69 +229,10 @@ void do_nodedown(clusternode_t node) { - pid_t childpid; - - /* - * execute commands on local node - */ - if ((childpid = fork()) != 0) { - if (childpid == -1) { - fprintf(stderr, "ERROR: fork failed...\n" - "\tReason: %s\n", strerror(errno)); - } - } else { /* child */ - execute_files(node, NODEDOWN_SCRIPT); - /* - * child will exit here - */ - exit(0); - } - - /* - * parent will return here - */ + clusternode_info_t node_info; + node_info.node_num = node; + node_info.node_state = 8; /* 8 = DOWN clusternode_setstate.c */ + clusternode_setinfo(node, CLUSTERNODE_SETSTATE, + sizeof(node_info), &node_info); return; -} - -void -execute_files( - clusternode_t node, - char *filename) -{ - struct sigaction sigact; - - /* - * Save zombie children - */ - sigact.sa_handler = SIG_DFL; - sigact.sa_flags &= ~SA_NOCLDWAIT; - sigaction(SIGCHLD, &sigact, (struct sigaction *)0); - - /* - * Execute generic script - */ - execute_commands(node, filename); -} - -void -execute_commands( - clusternode_t node, - char *filename) -{ - char *argv[3]; - char nodenum[20]; - - sprintf(nodenum, "%ld", node); - argv[0] = filename; - argv[1] = nodenum; - argv[2] = NULL; - - execv(filename, argv); - - fprintf(stderr, - "WARNING: unable to execute script...\n" - "\tScript: \"%s\"\n" - "\tReason: %s\n", - filename, strerror(errno)); - exit(1); } -aneesh |