Skip to contentSkip to conversation

fence_ipmilan: port fencing agent to fencing library

PATCH New Ondrej Mular 4 participants 5 messages Nov 21, 2013 – Nov 25, 2013 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 fence_ipmilan: port fencing agent to fencing library

In reply to a message not in the archive

This is port of fence_ipmilan to fencing library. Also added fail message to fencing library if tool (e.g. impitool, amttool...) is not accessible.

---
 fence/agents/ipmilan/fence_ipmilan.py | 184 ++++++++++++++++++++++++++++++++++
 fence/agents/lib/fencing.py.py        |   4 +-
 2 files changed, 187 insertions(+), 1 deletion(-)
 create mode 100644 fence/agents/ipmilan/fence_ipmilan.py
fence/agents/ipmilan/fence_ipmilan.py new file +184 -0
new file mode 100644
index 0000000..5c32690
@@ -0,0 +1,184 @@
+#!/usr/bin/python
+
+import sys, shlex, stat, subprocess, re, os
+from pipes import quote
+sys.path.append("@FENCEAGENTSLIBDIR@")
+from fencing import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION=""
+REDHAT_COPYRIGHT=""
+BUILD_DATE=""
+#END_VERSION_GENERATION
+
+PATHS = ["/usr/local/bull/NSMasterHW/bin/ipmitool",
+    "/usr/bin/ipmitool",
+    "/usr/sbin/ipmitool",
+    "/bin/ipmitool",
+    "/sbin/ipmitool",
+    "/usr/local/bin/ipmitool",
+    "/usr/local/sbin/ipmitool"]
+
+def get_power_status(_, options):
+
+    cmd = create_command(options, "status")
+
+    if options["log"] >= LOG_MODE_VERBOSE:
+        options["debug_fh"].write("executing: " + cmd + "\n")
+
+    try:
+        process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    except OSError, ex:
+        print ex
+        fail(EC_TOOL_FAIL)
+
+    process.wait()
+
+    out = process.communicate()
+    process.stdout.close()
+
+    match = re.search('[Cc]hassis [Pp]ower is [\\s]*([a-zA-Z]{2,3})', str(out))
+    status = match.group(1) if match else None
+
+    return status
+
+def set_power_status(_, options):
+
+    cmd = create_command(options, options["--action"])
+
+    if options["log"] >= LOG_MODE_VERBOSE:
+        options["debug_fh"].write("executing: " + cmd + "\n")
+
+    null = open('/dev/null', 'w')
+    try:
+        process = subprocess.Popen(shlex.split(cmd), stdout=null, stderr=null)
+    except OSError:
+        null.close()
+        fail(EC_TOOL_FAIL)
+
+    process.wait()
+    null.close()
+
+    return
+
+def is_executable(path):
+    if os.path.exists(path):
+        stats = os.stat(path)
+        if stat.S_ISREG(stats.st_mode) and os.access(path, os.X_OK):
+            return True
+    return False
+
+def get_ipmitool_path():
+    for path in PATHS:
+        if is_executable(path):
+            return path
+    return None
+
+def create_command(options, action):    
+    cmd = options["ipmitool_path"]
+
+    # --lanplus / -L
+    if options.has_key("--lanplus"):
+        cmd += " -I lanplus"
+    else:
+        cmd += " -I lan"
+    # --ip / -a
+    cmd += " -H " + options["--ip"]
+
+    # --username / -l
+    if options.has_key("--username") and len(options["--username"]) != 0:
+        cmd += " -U " + quote(options["--username"])
+
+    # --auth / -A
+    if options.has_key("--auth"):
+        cmd += " -A " + options["--auth"]
+
+    # --password / -p
+    if options.has_key("--password"):
+        cmd += " -P " + quote(options["--password"])
+
+    # --cipher / -C
+    cmd += " -C " + options["--cipher"]
+
+    # --port / -n
+    if options.has_key("--ipport"):
+        cmd += " -p " + options["--ipport"]
+
+    if options.has_key("--privlvl"):
+        cmd += " -L " + options["--privlvl"]
+
+    # --action / -o
+    cmd += " chassis power " + action
+
+     # --use-sudo / -d
+    if options.has_key("--use-sudo"):
+        cmd = SUDO_PATH + " " + cmd
+
+    return cmd
+
+def define_new_opts():
+    all_opt["lanplus"] = {
+        "getopt" : "L",
+        "longopt" : "lanplus",
+        "help" : "-L, --lanplus    Use Lanplus to improve security of connection",
+        "required" : "0",
+        "shortdesc" : "Use Lanplus to improve security of connection",
+        "order": 1
+        }
+    all_opt["auth"] = {
+        "getopt" : "A:",
+        "longopt" : "auth",
+        "help" : "-A, --auth=[auth]    IPMI Lan Auth type (md5|password|none)",
+        "required" : "0",
+        "shortdesc" : "IPMI Lan Auth type.",
+        "default" : "none",
+        "choices" : ["md5", "password", "none"],
+        "order": 1
+        }
+    all_opt["cipher"] = {
+        "getopt" : "C:",
+        "longopt" : "cipher",
+        "help" : "-C, --cipher=[cipher]    Ciphersuite to use (same as ipmitool -C parameter)",
+        "required" : "0",
+        "shortdesc" : "Ciphersuite to use (same as ipmitool -C parameter)",
+        "default" : "0",
+        "order": 1
+        }
+    all_opt["privlvl"] = {
+        "getopt" : "P:",
+        "longopt" : "privlvl",
+        "help" : "-P, --privlvl=[level]    Privilege level on IPMI device (callback|user|operator|administrator)",
+        "required" : "0",
+        "shortdesc" : "Privilege level on IPMI device",
+        "default" : "administrator",
+        "choices" : ["callback", "user", "operator", "administrator"],
+        "order": 1
+        }
+
+def main():
+
+    atexit.register(atexit_handler)
+
+    device_opt = [ "ipaddr", "login", "no_login", "no_password", "passwd", "lanplus", "auth", "cipher", "privlvl", "sudo"]
+    define_new_opts()
+
+    all_opt["ipport"]["default"] = "623"
+
+    options = check_input(device_opt, process_input(device_opt))
+    options["ipmitool_path"] = get_ipmitool_path()
+
+    if options["ipmitool_path"] is None:
+        fail(EC_TOOL_FAIL)
+
+    docs = { }
+    docs["shortdesc"] = "Fence agent for IPMI"
+    docs["longdesc"] = "Fence agent for IPMI"
+    docs["vendorurl"] = ""
+    show_docs(options, docs)
+
+    result = fence_action(None, options, set_power_status, get_power_status, None)
+
+    sys.exit(result)
+
+if __name__ == "__main__":
+    main()
fence/agents/lib/fencing.py.py +3 -1
index 0a3b122..b4abfb2 100644
@@ -25,6 +25,7 @@ EC_STATUS          = 8
 EC_STATUS_HMC      = 9
 EC_PASSWORD_MISSING = 10
 EC_INVALID_PRIVILEGES = 11
