[PATCH] fix rps-10 bug where an option was not specified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-10-03 at 16:48 -0400, Lon Hohberger wrote:
> On Wed, 2007-10-03 at 12:53 +0100, Ben Yarwood wrote:
> > I think the documentation for using the rps10 fence device is incorrect
> > (http://sources.redhat.com/cluster/doc/cluster_schema_rhel5.html), or else there is a bug in the fence agent in rhel5:
> > 
> > The doc does not mention that you must specify an "option" attribute or else the agent returns an error.  Eg.
> > 
> > <fencedevice agent="fence_rps10" name="rps10" device="/dev/ttyS0" port="0" option="reboot" />
> >   
> > will work but without the "option" attribute you get the error:
> > 
> > failed: operation must be 'on', 'off', or 'reboot'
> 
> Ouch.  Could you file a bz?  It should default to reboot if unspecified.

-- Lon

Index: rps10.c
===================================================================
RCS file: /cvs/cluster/cluster/fence/agents/rps10/rps10.c,v
retrieving revision 1.4
diff -u -r1.4 rps10.c
--- rps10.c	22 Aug 2007 08:58:40 -0000	1.4
+++ rps10.c	3 Oct 2007 20:54:39 -0000
@@ -39,6 +39,10 @@
 #include <libgen.h>
 #include "copyright.cf"
 
+#ifndef RELEASE_VERSION
+#define RELEASE_VERSION "sandbox"
+#endif
+
 
 /*
  * Salt to taste.
@@ -144,7 +148,7 @@
 printf("   -s <speed>     Use speed <speed>. Default=9600\n"
        "                  Valid speeds: 300, 1200, 2400, 9600\n");
 printf("   -o <op>        Operation to perform.\n");
-printf("                  Valid operations: on, off, reboot\n");
+printf("                  Valid operations: on, off, reboot]\n");
 printf("   -V             Print version and exit\n");
 printf("   -v             Verbose mode\n\n");
 printf("If no options are specified, the following options will be read\n");
@@ -314,8 +318,6 @@
 	int line = 0;
 	char *name, *val;
 
-	op[0] = 0;
-
 	while (fgets(in, sizeof(in), stdin)) {
 		++line;
 
@@ -396,6 +398,7 @@
 	char *pname = basename(argv[0]);
 
 	strncpy(dev, DEFAULT_DEVICE, sizeof(dev));
+	strncpy(op, "reboot", sizeof(op));
 
 	if (argc > 1) {
 		/*
--
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux