public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - fence_intelmodular: Rewrite of agent under Python unified library
@ 2009-03-11 12:06 Jan Friesse
  0 siblings, 0 replies; only message in thread
From: Jan Friesse @ 2009-03-11 12:06 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ea383bee91589d194f033aa92e16c07c7748c06c
Commit:        ea383bee91589d194f033aa92e16c07c7748c06c
Parent:        e467f34fea8c00f4279eb008ab4506000b5723fe
Author:        Jan Friesse <jfriesse@redhat.com>
AuthorDate:    Wed Mar 11 13:05:54 2009 +0100
Committer:     Jan Friesse <jfriesse@redhat.com>
CommitterDate: Wed Mar 11 13:05:54 2009 +0100

fence_intelmodular: Rewrite of agent under Python unified library

Main functionality should be kept (thanks Matthew for
testing), and has some new features, like list, metadata, ...
---
 fence/agents/intelmodular/Makefile              |    4 +
 fence/agents/intelmodular/fence_intelmodular.py |   86 +++++++++++++++
 fence/man/Makefile                              |    3 +-
 fence/man/fence_intelmodular.8                  |  131 +++++++++++++++++++++++
 4 files changed, 223 insertions(+), 1 deletions(-)

diff --git a/fence/agents/intelmodular/Makefile b/fence/agents/intelmodular/Makefile
new file mode 100644
index 0000000..ba22926
--- /dev/null
+++ b/fence/agents/intelmodular/Makefile
@@ -0,0 +1,4 @@
+TARGET= fence_intelmodular
+
+include ../../../make/defines.mk
+include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
new file mode 100644
index 0000000..8cfa0ae
--- /dev/null
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+
+# Tested with an Intel MFSYS25 using firmware package 2.6 Should work with an
+# MFSYS35 as well.
+#
+# Notes:
+#
+# The manual and firmware release notes says SNMP is read only. This is not
+# true, as per the MIBs that ship with the firmware you can write to
+# the bladePowerLed oid to control the servers.
+#
+# Thanks Matthew Kent for original agent and testing.
+
+import sys, re, pexpect
+from fencing import *
+from fencing_snmp import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION="Intel Modular SNMP fence agent"
+REDHAT_COPYRIGHT=""
+BUILD_DATE=""
+#END_VERSION_GENERATION
+
+### CONSTANTS ###
+# From INTELCORPORATION-MULTI-FLEX-SERVER-BLADES-MIB.my that ships with
+# firmware updates
+STATUSES_OID=".1.3.6.1.4.1.343.2.19.1.2.10.202.1.1.6"
+
+# Status constants returned as value from SNMP
+STATUS_UP=2
+STATUS_DOWN=0
+
+# Status constants to set as value to SNMP
+STATUS_SET_ON=2
+STATUS_SET_OFF=3
+
+### FUNCTIONS ###
+
+def get_power_status(conn,options):
+	(oid,status)=conn.get("%s.%s"%(STATUSES_OID,options["-n"]))
+	return (status==str(STATUS_UP) and "on" or "off")
+
+def set_power_status(conn, options):
+	conn.set("%s.%s"%(STATUSES_OID,options["-n"]),(options["-o"]=="on" and STATUS_SET_ON or STATUS_SET_OFF))
+
+def get_outlets_status(conn, options):
+	result={}
+
+	res_blades=conn.walk(STATUSES_OID,30)
+
+	for x in res_blades:
+		port_num=x[0].split('.')[-1]
+
+		port_alias=""
+		port_status=(x[1]==str(STATUS_UP) and "on" or "off")
+
+		result[port_num]=(port_alias,port_status)
+
+	return result
+
+# Define new options
+def intelmodular_define_defaults():
+	all_opt["snmp_version"]["default"]="1"
+
+# Main agent method
+def main():
+	global port_oid
+
+	device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
+		       "action", "ipaddr", "login", "passwd", "passwd_script",
+		       "test", "port", "separator", "no_login", "no_password",
+		       "snmp_version", "community", "snmp_auth_prot", "snmp_sec_level",
+		       "snmp_priv_prot", "snmp_priv_passwd", "snmp_priv_passwd_script",
+		       "udpport"]
+
+	atexit.register(atexit_handler)
+
+	intelmodular_define_defaults()
+
+	options=check_input(device_opt,process_input(device_opt))
+
+	# Operate the fencing device
+	fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+
+if __name__ == "__main__":
+	main()
diff --git a/fence/man/Makefile b/fence/man/Makefile
index 2baf083..3626f5a 100644
--- a/fence/man/Makefile
+++ b/fence/man/Makefile
@@ -19,6 +19,7 @@ TARGET += \
 	fence_ibmblade.8 \
 	fence_ifmib.8 \
 	fence_ilo.8 \
+	fence_intelmodular.8 \
 	fence_ipmilan.8 \
 	fence_ldom.8 \
 	fence_manual.8 \
@@ -29,8 +30,8 @@ TARGET += \
 	fence_rsb.8 \
 	fence_sanbox2.8 \
 	fence_scsi.8 \
-	fence_vixel.8 \
 	fence_virsh.8 \
+	fence_vixel.8 \
 	fence_vmware.8 \
 	fence_wti.8 \
 	fence_xcat.8 \
