|
|
e4ffb1 |
From 8f106de6bed0626787cae79aa2607992f1bbacec Mon Sep 17 00:00:00 2001
|
|
|
e4ffb1 |
From: Marek 'marx' Grac <mgrac@redhat.com>
|
|
|
e4ffb1 |
Date: Mon, 1 Feb 2016 16:07:48 +0100
|
|
|
e4ffb1 |
Subject: [PATCH] fence_cisco_ucs: Obtain status of device from different
|
|
|
e4ffb1 |
endpoint
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
Resolves: rhbz#1298430
|
|
|
e4ffb1 |
---
|
|
|
e4ffb1 |
fence/agents/cisco_ucs/fence_cisco_ucs.py | 18 +++++++++++++++---
|
|
|
e4ffb1 |
1 file changed, 15 insertions(+), 3 deletions(-)
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
|
|
|
e4ffb1 |
index 6288207..331f309 100644
|
|
|
e4ffb1 |
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
|
|
|
e4ffb1 |
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
|
|
|
e4ffb1 |
@@ -17,7 +17,9 @@ BUILD_DATE="March, 2008"
|
|
|
e4ffb1 |
RE_COOKIE = re.compile("
|
|
|
e4ffb1 |
RE_STATUS = re.compile("
|
|
|
e4ffb1 |
RE_GET_DN = re.compile(" dn=\"(.*?)\"", re.IGNORECASE)
|
|
|
e4ffb1 |
+RE_GET_PNDN = re.compile(" pndn=\"(.*?)\"", re.IGNORECASE)
|
|
|
e4ffb1 |
RE_GET_DESC = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
|
|
|
e4ffb1 |
+RE_GET_OPERPOWER = re.compile(" operPower=\"(.*?)\"", re.IGNORECASE)
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
options_global = None
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
@@ -26,15 +28,25 @@ def get_power_status(conn, options):
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
res = send_command(options, "
|
|
|
e4ffb1 |
"\" inHierarchical=\"false\" dn=\"org-root" + options["--suborg"] + "/ls-" +
|
|
|
e4ffb1 |
- options["--plug"] + "/power\"/>", int(options["--shell-timeout"]))
|
|
|
e4ffb1 |
+ options["--plug"] + "\"/>", int(options["--shell-timeout"]))
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
- result = RE_STATUS.search(res)
|
|
|
e4ffb1 |
+ result = RE_GET_PNDN.search(res)
|
|
|
e4ffb1 |
+ if result == None:
|
|
|
e4ffb1 |
+ fail(EC_STATUS)
|
|
|
e4ffb1 |
+ else:
|
|
|
e4ffb1 |
+ pndn = result.group(1)
|
|
|
e4ffb1 |
+
|
|
|
e4ffb1 |
+ res = send_command(options, "
|
|
|
e4ffb1 |
+ "\" inHierarchical=\"false\" dn=\"" + pndn +
|
|
|
e4ffb1 |
+ "\"/>", int(options["--shell-timeout"]))
|
|
|
e4ffb1 |
+
|
|
|
e4ffb1 |
+ result = RE_GET_OPERPOWER.search(res)
|
|
|
e4ffb1 |
if result == None:
|
|
|
e4ffb1 |
fail(EC_STATUS)
|
|
|
e4ffb1 |
else:
|
|
|
e4ffb1 |
status = result.group(1)
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
- if status == "up":
|
|
|
e4ffb1 |
+ if status == "on":
|
|
|
e4ffb1 |
return "on"
|
|
|
e4ffb1 |
else:
|
|
|
e4ffb1 |
return "off"
|
|
|
e4ffb1 |
--
|
|
|
e4ffb1 |
2.4.3
|
|
|
e4ffb1 |
|