|
|
c07789 |
From 9f9a6829ead6199ecb65c4f85f400a0e403c8c47 Mon Sep 17 00:00:00 2001
|
|
|
c07789 |
From: Marek 'marx' Grac <mgrac@redhat.com>
|
|
|
c07789 |
Date: Mon, 15 Aug 2016 10:48:47 +0200
|
|
|
c07789 |
Subject: [PATCH] fence_cisco_ucs: Improve a method to obtain status
|
|
|
c07789 |
|
|
|
c07789 |
On Cisco UCS there are two attributes which are important for obtaining
|
|
|
c07789 |
correct power status of blade. One checks if slot is powered ON and other if
|
|
|
c07789 |
the node is pulled off the blade.
|
|
|
c07789 |
---
|
|
|
c07789 |
fence/agents/cisco_ucs/fence_cisco_ucs.py | 16 +++++++++++++---
|
|
|
c07789 |
1 file changed, 13 insertions(+), 3 deletions(-)
|
|
|
c07789 |
|
|
|
c07789 |
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
|
|
|
c07789 |
index 648e45f..0d9609d 100644
|
|
|
c07789 |
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
|
|
|
c07789 |
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
|
|
|
c07789 |
@@ -19,6 +19,7 @@ RE_STATUS = re.compile("
|
|
|
c07789 |
RE_GET_DN = re.compile(" dn=\"(.*?)\"", re.IGNORECASE)
|
|
|
c07789 |
RE_GET_PNDN = re.compile(" pndn=\"(.*?)\"", re.IGNORECASE)
|
|
|
c07789 |
RE_GET_DESC = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
|
|
|
c07789 |
+RE_GET_OPERPOWER = re.compile(" operPower=\"(.*?)\"", re.IGNORECASE)
|
|
|
c07789 |
RE_GET_PRESENCE = re.compile(" presence=\"(.*?)\"", re.IGNORECASE)
|
|
|
c07789 |
|
|
|
c07789 |
options_global = None
|
|
|
c07789 |
@@ -50,12 +51,21 @@ def get_power_status(conn, options):
|
|
|
c07789 |
if result == None:
|
|
|
c07789 |
fail(EC_STATUS)
|
|
|
c07789 |
else:
|
|
|
c07789 |
- status = result.group(1)
|
|
|
c07789 |
+ presence_status = result.group(1)
|
|
|
c07789 |
|
|
|
c07789 |
- if status in ["missing", "mismatch"]:
|
|
|
c07789 |
+ if presence_status in ["missing", "mismatch"]:
|
|
|
c07789 |
return "off"
|
|
|
c07789 |
else:
|
|
|
c07789 |
- return "on"
|
|
|
c07789 |
+ result = RE_GET_OPERPOWER.search(res)
|
|
|
c07789 |
+ if result == None:
|
|
|
c07789 |
+ fail(EC_STATUS)
|
|
|
c07789 |
+ else:
|
|
|
c07789 |
+ power_status = result.group(1)
|
|
|
c07789 |
+
|
|
|
c07789 |
+ if power_status == "on":
|
|
|
c07789 |
+ return "on"
|
|
|
c07789 |
+ else:
|
|
|
c07789 |
+ return "off"
|
|
|
c07789 |
|
|
|
c07789 |
def set_power_status(conn, options):
|
|
|
c07789 |
del conn
|
|
|
c07789 |
--
|
|
|
c07789 |
2.4.11
|
|
|
c07789 |
|