+EC_TOOL_FAIL	  = 12
 
 TELNET_PATH = "/usr/bin/telnet"
 SSH_PATH    = "/usr/bin/ssh"
@@ -412,7 +413,8 @@ def fail(error_code):
 		EC_STATUS_HMC :
 			"Failed: Either unable to obtain correct plug status, partition is not available or incorrect HMC version used",
 		EC_PASSWORD_MISSING : "Failed: You have to set login password",
-		EC_INVALID_PRIVILEGES : "Failed: The user does not have the correct privileges to do the requested action."
+		EC_INVALID_PRIVILEGES : "Failed: The user does not have the correct privileges to do the requested action.",
+		EC_TOOL_FAIL: "Failed: Required tool not found or not accessible."
 	}[error_code] + "\n"
 	sys.stderr.write(message)
 	syslog.syslog(syslog.LOG_ERR, message)
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/2 fence_ipmilan: port fencing agent to fencing library

Hi Ondrej,

Quoted 24 lines · Ondrej Mular

This is port of fence_ipmilan to fencing library. Also added fail message to fencing library if tool (e.g. impitool, amttool...) is not accessible.

---
 fence/agents/ipmilan/fence_ipmilan.py | 184 ++++++++++++++++++++++++++++++++++
 fence/agents/lib/fencing.py.py        |   4 +-
 2 files changed, 187 insertions(+), 1 deletion(-)
 create mode 100644 fence/agents/ipmilan/fence_ipmilan.py
fence/agents/ipmilan/fence_ipmilan.py new file +10 -0
new file mode 100644
index 0000000..5c32690
@@ -0,0 +1,184 @@
+#!/usr/bin/python
+
+import sys, shlex, stat, subprocess, re, os
+from pipes import quote
+sys.path.append("@FENCEAGENTSLIBDIR@")
+from fencing import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION=""
+REDHAT_COPYRIGHT=""