diff --git a/fence/man/fence_intelmodular.8 b/fence/man/fence_intelmodular.8
new file mode 100644
index 0000000..a013a7f
--- /dev/null
+++ b/fence/man/fence_intelmodular.8
@@ -0,0 +1,131 @@
+.TH fence_intelmodular 8
+
+.SH NAME
+fence_intelmodular - I/O Fencing agent for Intel MFSYS SNMP devices
+
+.SH SYNOPSIS
+.B
+fence_intelmodular
+[\fIOPTION\fR]...
+
+.SH DESCRIPTION
+fence_intelmodular is an I/O Fencing agent which can be used with
+Intel Modular device (tested on Intel MFSYS25, should work with
+MFSYS35 as well). Agent internally uses snmpget, snmpset and snmpwalk command.
+
+fence_intelmodular accepts options on the command line as well as from stdin.
+Fenced sends parameters through stdin when it execs the agent.  fence_intelmodular can be run by itself with command line options.  This is useful for testing.
+
+.SH OPTIONS
+.TP
+\fB-a\fP \fIIPaddress\fR
+IP address or hostname of the SNMP device. Can be used any syntax supported by snmpget.
+.TP
+\fB-h\fP
+Print out a help message describing available options, then exit.
+.TP
+\fB-c\fP \fIcommunity\fR
+The read/write community string to be used in the request.
+.TP
+\fB-n\fP \fIname\fR
+Name of port to fence or ifIndex.
+.TP
+\fB-p\fP \fIpassword\fR
+Password for login for SNMP v3 (authentication protocol pass phrase).
+.TP
+\fB-P\fP \fIpassword\fR
+Password for privacy for SNMP v3 (privacy protocol password).
+.TP
+\fB-S\fP \fIscript\fR
+Script to run to retrieve password for login for SNMP v3 (authentication protocol pass phrase).
+.TP
+\fB-R\fP \fIscript\fR
+Script to run to retrieve privacy for SNMP v3 (privacy protocol password).
+.TP
+\fB-l\fP \fIlogin\fR
+Login name for SNMP v3 (security name).
+.TP
+\fB-d\fP \fIversion\fR
+SNMP version (1,2c,3). Default is 1.
+.TP
+\fB-b\fP \fIauth_protocol\fR
+SNMP authentication protocol (MD5|SHA).
+.TP
+\fB-E\fP \fIsec_level\fR
+SNMP security level (noAuthNoPriv|authNoPriv|authPriv).
+.TP
+\fB-B\fP \fIpriv_protocol\fR
+SNMP privacy protocol (DES|AES).
+.TP
+\fB-u\fP \fIudp_port\fR
+UDP/TCP port to use.
+.TP
+\fB-o\fP \fIaction\fR
+The action required.  off (default), on, status, list or monitor. Deprecated
+options (enable -> on and disable -> off) can be used too.
+.TP
+\fB-v\fP
+Verbose. Record session to stdout, or debug file if specified (see -D).
+.TP
+\fB-D\fP
+Specifies file, where will be written debug messages from session.
+.TP
+\fB-V\fP
+Print out a version message, then exit.
+
+.SH STDIN PARAMETERS
+.TP
+\fIagent = < param >\fR
+This option is used by fence_node(8) and is ignored by fence_intelmodular.
+.TP
+\fIipaddr = < param >\fR
+IP address or hostname of the SNMP device. Can be used any syntax supported by snmpget.
+.TP
+\fIcommunity = < param >\fR
+The read/write community string to be used in the request.
+.TP
+\fIport = < param >\fR
+Name of port to fence or ifIndex.
+.TP
+\fIpasswd = < param >\fR
+Password for login for SNMP v3 (authentication protocol pass phrase).
+.TP
+\fIsnmp_priv_passwd\fR
+Password for privacy for SNMP v3 (privacy protocol password).
+.TP
+\fIpasswd_script = < param >\fR
+Script to run to retrieve password for login for SNMP v3 (authentication protocol pass phrase).
+.TP
+\fIsnmp_priv_passwd_script = < param>\fR
+Password for privacy for SNMP v3 (privacy protocol password).
+.TP
+\fIlogin = < param >\fR
+Login name for SNMP v3 (security name).
+.TP
+\fIsnmp_version = < param >\fR
+SNMP version (1,2c,3). Default is 1.
+.TP
+\fIsnmp_auth_prot = < param >\fR
+SNMP authentication protocol (MD5|SHA).
+.TP
+\fIsnmp_sec_level = < param >\fR
+SNMP security level (noAuthNoPriv|authNoPriv|authPriv).
+.TP
+\fIsnmp_priv_prot = < param >\fR
+SNMP privacy protocol (DES|AES).
+.TP
+\fIudpport = < param >\fR
+UDP/TCP port to use.
+.TP
+\fIaction = < param >\fR
+The action required.  off (default), on, status, list or monitor. Deprecated
+options (enable -> on and disable -> off) can be used too.
+.TP
+\fIverbose = < param >\fR
+Verbose.  Record session to stdout, or debug file if specified (see debug).
+.TP
+\fIdebug = < param >\fR
+Specifies file, where will be written debug messages from session.
+
+.SH SEE ALSO
+fence(8), fence_node(8)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-11 12:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-11 12:06 cluster: STABLE3 - fence_intelmodular: Rewrite of agent under Python unified library Jan Friesse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).