From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10106 invoked by alias); 30 Jul 2009 10:42:34 -0000 Received: (qmail 10099 invoked by alias); 30 Jul 2009 10:42:34 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE2 - fencing: #508722 - Fence agent for HP iLO 2 MP To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE2 X-Git-Reftype: branch X-Git-Oldrev: 790e78730c64db0335eb753e7c13c3a83d8264e2 X-Git-Newrev: ff488f4c8dcac3e5c09a6eae77e1c083663a18f8 From: =?utf-8?q?Marek_Gr=C3=A1c?= Message-Id: <20090730104210.DC27612035D@lists.fedorahosted.org> Date: Thu, 30 Jul 2009 10:42:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00135.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ff488f4c8dcac3e5c09a6eae77e1c083663a18f8 Commit: ff488f4c8dcac3e5c09a6eae77e1c083663a18f8 Parent: 790e78730c64db0335eb753e7c13c3a83d8264e2 Author: Marek 'marx' Grac AuthorDate: Thu Jul 30 12:36:15 2009 +0200 Committer: Marek 'marx' Grac CommitterDate: Thu Jul 30 12:36:15 2009 +0200 fencing: #508722 - Fence agent for HP iLO 2 MP New fence agent for HP iLO2 MP used in Blade Servers. It uses SMASH interface over telnet/ssh. fence_ilo uses RIBCL over SSL what is not supported on these machines. --- fence/agents/ilo_mp/Makefile | 5 +++ fence/agents/ilo_mp/fence_ilo_mp.py | 59 +++++++++++++++++++++++++++++++++++ fence/agents/lib/fencing.py.py | 3 ++ 3 files changed, 67 insertions(+), 0 deletions(-) diff --git a/fence/agents/ilo_mp/Makefile b/fence/agents/ilo_mp/Makefile new file mode 100644 index 0000000..6405a8f --- /dev/null +++ b/fence/agents/ilo_mp/Makefile @@ -0,0 +1,5 @@ +include ../../../make/defines.mk + +TARGET= fence_ilo_mp + +include $(OBJDIR)/make/fencebuild.mk 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() diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index 57bc246..bfa358f 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -321,7 +321,10 @@ def process_input(avail_opt): ## password script to set a correct password ###### def check_input(device_opt, opt): + global all_opt + options = dict(opt) + options["device_opt"] = device_opt if options.has_key("-h"): usage(device_opt)