fence/agents/ipmilan/fence_ipmilan.py line 20

Quoted 10 lines
fence/agents/ipmilan/fence_ipmilan.py new file +10 -0
+BUILD_DATE=""
+#END_VERSION_GENERATION
+
+PATHS = ["/usr/local/bull/NSMasterHW/bin/ipmitool",
+    "/usr/bin/ipmitool",
+    "/usr/sbin/ipmitool",
+    "/bin/ipmitool",
+    "/sbin/ipmitool",
+    "/usr/local/bin/ipmitool",
+    "/usr/local/sbin/ipmitool"]

this hard-cording it bad.

Always use OS define PATH and if really necessary allow user to override with an option (for example: --pathtoipmitool=/usr/local....)

Fabio

Quoted 187 lines
fence/agents/ipmilan/fence_ipmilan.py new file +164 -0
+
+def get_power_status(_, options):
+
+    cmd = create_command(options, "status")
+
+    if options["log"] >= LOG_MODE_VERBOSE:
+        options["debug_fh"].write("executing: " + cmd + "\n")
+
+    try:
+        process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    except OSError, ex:
+        print ex
+        fail(EC_TOOL_FAIL)
+
+    process.wait()
+
+    out = process.communicate()
+    process.stdout.close()
+
+    match = re.search('[Cc]hassis [Pp]ower is [\\s]*([a-zA-Z]{2,3})', str(out))
+    status = match.group(1) if match else None
+
+    return status
+
+def set_power_status(_, options):
+
+    cmd = create_command(options, options["--action"])
+
+    if options["log"] >= LOG_MODE_VERBOSE:
+        options["debug_fh"].write("executing: " + cmd + "\n")
+
+    null = open('/dev/null', 'w')
+    try:
+        process = subprocess.Popen(shlex.split(cmd), stdout=null, stderr=null)
+    except OSError:
+        null.close()
+        fail(EC_TOOL_FAIL)
+
+    process.wait()
+    null.close()
+
+    return
+
+def is_executable(path):
+    if os.path.exists(path):
+        stats = os.stat(path)
+        if stat.S_ISREG(stats.st_mode) and os.access(path, os.X_OK):
+            return True
+    return False
+
+def get_ipmitool_path():
+    for path in PATHS:
+        if is_executable(path):
+            return path
+    return None
+
+def create_command(options, action):    
+    cmd = options["ipmitool_path"]
+
+    # --lanplus / -L
+    if options.has_key("--lanplus"):
+        cmd += " -I lanplus"
+    else:
+        cmd += " -I lan"
+    # --ip / -a
+    cmd += " -H " + options["--ip"]
+
+    # --username / -l
+    if options.has_key("--username") and len(options["--username"]) != 0:
+        cmd += " -U " + quote(options["--username"])
+
+    # --auth / -A
+    if options.has_key("--auth"):
+        cmd += " -A " + options["--auth"]
+
+    # --password / -p
+    if options.has_key("--password"):
+        cmd += " -P " + quote(options["--password"])
+
+    # --cipher / -C
+    cmd += " -C " + options["--cipher"]
+
+    # --port / -n
+    if options.has_key("--ipport"):
+        cmd += " -p " + options["--ipport"]
+
+    if options.has_key("--privlvl"):
+        cmd += " -L " + options["--privlvl"]
+
+    # --action / -o
+    cmd += " chassis power " + action
+
+     # --use-sudo / -d
+    if options.has_key("--use-sudo"):
+        cmd = SUDO_PATH + " " + cmd
+
+    return cmd
+
+def define_new_opts():
+    all_opt["lanplus"] = {
+        "getopt" : "L",
+        "longopt" : "lanplus",
+        "help" : "-L, --lanplus    Use Lanplus to improve security of connection",
+        "required" : "0",
+        "shortdesc" : "Use Lanplus to improve security of connection",
+        "order": 1
+        }
+    all_opt["auth"] = {
+        "getopt" : "A:",
+        "longopt" : "auth",
+        "help" : "-A, --auth=[auth]    IPMI Lan Auth type (md5|password|none)",
+        "required" : "0",
+        "shortdesc" : "IPMI Lan Auth type.",
+        "default" : "none",
+        "choices" : ["md5", "password", "none"],
+        "order": 1
+        }
+    all_opt["cipher"] = {
+        "getopt" : "C:",
+        "longopt" : "cipher",
+        "help" : "-C, --cipher=[cipher]    Ciphersuite to use (same as ipmitool -C parameter)",
+        "required" : "0",
+        "shortdesc" : "Ciphersuite to use (same as ipmitool -C parameter)",
+        "default" : "0",
+        "order": 1
+        }
+    all_opt["privlvl"] = {
+        "getopt" : "P:",
+        "longopt" : "privlvl",
+        "help" : "-P, --privlvl=[level]    Privilege level on IPMI device (callback|user|operator|administrator)",
+        "required" : "0",
+        "shortdesc" : "Privilege level on IPMI device",
+        "default" : "administrator",
+        "choices" : ["callback", "user", "operator", "administrator"],
+        "order": 1
+        }
+
+def main():
+
+    atexit.register(atexit_handler)
+
+    device_opt = [ "ipaddr", "login", "no_login", "no_password", "passwd", "lanplus", "auth", "cipher", "privlvl", "sudo"]
+    define_new_opts()
+
+    all_opt["ipport"]["default"] = "623"
+
+    options = check_input(device_opt, process_input(device_opt))
+    options["ipmitool_path"] = get_ipmitool_path()
+
+    if options["ipmitool_path"] is None:
+        fail(EC_TOOL_FAIL)
+
+    docs = { }
+    docs["shortdesc"] = "Fence agent for IPMI"
+    docs["longdesc"] = "Fence agent for IPMI"
+    docs["vendorurl"] = ""
+    show_docs(options, docs)
+
+    result = fence_action(None, options, set_power_status, get_power_status, None)
+
+    sys.exit(result)
+
+if __name__ == "__main__":
+    main()
fence/agents/lib/fencing.py.py +3 -1
index 0a3b122..b4abfb2 100644
@@ -25,6 +25,7 @@ EC_STATUS          = 8
 EC_STATUS_HMC      = 9
 EC_PASSWORD_MISSING = 10
 EC_INVALID_PRIVILEGES = 11
