This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
cluster: RHEL5 - fencing: #508722 - Fence agent for HP iLO 2 MP(agent included)
- From: Marek GrÃc <marx at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Thu, 30 Jul 2009 10:06:28 +0000 (UTC)
- Subject: cluster: RHEL5 - fencing: #508722 - Fence agent for HP iLO 2 MP(agent included)
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=0c68763dfaed3b2ca3d7f5e107eb813b3b38aee3
Commit: 0c68763dfaed3b2ca3d7f5e107eb813b3b38aee3
Parent: d0517e88112d8e04be3dbac15ffba11f823250e0
Author: Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate: Thu Jul 30 12:01:50 2009 +0200
Committer: Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Thu Jul 30 12:01:50 2009 +0200
fencing: #508722 - Fence agent for HP iLO 2 MP (agent included)
Forgot to add agent itself to previous commit.
---
fence/agents/ilo_mp/Makefile | 38 ++++++++++++++++++++++
fence/agents/ilo_mp/fence_ilo_mp.py | 59 +++++++++++++++++++++++++++++++++++
2 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/fence/agents/ilo_mp/Makefile b/fence/agents/ilo_mp/Makefile
new file mode 100644
index 0000000..db03a8a
--- /dev/null
+++ b/fence/agents/ilo_mp/Makefile
@@ -0,0 +1,38 @@
+###############################################################################
+###############################################################################
+##
+## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
+## Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+##
+## This copyrighted material is made available to anyone wishing to use,
+## modify, copy, or redistribute it subject to the terms and conditions
+## of the GNU General Public License v.2.
+##
+###############################################################################
+###############################################################################
+
+SOURCE= fence_ilo_mp.py
+TARGET= fence_ilo_mp
+
+top_srcdir=../..
+include ${top_srcdir}/make/defines.mk
+
+all: $(TARGET)
+
+fence_ilo_mp: fence_ilo_mp.py
+ : > $(TARGET)
+ awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(SOURCE) >> $(TARGET)
+ echo "FENCE_RELEASE_NAME=\"${RELEASE}\";" >> $(TARGET)
+ ${top_srcdir}/scripts/define2var ${top_srcdir}/config/copyright.cf sh REDHAT_COPYRIGHT >> $(TARGET)
+ echo "BUILD_DATE=\"(built `date`)\";" >> $(TARGET)
+ awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(SOURCE) >> $(TARGET)
+ chmod +x $(TARGET)
+
+install: all
+ if [ ! -d ${sbindir} ]; then \
+ install -d ${sbindir}; \
+ fi
+ install -m755 ${TARGET} ${sbindir}
+
+clean:
+ rm -f $(TARGET)
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
new file mode 100644
index 0000000..7b3dabe
--- /dev/null
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+##
+## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
+##
+#####
+
+import sys, re, pexpect, socket
+sys.path.append("/usr/lib/fence")
+from fencing import *
+
+#BEGIN_VERSION_GENERATION
+FENCE_RELEASE_NAME=""
+REDHAT_COPYRIGHT=""
+BUILD_DATE=""
+#END_VERSION_GENERATION
+
+def get_power_status(conn, options):
+ conn.send("show /system1\n")
+ conn.log_expect(options, "EnabledState=(.*)", POWER_TIMEOUT)
+
+ status = conn.match.group(1)
+
+ if status.startswith("Enabled"):
+ return "on"
+ else:
+ return "off"
+
+def set_power_status(conn, options):
+ if options["-o"] == "on":
+ conn.send("start /system1\n")
+ else:
+ conn.send("stop -f /system1\n")
+ return
+
+def main():
+ device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
+ "action", "ipaddr", "login", "passwd", "passwd_script",
+ "secure", "cmd_prompt", "ipport", "login_eol_lf" ]
+
+ options = check_input(device_opt, process_input(device_opt))
+
+ ##
+ ## Login
+ ####
+
+ options["-c"] = "MP>"
+ conn = fence_login(options)
+ conn.send("SMCLP\n")
+
+ ##
+ ## Fence operations
+ ####
+ fence_action(conn, options, set_power_status, get_power_status)
+
+ conn.send("exit\n")
+
+if __name__ == "__main__":
+ main()