fence-agents: RHEL6 - fence_rhevm: Support new API used in RHEV-M 3.1
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=fec1c4...
Commit: fec1c4b83857a302a8423ef2070977a7e900ca99
Parent: 99975a5ffa708a17139cc1d61234c650395197b5
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 8 10:52:46 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 8 10:56:36 2012 +0200
fence_rhevm: Support new API used in RHEV-M 3.1
Resolves: rhbz#863568
---
fence/agents/rhevm/fence_rhevm.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 3578b5f..fa75030 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -12,7 +12,7 @@ BUILD_DATE="March, 2008"
#END_VERSION_GENERATION
-re_get_id = re.compile("<vm id=\"(.*?)\"", re.IGNORECASE);
+re_get_id = re.compile("<vm( .*)? id=\"(.*?)\"", re.IGNORECASE);
re_status = re.compile("<state>(.*?)</state>", re.IGNORECASE);
re_get_name = re.compile("<name>(.*?)</name>", re.IGNORECASE);
@@ -29,7 +29,7 @@ def get_power_status(conn, options):
# Unable to obtain ID needed to access virtual machine
fail(EC_STATUS)
- options["id"] = result.group(1);
+ options["id"] = result.group(2);
re_status.search(res)
result = re_status.search(res)
11 years, 6 months
fence-agents: master - fence_rhevm: Support new API used in RHEV-M 3.1
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=2233db...
Commit: 2233dbef63729fca7bd74ec4ef93b3a649e149f6
Parent: 582aa5f7f285e225928765fff50979154eafa138
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 8 10:52:46 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 8 10:52:46 2012 +0200
fence_rhevm: Support new API used in RHEV-M 3.1
Resolves: rhbz#863568
---
fence/agents/rhevm/fence_rhevm.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 3578b5f..fa75030 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -12,7 +12,7 @@ BUILD_DATE="March, 2008"
#END_VERSION_GENERATION
-re_get_id = re.compile("<vm id=\"(.*?)\"", re.IGNORECASE);
+re_get_id = re.compile("<vm( .*)? id=\"(.*?)\"", re.IGNORECASE);
re_status = re.compile("<state>(.*?)</state>", re.IGNORECASE);
re_get_name = re.compile("<name>(.*?)</name>", re.IGNORECASE);
@@ -29,7 +29,7 @@ def get_power_status(conn, options):
# Unable to obtain ID needed to access virtual machine
fail(EC_STATUS)
- options["id"] = result.group(1);
+ options["id"] = result.group(2);
re_status.search(res)
result = re_status.search(res)
11 years, 6 months
fence-agents: RHEL6 - fence_vmware_soap: Faster fencing, fix crash on VM without valid UUID
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=99975a...
Commit: 99975a5ffa708a17139cc1d61234c650395197b5
Parent: 29063ac151e702fa184c2e201dd41652ff329da8
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Sep 27 13:00:37 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Oct 8 10:36:04 2012 +0200
fence_vmware_soap: Faster fencing, fix crash on VM without valid UUID
Improve speed of fencing by removing requests for attributes that are not needed. This change is significant
when there are hundrens of VM on vSphere server. On the systems with <10 VM improvement is still about 20%.
This patch also fixes situation when there are VM which do not have valid UUID. This can happend when P2V (physical
to virtual machine process) failed.
Patch was proposed by: Rodrigo A B Freire
Resolves: rhbz#769798
---
fence/agents/vmware_soap/fence_vmware_soap.py | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index 9bebd08..0da7f0d 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -44,9 +44,12 @@ def process_results(results, machines, uuid, mappingToUUID):
info = {}
for i in m.propSet:
info[i.name] = i.val
- machines[info["name"]] = (info["config.uuid"], info["summary.runtime.powerState"])
- uuid[info["config.uuid"]] = info["summary.runtime.powerState"]
- mappingToUUID[m.obj.value] = info["config.uuid"]
+ # Prevent error KeyError: 'config.uuid' when reaching systems which P2V failed,
+ # since these systems don't have a valid UUID
+ if info.has_key("config.uuid"):
+ machines[info["name"]] = (info["config.uuid"], info["summary.runtime.powerState"])
+ uuid[info["config.uuid"]] = info["summary.runtime.powerState"]
+ mappingToUUID[m.obj.value] = info["config.uuid"]
return (machines, uuid, mappingToUUID)
@@ -77,7 +80,7 @@ def get_power_status(conn, options):
propSpec = conn.factory.create('ns0:PropertySpec')
propSpec.all = False
- propSpec.pathSet = ["name", "summary.runtime.powerState", "config.uuid", "summary", "config", "capability", "network"]
+ propSpec.pathSet = ["name", "summary.runtime.powerState", "config.uuid"]
propSpec.type = "VirtualMachine"
propFilterSpec = conn.factory.create('ns0:PropertyFilterSpec')
@@ -101,6 +104,9 @@ def get_power_status(conn, options):
machines.update(more_machines)
uuid.update(more_uuid)
mappingToUUID.update(more_mappingToUUID)
+ # Do not run unnecessary SOAP requests
+ if options.has_key("-U") and options["-U"] in uuid:
+ break
if ["list", "monitor"].count(options["-o"]) == 1:
return machines
11 years, 6 months
cluster: STABLE32 - fenced: silence dbus error
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=5a4cc0c8883...
Commit: 5a4cc0c888396c4efc8d7f6ffffd0e960b5259cb
Parent: 13b5aea8fb2fe7f7e59b049dc4c45e8777b2fbbb
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Oct 5 10:19:35 2012 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Oct 5 10:26:16 2012 -0500
fenced: silence dbus error
Don't log unimportant error that
worries people.
bz 861340
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
fence/fenced/dbus.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/fenced/dbus.c b/fence/fenced/dbus.c
index 5d1e1d5..9d7be2f 100644
--- a/fence/fenced/dbus.c
+++ b/fence/fenced/dbus.c
@@ -13,7 +13,7 @@ static DBusConnection *bus = NULL;
void fd_dbus_init(void)
{
if (!(bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, NULL))) {
- log_error("failed to get dbus connection");
+ log_debug("failed to get dbus connection");
} else {
log_debug("connected to dbus %s", dbus_bus_get_unique_name(bus));
}
11 years, 6 months
cluster: RHEL6 - fenced: silence dbus error
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=de7ae8fdcd3...
Commit: de7ae8fdcd3b46a23affbbe397f3e14462e0c905
Parent: 8d3265089fcb45cb6653c2c6947f78ab9e996be5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Oct 5 10:19:35 2012 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Oct 5 10:19:35 2012 -0500
fenced: silence dbus error
Don't log unimportant error that
worries people.
bz 861340
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
fence/fenced/dbus.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/fenced/dbus.c b/fence/fenced/dbus.c
index 5d1e1d5..9d7be2f 100644
--- a/fence/fenced/dbus.c
+++ b/fence/fenced/dbus.c
@@ -13,7 +13,7 @@ static DBusConnection *bus = NULL;
void fd_dbus_init(void)
{
if (!(bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, NULL))) {
- log_error("failed to get dbus connection");
+ log_debug("failed to get dbus connection");
} else {
log_debug("connected to dbus %s", dbus_bus_get_unique_name(bus));
}
11 years, 6 months
fence-agents: the annotated tag v3.1.10 has been created
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=b5c493...
Commit: b5c493d1db0b71fef9b8b639c7d6b1b76c9a512a
Parent: 0000000000000000000000000000000000000000
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: 2012-10-04 14:20 +0000
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: 2012-10-04 14:20 +0000
annotated tag: v3.1.10 has been created
at b5c493d1db0b71fef9b8b639c7d6b1b76c9a512a (tag)
tagging 582aa5f7f285e225928765fff50979154eafa138 (commit)
replaces v3.1.9
v3.1.10 release
Fabio M. Di Nitto (1):
eaton_snmp: add tested models
Marek 'marx' Grac (3):
fence_eaton_snmp: Fix default power-wait option value, remove support for -n switch:port
fence_virsh: Support for using sudo for running virsh
fence_vmware_soap: Faster fencing, fix crash on VM without valid UUID
Masatake YAMATO (1):
fence_kdump: Typo in fence_kdump_send man page.
Ryan O'Hara (1):
Add metadata to list of accepted actions.
11 years, 6 months
fence-agents: RHEL6 - fence_ilo2 was not correctly cleaned by Makefile
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=29063a...
Commit: 29063ac151e702fa184c2e201dd41652ff329da8
Parent: e1b648e6247e0b98e55a64d45d38c28464648a8c
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Jul 26 14:35:44 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Oct 4 10:50:13 2012 +0200
fence_ilo2 was not correctly cleaned by Makefile
Related: rhbz#800650
---
fence/agents/ilo/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/ilo/Makefile.am b/fence/agents/ilo/Makefile.am
index 120727a..8df9a39 100644
--- a/fence/agents/ilo/Makefile.am
+++ b/fence/agents/ilo/Makefile.am
@@ -20,4 +20,4 @@ include $(top_srcdir)/make/fencebuild.mk
include $(top_srcdir)/make/fenceman.mk
clean-local: clean-man
- rm -f $(TARGET)
+ rm -f $(TARGET) $(SYMTARGET)
11 years, 6 months
fence-agents: RHEL6 - Add fence agents specific for HP iLO2, iLO3, IMM and iDrac
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=e1b648...
Commit: e1b648e6247e0b98e55a64d45d38c28464648a8c
Parent: ce7859f3a34d76aaa8cb7361e7996c419904bc67
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Jul 26 14:27:14 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Oct 4 10:49:37 2012 +0200
Add fence agents specific for HP iLO2, iLO3, IMM and iDrac
These fence agents runs 'standard' fence agent (fence_ilo, fence_ipmilan) with correct timeout options, encryption, snmp_version, ... Originally they were supposed to be symbolic links but this approach is not recommended so they regular files.
Resolves: rhbz#800650
---
fence/agents/ilo/Makefile.am | 10 ++++++++--
fence/agents/ilo/fence_ilo.py | 1 +
fence/agents/ipmilan/Makefile.am | 11 +++++++++--
fence/agents/ipmilan/ipmilan.c | 10 ++++++++++
fence/agents/lib/fence2man.xsl | 4 ++++
fence/agents/lib/fencing.py.py | 3 +++
6 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/fence/agents/ilo/Makefile.am b/fence/agents/ilo/Makefile.am
index 7b44f59..120727a 100644
--- a/fence/agents/ilo/Makefile.am
+++ b/fence/agents/ilo/Makefile.am
@@ -2,13 +2,19 @@ MAINTAINERCLEANFILES = Makefile.in
TARGET = fence_ilo
+SYMTARGET = fence_ilo2
+
SRC = $(TARGET).py
EXTRA_DIST = $(SRC)
-sbin_SCRIPTS = $(TARGET)
+sbin_SCRIPTS = $(TARGET) $(SYMTARGET)
+
+man_MANS = $(TARGET).8 $(SYMTARGET).8
+
+$(SYMTARGET): $(TARGET)
+ cp $^ $@
-man_MANS = $(TARGET).8
include $(top_srcdir)/make/fencebuild.mk
include $(top_srcdir)/make/fenceman.mk
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index f70dc9c..d4e34df 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -82,6 +82,7 @@ The agent opens an SSL connection to the iLO card. Once the SSL \
connection is established, the agent is able to communicate with \
the iLO card through an XML stream."
docs["vendorurl"] = "http://www.hp.com"
+ docs["symlink"] = [("fence_ilo2", "Fence agent for HP iLO2")]
show_docs(options, docs)
##
diff --git a/fence/agents/ipmilan/Makefile.am b/fence/agents/ipmilan/Makefile.am
index 17ac8f2..c4fc636 100644
--- a/fence/agents/ipmilan/Makefile.am
+++ b/fence/agents/ipmilan/Makefile.am
@@ -2,15 +2,22 @@ MAINTAINERCLEANFILES = Makefile.in
TARGET = fence_ipmilan
+SYMTARGET = fence_ilo3 fence_imm fence_idrac
+
sbin_PROGRAMS = $(TARGET)
+sbin_SCRIPTS = $(SYMTARGET)
+
noinst_HEADERS = expect.h
fence_ipmilan_SOURCES = expect.c ipmilan.c
-man_MANS = $(TARGET).8
+man_MANS = $(TARGET).8 $(SYMTARGET:%=%.8)
+
+$(SYMTARGET): $(TARGET)
+ cp $^ $@
include $(top_srcdir)/make/fencemanc.mk
clean-local: clean-man
- rm -f $(TARGET)
+ rm -f $(TARGET) $(SYMTARGET)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index ef2b582..d1a0530 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -903,6 +903,9 @@ static void print_xml_metadata(char *pname) {
printf("%s\n","<?xml version=\"1.0\" ?>");
printf("%s%s%s\n","<resource-agent name=\"",pname,"\" shortdesc=\"Fence agent for IPMI over LAN\">");
+ printf("<symlink name=\"fence_ilo3\" shortdesc=\"Fence agent for HP iLO2\"/>\n");
+ printf("<symlink name=\"fence_idrac\" shortdesc=\"Fence agent for Dell iDRAC\"/>\n");
+ printf("<symlink name=\"fence_imm\" shortdesc=\"Fence agent for IBM Integrated Management Module\"/>\n");
printf("<longdesc>\n");
printf("fence_ipmilan is an I/O Fencing agent which can be used with "
"machines controlled by IPMI. This agent calls support software "
@@ -967,6 +970,7 @@ main(int argc, char **argv)
int cipher=-1;
int print_final_status=1;
int translated_ret = -1;
+ char *filename;
memset(ip, 0, sizeof(ip));
memset(authtype, 0, sizeof(authtype));
@@ -977,6 +981,12 @@ main(int argc, char **argv)
memset(method, 0, sizeof(method));
memset(delay, 0, sizeof(delay));
+ if (!strcmp(pname, "fence_ilo3")) {
+ lanplus = 1;
+ down_sleep = 4;
+ strncpy(method, "cycle\0", 6);
+ }
+
if (argc > 1) {
/*
Parse command line options if any were specified
diff --git a/fence/agents/lib/fence2man.xsl b/fence/agents/lib/fence2man.xsl
index 0fd71be..89baf7f 100644
--- a/fence/agents/lib/fence2man.xsl
+++ b/fence/agents/lib/fence2man.xsl
@@ -33,6 +33,10 @@
.TH FENCE_AGENT 8 2009-10-20 "<xsl:value-of select="@name"/> (Fence Agent)"
.SH NAME
<xsl:value-of select="@name" /> - <xsl:value-of select="@shortdesc" />
+<xsl:for-each select="symlink">
+.P
+<xsl:value-of select="@name" /> - <xsl:value-of select="@shortdesc" /> (symlink)
+</xsl:for-each>
.SH DESCRIPTION
.P
<xsl:value-of select="longdesc"/>
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index a9c287a..cb8ec26 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -471,6 +471,9 @@ def metadata(avail_opt, options, docs):
print "<?xml version=\"1.0\" ?>"
print "<resource-agent name=\"" + os.path.basename(sys.argv[0]) + "\" shortdesc=\"" + docs["shortdesc"] + "\" >"
+ if "symlink" in docs:
+ for (symlink,desc) in docs["symlink"]:
+ print "<symlink name=\"" + symlink + "\" shortdesc=\"" + desc + "\"/>"
print "<longdesc>" + docs["longdesc"] + "</longdesc>"
if docs.has_key("vendorurl"):
print "<vendor-url>" + docs["vendorurl"] + "</vendor-url>"
11 years, 6 months
fence-agents: RHEL6 - fence_ipdu: Minor fixes to fence agent
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=ce7859...
Commit: ce7859f3a34d76aaa8cb7361e7996c419904bc67
Parent: 0199cc9a5add0b4d3a6b0da1a5dcacba2539d232
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Jul 23 11:24:43 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Oct 4 10:49:03 2012 +0200
fence_ipdu: Minor fixes to fence agent
* replace code to use 'default' value
* remove code for backward compatibility with old options (-n switch:port)
Resolves: rhbz#740869
---
fence/agents/ipdu/fence_ipdu.py | 13 ++-----------
1 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index 9c135e6..aac0b7d 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -49,7 +49,7 @@ def ipdu_set_device(conn,options):
agents_dir={'.1.3.6.1.4.1.2.6.223':IBMiPDU,
None:IBMiPDU}
- # First resolve type of APC
+ # First resolve type of PDU device
pdu_type=conn.walk(OID_SYS_OBJECT_ID)
if (not ((len(pdu_type)==1) and (agents_dir.has_key(pdu_type[0][1])))):
@@ -133,6 +133,7 @@ def get_outlets_status(conn, options):
def ipdu_snmp_define_defaults():
all_opt["snmp_version"]["default"]="3"
all_opt["community"]["default"]="private"
+ all_opt["switch"]["default"]="1"
device=IBMiPDU
# Main agent method
@@ -152,16 +153,6 @@ def main():
options=check_input(device_opt,process_input(device_opt))
- ## Support for -n [switch]:[plug] notation that was used before
- if ((options.has_key("-n")) and (-1 != options["-n"].find(":"))):
- (switch, plug) = options["-n"].split(":", 1)
- if ((switch.isdigit()) and (plug.isdigit())):
- options["-s"] = switch
- options["-n"] = plug
-
- if (not (options.has_key("-s"))):
- options["-s"]="1"
-
docs = { }
docs["shortdesc"] = "Fence agent for iPDU over SNMP"
docs["longdesc"] = "fence_ipdu is an I/O Fencing agent \
11 years, 6 months
fence-agents: RHEL6 - Add iPDU fencing agent for model 46M4002
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=0199cc...
Commit: 0199cc9a5add0b4d3a6b0da1a5dcacba2539d232
Parent: 54278678366ab2be264d634fe17a305236200188
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Fri Jul 20 15:43:14 2012 -0400
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Oct 4 10:48:27 2012 +0200
Add iPDU fencing agent for model 46M4002
Resolves: rhbz#740869
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Signed-off-by: Marek 'marx' Grac <mgrac(a)redhat.com>
---
.gitignore | 1 +
configure.ac | 1 +
fence/agents/ipdu/Makefile.am | 17 ++++
fence/agents/ipdu/fence_ipdu.py | 179 +++++++++++++++++++++++++++++++++++++++
4 files changed, 198 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 3a182d8..c1b028c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,7 @@ fence/agents/ifmib/fence_ifmib
fence/agents/ilo/fence_ilo
fence/agents/ilo_mp/fence_ilo_mp
fence/agents/intelmodular/fence_intelmodular
+fence/agents/ipdu/fence_ipdu
fence/agents/ipmilan/fence_ipmilan
fence/agents/ldom/fence_ldom
fence/agents/lib/fencing.py
diff --git a/configure.ac b/configure.ac
index 3e71f43..ec0a368 100644
--- a/configure.ac
+++ b/configure.ac
@@ -264,6 +264,7 @@ AC_CONFIG_FILES([Makefile
fence/agents/eps/Makefile
fence/agents/hpblade/Makefile
fence/agents/ibmblade/Makefile
+ fence/agents/ipdu/Makefile
fence/agents/ifmib/Makefile
fence/agents/ilo/Makefile
fence/agents/ilo_mp/Makefile
diff --git a/fence/agents/ipdu/Makefile.am b/fence/agents/ipdu/Makefile.am
new file mode 100644
index 0000000..fb02cc8
--- /dev/null
+++ b/fence/agents/ipdu/Makefile.am
@@ -0,0 +1,17 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+TARGET = fence_ipdu
+
+SRC = $(TARGET).py
+
+EXTRA_DIST = $(SRC)
+
+sbin_SCRIPTS = $(TARGET)
+
+man_MANS = $(TARGET).8
+
+include $(top_srcdir)/make/fencebuild.mk
+include $(top_srcdir)/make/fenceman.mk
+
+clean-local: clean-man
+ rm -f $(TARGET)
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
new file mode 100644
index 0000000..9c135e6
--- /dev/null
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -0,0 +1,179 @@
+#!/usr/bin/python
+
+# The Following agent has been tested on:
+# IBM iPDU model 46M4002
+# Firmware release OPDP_sIBM_v01.2_1
+#
+
+import sys, re, pexpect
+sys.path.append("/usr/share/fence")
+from fencing import *
+from fencing_snmp import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION="IBM iPDU SNMP fence agent"
+REDHAT_COPYRIGHT=""
+BUILD_DATE=""
+#END_VERSION_GENERATION
+
+### CONSTANTS ###
+# oid defining fence device
+OID_SYS_OBJECT_ID='.1.3.6.1.2.1.1.2.0'
+
+### GLOBAL VARIABLES ###
+# Device - see IBM iPDU
+device=None
+
+# Port ID
+port_id=None
+# Switch ID
+switch_id=None
+
+# Classes describing Device params
+class IBMiPDU:
+ # iPDU
+ status_oid= '.1.3.6.1.4.1.2.6.223.8.2.2.1.11.%d'
+ control_oid= '.1.3.6.1.4.1.2.6.223.8.2.2.1.11.%d'
+ outlet_table_oid='.1.3.6.1.4.1.2.6.223.8.2.2.1.2'
+ ident_str="IBM iPDU"
+ state_on=1
+ state_off=0
+ turn_on=1
+ turn_off=0
+ has_switches=False
+
+### FUNCTIONS ###
+def ipdu_set_device(conn,options):
+ global device
+
+ agents_dir={'.1.3.6.1.4.1.2.6.223':IBMiPDU,
+ None:IBMiPDU}
+
+ # First resolve type of APC
+ pdu_type=conn.walk(OID_SYS_OBJECT_ID)
+
+ if (not ((len(pdu_type)==1) and (agents_dir.has_key(pdu_type[0][1])))):
+ pdu_type=[[None,None]]
+
+ device=agents_dir[pdu_type[0][1]]
+
+ conn.log_command("Trying %s"%(device.ident_str))
+
+def ipdu_resolv_port_id(conn,options):
+ global port_id,switch_id,device
+
+ if (device==None):
+ ipdu_set_device(conn,options)
+
+ # Now we resolv port_id/switch_id
+ if ((options["-n"].isdigit()) and ((not device.has_switches) or (options["-s"].isdigit()))):
+ port_id=int(options["-n"])
+
+ if (device.has_switches):
+ switch_id=int(options["-s"])
+ else:
+ table=conn.walk(device.outlet_table_oid,30)
+
+ for x in table:
+ if (x[1].strip('"')==options["-n"]):
+ t=x[0].split('.')
+ if (device.has_switches):
+ port_id=int(t[len(t)-1])
+ switch_id=int(t[len(t)-3])
+ else:
+ port_id=int(t[len(t)-1])
+
+ if (port_id==None):
+ fail_usage("Can't find port with name %s!"%(options["-n"]))
+
+def get_power_status(conn,options):
+ global port_id,switch_id,device
+
+ if (port_id==None):
+ ipdu_resolv_port_id(conn,options)
+
+ oid=((device.has_switches) and device.status_oid%(switch_id,port_id) or device.status_oid%(port_id))
+
+ (oid,status)=conn.get(oid)
+ return (status==str(device.state_on) and "on" or "off")
+
+def set_power_status(conn, options):
+ global port_id,switch_id,device
+
+ if (port_id==None):
+ ipdu_resolv_port_id(conn,options)
+
+ oid=((device.has_switches) and device.control_oid%(switch_id,port_id) or device.control_oid%(port_id))
+
+ conn.set(oid,(options["-o"]=="on" and device.turn_on or device.turn_off))
+
+
+def get_outlets_status(conn, options):
+ global device
+
+ result={}
+
+ if (device==None):
+ ipdu_set_device(conn,options)
+
+ res_ports=conn.walk(device.outlet_table_oid,30)
+
+ for x in res_ports:
+ t=x[0].split('.')
+
+ port_num=((device.has_switches) and "%s:%s"%(t[len(t)-3],t[len(t)-1]) or "%s"%(t[len(t)-1]))
+
+ port_name=x[1].strip('"')
+ port_status=""
+ result[port_num]=(port_name,port_status)
+
+ return result
+
+# Define new options
+def ipdu_snmp_define_defaults():
+ all_opt["snmp_version"]["default"]="3"
+ all_opt["community"]["default"]="private"
+ device=IBMiPDU
+
+# Main agent method
+def main():
+ 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","inet4_only","inet6_only",
+ "power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
+
+ atexit.register(atexit_handler)
+
+ snmp_define_defaults ()
+ ipdu_snmp_define_defaults()
+
+ options=check_input(device_opt,process_input(device_opt))
+
+ ## Support for -n [switch]:[plug] notation that was used before
+ if ((options.has_key("-n")) and (-1 != options["-n"].find(":"))):
+ (switch, plug) = options["-n"].split(":", 1)
+ if ((switch.isdigit()) and (plug.isdigit())):
+ options["-s"] = switch
+ options["-n"] = plug
+
+ if (not (options.has_key("-s"))):
+ options["-s"]="1"
+
+ docs = { }
+ docs["shortdesc"] = "Fence agent for iPDU over SNMP"
+ docs["longdesc"] = "fence_ipdu is an I/O Fencing agent \
+which can be used with the IBM iPDU network power switch. It logs \
+into a device via SNMP and reboots a specified outlet. It supports \
+SNMP v3 with all combinations of authenticity/privacy settings."
+ docs["vendorurl"] = "http://www.ibm.com"
+ show_docs(options, docs)
+
+ # Operate the fencing device
+ result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+
+ sys.exit(result)
+if __name__ == "__main__":
+ main()
11 years, 6 months