+EC_TOOL_FAIL	  = 12
 
 TELNET_PATH = "/usr/bin/telnet"
 SSH_PATH    = "/usr/bin/ssh"
@@ -412,7 +413,8 @@ def fail(error_code):
 		EC_STATUS_HMC :
 			"Failed: Either unable to obtain correct plug status, partition is not available or incorrect HMC version used",
 		EC_PASSWORD_MISSING : "Failed: You have to set login password",
-		EC_INVALID_PRIVILEGES : "Failed: The user does not have the correct privileges to do the requested action."
+		EC_INVALID_PRIVILEGES : "Failed: The user does not have the correct privileges to do the requested action.",
+		EC_TOOL_FAIL: "Failed: Required tool not found or not accessible."
 	}[error_code] + "\n"
 	sys.stderr.write(message)
 	syslog.syslog(syslog.LOG_ERR, message)
#3 lore raw

PATCH 1/2 fence_ipmilan: port fencing agent to fencing library

Quoted 9 lines · Fabio M. Di Nitto

fence/agents/ipmilan/fence_ipmilan.py line 20

Quoted 7 lines · Ondrej Mular
fence/agents/ipmilan/fence_ipmilan.py new file +7 -0
+PATHS = ["/usr/local/bull/NSMasterHW/bin/ipmitool",
+    "/usr/bin/ipmitool",
+    "/usr/sbin/ipmitool",
+    "/bin/ipmitool",
+    "/sbin/ipmitool",
+    "/usr/local/bin/ipmitool",
+    "/usr/local/sbin/ipmitool"]
Quoted 4 lines

this hard-cording it bad.

Always use OS define PATH and if really necessary allow user to override with an option (for example: --pathtoipmitool=/usr/local....)

see, e.g.,
http://git.engineering.redhat.com/users/jpokorny/clufter/tree/utils.py?id=d37db7470f4e44598af0b91d02221182178677ff#n22
that mimics "which" standard utility

Hope this helps

Signature · 1 line
Jan
#4 lore raw

PATCH 1/2 fence_ipmilan: port fencing agent to fencing library

Quoted 12 lines · Jan Pokorn?
Quoted 11 lines · Fabio M. Di Nitto

fence/agents/ipmilan/fence_ipmilan.py line 20

Quoted 7 lines · Ondrej Mular
fence/agents/ipmilan/fence_ipmilan.py new file +7 -0
+PATHS = ["/usr/local/bull/NSMasterHW/bin/ipmitool",
+    "/usr/bin/ipmitool",
+    "/usr/sbin/ipmitool",
+    "/bin/ipmitool",
+    "/sbin/ipmitool",
+    "/usr/local/bin/ipmitool",
+    "/usr/local/sbin/ipmitool"]

