diff options
author | Christian Zoffoli <xmerlin@gentoo.org> | 2008-11-22 14:12:13 +0000 |
---|---|---|
committer | Christian Zoffoli <xmerlin@gentoo.org> | 2008-11-22 14:12:13 +0000 |
commit | 742005a4f55aa595df84931c11002cc90712f45a (patch) | |
tree | eaa249e97a9e92702f084323fc413dc3ce012789 /sys-cluster/fence | |
parent | amd64/x86 stable, bug #247819 (diff) | |
download | gentoo-2-742005a4f55aa595df84931c11002cc90712f45a.tar.gz gentoo-2-742005a4f55aa595df84931c11002cc90712f45a.tar.bz2 gentoo-2-742005a4f55aa595df84931c11002cc90712f45a.zip |
Merged some IPMI fixes.
(Portage version: 2.1.4.4)
Diffstat (limited to 'sys-cluster/fence')
6 files changed, 464 insertions, 1 deletions
diff --git a/sys-cluster/fence/ChangeLog b/sys-cluster/fence/ChangeLog index 0bac63c3fd78..85f9c2aee2be 100644 --- a/sys-cluster/fence/ChangeLog +++ b/sys-cluster/fence/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for sys-cluster/fence # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/ChangeLog,v 1.36 2008/11/21 22:39:29 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/ChangeLog,v 1.37 2008/11/22 14:12:12 xmerlin Exp $ + +*fence-2.03.09-r1 (22 Nov 2008) + + 22 Nov 2008; Christian Zoffoli <xmerlin@gentoo.org> + +files/fence-2.03.09-ipmi_fix_help_typo_RH_BZ_210687.patch, + +files/fence-2.03.09-ipmi_fix_parameters_RH_BZ_447964.patch, + +files/fence-2.03.09-ipmi_fix_shell.patch, + +files/fence-2.03.09-ipmi_lan_timeout_adjusted_and_configurable.patch, + +fence-2.03.09-r1.ebuild: + Merged some IPMI fixes. 21 Nov 2008; Christian Zoffoli <xmerlin@gentoo.org> fence-2.03.09.ebuild: Fixed homepage. diff --git a/sys-cluster/fence/fence-2.03.09-r1.ebuild b/sys-cluster/fence/fence-2.03.09-r1.ebuild new file mode 100644 index 000000000000..b7dd41b3cbd0 --- /dev/null +++ b/sys-cluster/fence/fence-2.03.09-r1.ebuild @@ -0,0 +1,76 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/fence-2.03.09-r1.ebuild,v 1.1 2008/11/22 14:12:12 xmerlin Exp $ + +inherit eutils versionator + +CLUSTER_RELEASE="${PV}" +MY_P="cluster-${CLUSTER_RELEASE}" + +MAJ_PV="$(get_major_version)" +MIN_PV="$(get_version_component_range 2).$(get_version_component_range 3)" + +DESCRIPTION="I/O group fencing system" +HOMEPAGE="http://sources.redhat.com/cluster/wiki/" +SRC_URI="ftp://sources.redhat.com/pub/cluster/releases/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND="=sys-cluster/ccs-${CLUSTER_RELEASE}* + =sys-cluster/openais-0.80.3* + =sys-cluster/dlm-lib-${CLUSTER_RELEASE}* + =sys-cluster/cman-lib-${CLUSTER_RELEASE}* + dev-perl/Net-Telnet + dev-perl/Net-SSLeay + " + +RDEPEND="$DEPEND" + +S="${WORKDIR}/${MY_P}/${PN}" + +src_unpack() { + unpack ${A} + cd "${S}" + chmod u+x "${WORKDIR}"/${MY_P}/scripts/define2var + + epatch "${FILESDIR}"/fence-2.03.09-ipmi_fix_help_typo_RH_BZ_210687.patch || die + epatch "${FILESDIR}"/fence-2.03.09-ipmi_fix_shell.patch || die + epatch "${FILESDIR}"/fence-2.03.09-ipmi_fix_parameters_RH_BZ_447964.patch || die + epatch "${FILESDIR}"/fence-2.03.09-ipmi_lan_timeout_adjusted_and_configurable.patch || die +} + +src_compile() { + (cd "${WORKDIR}"/${MY_P}; + ./configure \ + --cc=$(tc-getCC) \ + --cflags="-Wall" \ + --disable_kernel_check \ + --dlmlibdir=/usr/lib \ + --dlmincdir=/usr/include \ + --cmanlibdir=/usr/lib \ + --cmanincdir=/usr/include \ + ) || die "configure problem" + + (cd "${WORKDIR}"/${MY_P}/group; + emake -j1 clean all \ + ) || die "compile problem" + + # fix the manual pages have executable bit + sed -i -e ' + /\tinstall -d/s/install/& -m 0755/; t + /\tinstall/s/install/& -m 0644/' \ + man/Makefile + + emake -j1 clean all || die "compile problem" +} + +src_install() { + (cd "${WORKDIR}"/${MY_P}/group; + emake DESTDIR="${D}" install \ + ) || die "install problem" + + emake DESTDIR="${D}" install || die "install problem" +} diff --git a/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_help_typo_RH_BZ_210687.patch b/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_help_typo_RH_BZ_210687.patch new file mode 100644 index 000000000000..75a4464ca4be --- /dev/null +++ b/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_help_typo_RH_BZ_210687.patch @@ -0,0 +1,27 @@ +From: Jan Friesse <jfriesse@redhat.com> +Date: Thu, 20 Nov 2008 11:52:21 +0000 (+0100) +Subject: fence: fix IPMI typo in help +X-Git-Url: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff_plain;h=47514a9ac69f4b6ef0bcd87a2763de24dff12f5d + +fence: fix IPMI typo in help + +Help contained description of -i option with comment, +that this option is deprecated and you should use -i. This +is nice recursion, but there should be -a. + +This fixes BZ #210687 +--- + +diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c +index 30d69ee..358274a 100644 +--- a/fence/agents/ipmilan/ipmilan.c ++++ b/fence/agents/ipmilan/ipmilan.c +@@ -687,7 +687,7 @@ usage_exit(char *pname) + printf("usage: %s <options>\n", pname); + printf(" -A <authtype> IPMI Lan Auth type (md5, password, or none)\n"); + printf(" -a <ipaddr> IPMI Lan IP to talk to\n"); +-printf(" -i <ipaddr> IPMI Lan IP to talk to (deprecated, use -i)\n"); ++printf(" -i <ipaddr> IPMI Lan IP to talk to (deprecated, use -a)\n"); + printf(" -p <password> Password (if required) to control power on\n" + " IPMI device\n"); + printf(" -P Use Lanplus\n"); diff --git a/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_parameters_RH_BZ_447964.patch b/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_parameters_RH_BZ_447964.patch new file mode 100644 index 000000000000..c54fb225f11b --- /dev/null +++ b/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_parameters_RH_BZ_447964.patch @@ -0,0 +1,100 @@ +From: Jan Friesse <jfriesse@redhat.com> +Date: Thu, 20 Nov 2008 11:51:20 +0000 (+0100) +Subject: fence: fix IPMI parameters containing special characters +X-Git-Url: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff_plain;h=6c1a7ce96b7712e85d3cb765ca9dd58061d6a25b + +fence: fix IPMI parameters containing special characters + +IPMI fence agent works by spawn a /bin/sh and ipmitool. +If host name/password or any other command line argument +included special shell characters (like $, ", ', ...) shell +will try to substitute. This is not allowed behaviour and +this patch fix it. + +Should fix BZ #447964 +--- + +diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c +index 117228c..30d69ee 100644 +--- a/fence/agents/ipmilan/ipmilan.c ++++ b/fence/agents/ipmilan/ipmilan.c +@@ -138,34 +138,73 @@ ipmitool_path(void) + } + + ++/** Prepare string for use in sh style environment. This function take source ++ string and prepend/append quote (') to start/end of source string to dest ++ string. Any occurence of quote in source string is replaced by '\'' sequence. ++ Dest string must be preallocated. ++ ++ @param dest Destination string ++ @param source Source string ++ @param max_len Maximum length of data written to dest string (including end 0) ++ @return Pointer to start of destination string. ++*/ ++char *str_prepare_for_sh(char *dest,char *source,int max_len) { ++ char *dest_p=dest; ++ char *max_dest=dest+max_len; ++ ++ if (dest_p+1>=max_dest) {*dest_p=0;return dest;} ++ *dest_p++='\''; ++ ++ while (*source) { ++ if (*source=='\'') { ++ if (dest_p+4>=max_dest) {*dest_p=0;return dest;} ++ ++ memcpy(dest_p,"'\\''",4);dest_p+=4; ++ } else { ++ if (dest_p+1>=max_dest) {*dest_p=0;return dest;} ++ ++ *dest_p++=*source; ++ } ++ source++; ++ } ++ ++ if (dest_p+2>=max_dest) {*dest_p=0;return dest;} ++ ++ *dest_p++='\'';*dest_p=0; ++ ++ return dest; ++} ++ + static int + build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op) + { + char cmd[2048]; + char arg[2048]; ++ char tmp[2048]; + int x; + + /* Store path */ + if (ipmi->i_lanplus) { +- snprintf(cmd, sizeof(cmd), "%s -I lanplus -H %s", +- ipmi->i_ipmitool, ipmi->i_host); ++ snprintf(cmd, sizeof(cmd), "%s -I lanplus -H %s", ++ ipmi->i_ipmitool, ++ str_prepare_for_sh(tmp,ipmi->i_host,sizeof(tmp))); + } else { + snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool, +- ipmi->i_host); ++ str_prepare_for_sh(tmp,ipmi->i_host,sizeof(tmp))); + } + + if (ipmi->i_user) { +- snprintf(arg, sizeof(arg), " -U %s", ipmi->i_user); ++ snprintf(arg, sizeof(arg), " -U %s", str_prepare_for_sh(tmp,ipmi->i_user,sizeof(tmp))); + strncat(cmd, arg, sizeof(cmd) - strlen(arg)); + } + + if (ipmi->i_authtype) { +- snprintf(arg, sizeof(arg), " -A %s", ipmi->i_authtype); ++ snprintf(arg, sizeof(arg), " -A %s", str_prepare_for_sh(tmp,ipmi->i_authtype,sizeof(tmp))); + strncat(cmd, arg, sizeof(cmd) - strlen(arg)); + } + + if (ipmi->i_password) { +- snprintf(arg, sizeof(arg), " -P %s", ipmi->i_password); ++ snprintf(arg, sizeof(arg), " -P %s", str_prepare_for_sh(tmp,ipmi->i_password,sizeof(tmp))); + strncat(cmd, arg, sizeof(cmd) - strlen(arg)); + } else { + snprintf(arg, sizeof(arg), " -P ''"); diff --git a/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_shell.patch b/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_shell.patch new file mode 100644 index 000000000000..95a527130244 --- /dev/null +++ b/sys-cluster/fence/files/fence-2.03.09-ipmi_fix_shell.patch @@ -0,0 +1,25 @@ +From: Jan Friesse <jfriesse@redhat.com> +Date: Thu, 20 Nov 2008 13:39:20 +0000 (+0100) +Subject: fence: fix IPMI spawn /bin/bash rather than /bin/sh +X-Git-Url: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff_plain;h=d57fba422b8c5822bc751cc190277367e42ad597 + +fence: fix IPMI spawn /bin/bash rather than /bin/sh + +It's not guaranteed, that /bin/sh will be symlink to +shell, which is bash (or ksh) compliant, so it's better +to use /bin/bash. +--- + +diff --git a/fence/agents/ipmilan/expect.c b/fence/agents/ipmilan/expect.c +index 4156886..fa85bd8 100644 +--- a/fence/agents/ipmilan/expect.c ++++ b/fence/agents/ipmilan/expect.c +@@ -304,7 +304,7 @@ StartProcess(const char * cmd, int * readfd, int * writefd, int flags) + sched_setscheduler(0, SCHED_OTHER, &sp); + } + #endif +- execlp("/bin/sh", "sh", "-c", cmd, NULL); ++ execlp("/bin/bash", "bash", "-c", cmd, NULL); + perror("cannot exec shell!"); + exit(1); + diff --git a/sys-cluster/fence/files/fence-2.03.09-ipmi_lan_timeout_adjusted_and_configurable.patch b/sys-cluster/fence/files/fence-2.03.09-ipmi_lan_timeout_adjusted_and_configurable.patch new file mode 100644 index 000000000000..ddbae2baf77f --- /dev/null +++ b/sys-cluster/fence/files/fence-2.03.09-ipmi_lan_timeout_adjusted_and_configurable.patch @@ -0,0 +1,225 @@ +From: Jan Friesse <jfriesse@redhat.com> +Date: Wed, 19 Nov 2008 16:50:03 +0000 (+0100) +Subject: fence: IPMI over lan timeout adjusted and configurable +X-Git-Url: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff_plain;h=59229fddbf3c15c2279e4841c443e7a60a6799a6 + +fence: IPMI over lan timeout adjusted and configurable + +This patch adjust timeout to default value 10s which +should be enough for most today IPMI implementations. +It also removes retries, because this job is done +by fenced. + +Because some devices still need longer timeouts, +timeout is adjustable by parameter -t (or timeout for stdin +and XML configuration). + +This should fix BZ: 401481, 276541 and 452894 +--- + +diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c +index 3b4987b..117228c 100644 +--- a/fence/agents/ipmilan/ipmilan.c ++++ b/fence/agents/ipmilan/ipmilan.c +@@ -26,6 +26,8 @@ + #define ST_POWEROFF 2 + #define ST_GENERIC_RESET 3 + ++#define DEFAULT_TIMEOUT 10 ++ + #define log(lvl, fmt, args...) fprintf(stderr, fmt, ##args) + #include <libgen.h> + #include <copyright.cf> +@@ -59,6 +61,7 @@ struct ipmi { + int i_config; + int i_verbose; + int i_lanplus; ++ int i_timeout; + }; + + +@@ -276,42 +279,25 @@ static int + ipmi_op(struct ipmi *ipmi, int op, struct Etoken *toklist) + { + char cmd[2048]; +- int retries = 5; + int ret; + + build_cmd(cmd, sizeof(cmd), ipmi, op); + + if (ipmi_spawn(ipmi, cmd) != 0) + return -1; +- ret = ipmi_expect(ipmi, toklist, 120); ++ ret = ipmi_expect(ipmi, toklist, ipmi->i_timeout); + ipmi_reap(ipmi); + +- while ((ret == EAGAIN || ret == ETIMEDOUT) && retries > 0) { +- dbg_printf(ipmi, 3, "Sleeping 5 ...\n"); +- sleep(5); +- dbg_printf(ipmi, 1, "Retrying ...\n"); +- --retries; +- +- if (ipmi_spawn(ipmi, cmd) != 0) +- return -1; +- ret = ipmi_expect(ipmi, toklist, 120); +- if (ret == EFAULT) { +- /* Doomed. */ +- break; +- } +- ipmi_reap(ipmi); +- } +- + if (ret == EFAULT) { + log(LOG_CRIT, "ipmilan: ipmitool failed to create " + "mutex; unable to complete operation\n"); + return ret; + } + +- if (ret == EAGAIN) { ++ if (ret == ETIMEDOUT) { + /*!!! Still couldn't get through?! */ + log(LOG_WARNING, +- "ipmilan: Failed to connect after 30 seconds\n"); ++ "ipmilan: Failed to connect after %d seconds\n",ipmi->i_timeout); + } + + return ret; +@@ -432,7 +418,7 @@ ipmi_destroy(struct ipmi *i) + */ + static struct ipmi * + ipmi_init(struct ipmi *i, char *host, char *authtype, +- char *user, char *password, int lanplus, int verbose) ++ char *user, char *password, int lanplus, int verbose,int timeout) + { + const char *p; + +@@ -503,6 +489,7 @@ ipmi_init(struct ipmi *i, char *host, char *authtype, + i->i_id = IPMIID; + i->i_verbose = verbose; + i->i_lanplus = lanplus; ++ i->i_timeout = timeout; + + return i; + } +@@ -565,7 +552,7 @@ get_options_stdin(char *ip, size_t iplen, + char *pwd_script, size_t pwd_script_len, + char *user, size_t userlen, + char *op, size_t oplen, +- int *lanplus, int *verbose) ++ int *lanplus, int *verbose,int *timeout) + { + char in[256]; + int line = 0; +@@ -627,6 +614,10 @@ get_options_stdin(char *ip, size_t iplen, + user[0] = 0; + } else if (!strcasecmp(name, "lanplus")) { + (*lanplus) = 1; ++ } else if (!strcasecmp(name,"timeout")) { ++ if ((sscanf(val,"%d",timeout)!=1) || *timeout<1) { ++ *timeout=DEFAULT_TIMEOUT; ++ } + } else if (!strcasecmp(name, "option") || + !strcasecmp(name, "operation") || + !strcasecmp(name, "action")) { +@@ -666,6 +657,7 @@ printf(" -l <login> Username/Login (if required) to control power\n" + " on IPMI device\n"); + printf(" -o <op> Operation to perform.\n"); + printf(" Valid operations: on, off, reboot, status\n"); ++printf(" -t <timeout> Timeout (sec) for IPMI operation (default %d)\n",DEFAULT_TIMEOUT); + 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"); +@@ -679,6 +671,7 @@ printf(" login=<login> Same as -u\n"); + printf(" option=<op> Same as -o\n"); + printf(" operation=<op> Same as -o\n"); + printf(" action=<op> Same as -o\n"); ++printf(" timeout=<timeout> Same as -t\n"); + printf(" verbose Same as -v\n\n"); + exit(1); + } +@@ -699,6 +692,7 @@ main(int argc, char **argv) + int verbose=0; + char *pname = basename(argv[0]); + struct ipmi *i; ++ int timeout=DEFAULT_TIMEOUT; + + memset(ip, 0, sizeof(ip)); + memset(authtype, 0, sizeof(authtype)); +@@ -710,7 +704,7 @@ main(int argc, char **argv) + /* + Parse command line options if any were specified + */ +- while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hH")) != EOF) { ++ while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:")) != EOF) { + switch(opt) { + case 'A': + /* Auth type */ +@@ -740,6 +734,12 @@ main(int argc, char **argv) + /* Operation */ + strncpy(op, optarg, sizeof(op)); + break; ++ case 't': ++ /* Timeout */ ++ if ((sscanf(optarg,"%d",&timeout)!=1) || timeout<1) { ++ fail_exit("Timeout option expects positive number parameter"); ++ } ++ break; + case 'v': + verbose++; + break; +@@ -763,7 +763,7 @@ main(int argc, char **argv) + passwd, sizeof(passwd), + pwd_script, sizeof(pwd_script), + user, sizeof(user), +- op, sizeof(op), &lanplus, &verbose) != 0) ++ op, sizeof(op), &lanplus, &verbose,&timeout) != 0) + return 1; + } + +@@ -813,7 +813,7 @@ main(int argc, char **argv) + + + /* Ok, set up the IPMI struct */ +- i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose); ++ i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout); + if (!i) + fail_exit("Failed to initialize\n"); + +From: Jan Friesse <jfriesse@redhat.com> +Date: Thu, 20 Nov 2008 16:45:01 +0000 (+0100) +Subject: fence: fix IPMI man page +X-Git-Url: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff_plain;h=49885167a5b1d8a848ae6b747865d716026375e7 + +fence: fix IPMI man page + +Documented timeout (-t) option. +--- + +diff --git a/fence/man/fence_ipmilan.8 b/fence/man/fence_ipmilan.8 +index 0d68d68..394804d 100644 +--- a/fence/man/fence_ipmilan.8 ++++ b/fence/man/fence_ipmilan.8 +@@ -44,6 +44,11 @@ Use the lanplus option if this is a lanplus capable interface (for example iLo2) + \fB-A\fP \fIAuthentication Type\fP + Can be set to none, password, md2, or md5. + .TP ++\fB-t\fP \fItimeout\fP ++Timeout in seconds for IPMI operation. Default is 10, but in some cases it ++must be set to higher value (anything above 30 is not recommended and may ++cause strange problems). ++.TP + \fB-q\fP + Quiet operation. Only print out error messages. + .TP +@@ -73,6 +78,11 @@ Full path to an executable to generate the password for login. + \fIauth = < param >\fR + Authentication type (none, password, md2, md5). + .TP ++\fItimeout = < param >\fR ++Timeout in seconds for IPMI operation. Default is 10, but in some cases it ++must be set to higher value (anything above 30 is not recommended and may ++cause strange problems). ++.TP + \fIlanplus\fR + If we are using the lanplus option for ipmitool + |