this hard-cording it bad.

Quoted 9 lines
Quoted 2 lines

Always use OS define PATH and if really necessary allow user to override with an option (for example: --pathtoipmitool=/usr/local....)

see, e.g.,
http://git.engineering.redhat.com/users/jpokorny/clufter/tree/utils.py?id=d37db7470f4e44598af0b91d02221182178677ff#n22
that mimics "which" standard utility

Hope this helps

I?d like to understand why we need a search path in the first place tho and we can?t just rely on shell hitting the right tool :)

Fabio

#5 lore raw

PATCH 1/2 fence_ipmilan: port fencing agent to fencing library

In reply to Ondrej Mular

Ondrej,
there is missing --method parameter. This is needed by some IPMI devices (there were BZs), because some devices turn off MANAGEMENT card instead of computer -> no way how to turn it back on. Also this may be seen as a regression. Also power cycle using cycle command is ... WAY faster (ipmi is usually quite slow, and doing status / off / status / on / status is slow).

Regards,
Honza

Ondrej Mular napsal(a):

Quoted 221 lines

This is port of fence_ipmilan to fencing library. Also added fail message to fencing library if tool (e.g. impitool, amttool...) is not accessible.

---
 fence/agents/ipmilan/fence_ipmilan.py | 184 ++++++++++++++++++++++++++++++++++
 fence/agents/lib/fencing.py.py        |   4 +-
 2 files changed, 187 insertions(+), 1 deletion(-)
 create mode 100644 fence/agents/ipmilan/fence_ipmilan.py
fence/agents/ipmilan/fence_ipmilan.py new file +184 -0
new file mode 100644
index 0000000..5c32690
@@ -0,0 +1,184 @@
+#!/usr/bin/python
+
+import sys, shlex, stat, subprocess, re, os
+from pipes import quote
+sys.path.append("@FENCEAGENTSLIBDIR@")
+from fencing import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION=""
+REDHAT_COPYRIGHT=""
+BUILD_DATE=""
+#END_VERSION_GENERATION
+
+PATHS = ["/usr/local/bull/NSMasterHW/bin/ipmitool",
+    "/usr/bin/ipmitool",
+    "/usr/sbin/ipmitool",
+    "/bin/ipmitool",
+    "/sbin/ipmitool",
+    "/usr/local/bin/ipmitool",
+    "/usr/local/sbin/ipmitool"]
+
+def get_power_status(_, options):
+
+    cmd = create_command(options, "status")
+
+    if options["log"] >= LOG_MODE_VERBOSE:
+        options["debug_fh"].write("executing: " + cmd + "\n")
+
+    try:
+        process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    except OSError, ex:
+        print ex
+        fail(EC_TOOL_FAIL)
+
+    process.wait()
+
+    out = process.communicate()
+    process.stdout.close()
+
+    match = re.search('[Cc]hassis [Pp]ower is [\\s]*([a-zA-Z]{2,3})', str(out))
+    status = match.group(1) if match else None
+
+    return status
+
+def set_power_status(_, options):
+
+    cmd = create_command(options, options["--action"])
+
+    if options["log"] >= LOG_MODE_VERBOSE:
+        options["debug_fh"].write("executing: " + cmd + "\n")
+
+    null = open('/dev/null', 'w')
+    try:
+        process = subprocess.Popen(shlex.split(cmd), stdout=null, stderr=null)
+    except OSError:
+        null.close()
+        fail(EC_TOOL_FAIL)
+
+    process.wait()
+    null.close()
+
+    return
+
+def is_executable(path):
+    if os.path.exists(path):
+        stats = os.stat(path)
+        if stat.S_ISREG(stats.st_mode) and os.access(path, os.X_OK):
+            return True
+    return False
+
+def get_ipmitool_path():
+    for path in PATHS:
+        if is_executable(path):
+            return path
+    return None
+
+def create_command(options, action):    
+    cmd = options["ipmitool_path"]
+
+    # --lanplus / -L
+    if options.has_key("--lanplus"):
+        cmd += " -I lanplus"
+    else:
+        cmd += " -I lan"
+    # --ip / -a
+    cmd += " -H " + options["--ip"]
+
+    # --username / -l
+    if options.has_key("--username") and len(options["--username"]) != 0:
+        cmd += " -U " + quote(options["--username"])
+
+    # --auth / -A
+    if options.has_key("--auth"):
+        cmd += " -A " + options["--auth"]
+
+    # --password / -p
+    if options.has_key("--password"):
+        cmd += " -P " + quote(options["--password"])
+
+    # --cipher / -C
+    cmd += " -C " + options["--cipher"]
+
+    # --port / -n
+    if options.has_key("--ipport"):
+        cmd += " -p " + options["--ipport"]
+
+    if options.has_key("--privlvl"):
+        cmd += " -L " + options["--privlvl"]
+
+    # --action / -o
+    cmd += " chassis power " + action
+
+     # --use-sudo / -d
+    if options.has_key("--use-sudo"):
+        cmd = SUDO_PATH + " " + cmd
+
+    return cmd
+
+def define_new_opts():
+    all_opt["lanplus"] = {
+        "getopt" : "L",
+        "longopt" : "lanplus",
+        "help" : "-L, --lanplus    Use Lanplus to improve security of connection",
+        "required" : "0",
+        "shortdesc" : "Use Lanplus to improve security of connection",
+        "order": 1
+        }
+    all_opt["auth"] = {
+        "getopt" : "A:",
+        "longopt" : "auth",
+        "help" : "-A, --auth=[auth]    IPMI Lan Auth type (md5|password|none)",
+        "required" : "0",
+        "shortdesc" : "IPMI Lan Auth type.",
+        "default" : "none",
+        "choices" : ["md5", "password", "none"],
+        "order": 1
+        }
+    all_opt["cipher"] = {
+        "getopt" : "C:",
+        "longopt" : "cipher",
+        "help" : "-C, --cipher=[cipher]    Ciphersuite to use (same as ipmitool -C parameter)",
+        "required" : "0",
+        "shortdesc" : "Ciphersuite to use (same as ipmitool -C parameter)",
+        "default" : "0",
+        "order": 1
+        }
+    all_opt["privlvl"] = {
+        "getopt" : "P:",
+        "longopt" : "privlvl",
+        "help" : "-P, --privlvl=[level]    Privilege level on IPMI device (callback|user|operator|administrator)",
+        "required" : "0",
+        "shortdesc" : "Privilege level on IPMI device",
+        "default" : "administrator",
+        "choices" : ["callback", "user", "operator", "administrator"],
+        "order": 1
+        }
+
+def main():
+
+    atexit.register(atexit_handler)
+
+    device_opt = [ "ipaddr", "login", "no_login", "no_password", "passwd", "lanplus", "auth", "cipher", "privlvl", "sudo"]
+    define_new_opts()
+
+    all_opt["ipport"]["default"] = "623"
+
+    options = check_input(device_opt, process_input(device_opt))
+    options["ipmitool_path"] = get_ipmitool_path()
+
+    if options["ipmitool_path"] is None:
+        fail(EC_TOOL_FAIL)
+
+    docs = { }
+    docs["shortdesc"] = "Fence agent for IPMI"
+    docs["longdesc"] = "Fence agent for IPMI"
+    docs["vendorurl"] = ""
+    show_docs(options, docs)
+
+    result = fence_action(None, options, set_power_status, get_power_status, None)
+
+    sys.exit(result)
+
+if __name__ == "__main__":
+    main()
fence/agents/lib/fencing.py.py +3 -1
index 0a3b122..b4abfb2 100644
@@ -25,6 +25,7 @@ EC_STATUS          = 8
 EC_STATUS_HMC      = 9
 EC_PASSWORD_MISSING = 10
 EC_INVALID_PRIVILEGES = 11
+EC_TOOL_FAIL	  = 12
 
 TELNET_PATH = "/usr/bin/telnet"
 SSH_PATH    = "/usr/bin/ssh"
@@ -412,7 +413,8 @@ def fail(error_code):
 		EC_STATUS_HMC :
 			"Failed: Either unable to obtain correct plug status, partition is not available or incorrect HMC version used",
 		EC_PASSWORD_MISSING : "Failed: You have to set login password",
-		EC_INVALID_PRIVILEGES : "Failed: The user does not have the correct privileges to do the requested action."
+		EC_INVALID_PRIVILEGES : "Failed: The user does not have the correct privileges to do the requested action.",
+		EC_TOOL_FAIL: "Failed: Required tool not found or not accessible."
 	}[error_code] + "\n"
 	sys.stderr.write(message)
 	syslog.syslog(syslog.LOG_ERR, message)