86a3dd56d6
- fence_brocade: Add support for 'list' action - fencing: Monitor is not working correctly without 'list' or 'status' - fence_apc_snmp: Add support for firmware 6.x - fence_zvm: Add support for "on" and "status" - fence_zvm: Add current XML metadata to test suite - [build] Fix automake files, so 'make distcheck' works - fencing: Add new options --ssl-secure and --ssl-insecure - [tests] Update XML metadata of fence agents - fence_cisco_ucs & fence_vmware_soap: Logout has to be performed even when fencing fails - fence_zvm: Fixes for better upstream inclusion - fence_zvm: Add support for 'on', improve documentation - Added patches: - 0001-fence_brocade-Add-support-for-list-action.patch - 0002-fencing-Monitor-is-not-working-correctly-without-lis.patch - 0003-fence_apc_snmp-Add-support-for-firmware-6.x.patch - 0004-fence_zvm-Add-support-for-on-and-status.patch - 0005-fence_zvm-Add-current-XML-metadata-to-test-suite.patch - 0006-build-Fix-automake-files-so-make-distcheck-works.patch - 0007-fencing-Add-new-options-ssl-secure-and-ssl-insecure.patch - 0008-tests-Update-XML-metadata-of-fence-agents.patch - 0009-fence_cisco_ucs-fence_vmware_soap-Logout-has-to-be-p.patch - 0010-fence_zvm-Fixes-for-better-upstream-inclusion.patch - 0011-fence_zvm-Add-support-for-on-improve-documentation.patch - Add dependency on python-requests OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/fence-agents?expand=0&rev=16
79 lines
2.6 KiB
Diff
79 lines
2.6 KiB
Diff
From 98236c1c0f0f3b9d6def701e5e9cc67f35649441 Mon Sep 17 00:00:00 2001
|
|
From: Marek 'marx' Grac <mgrac@redhat.com>
|
|
Date: Tue, 1 Jul 2014 15:25:45 +0200
|
|
Subject: [PATCH 01/11] fence_brocade: Add support for 'list' action
|
|
|
|
---
|
|
fence/agents/brocade/fence_brocade.py | 41 +++++++++++++++++++----------------
|
|
1 file changed, 22 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
|
|
index f935280..3e5dd93 100644
|
|
--- a/fence/agents/brocade/fence_brocade.py
|
|
+++ b/fence/agents/brocade/fence_brocade.py
|
|
@@ -12,24 +12,6 @@ REDHAT_COPYRIGHT=""
|
|
BUILD_DATE="March, 20013"
|
|
#END_VERSION_GENERATION
|
|
|
|
-def get_power_status(conn, options):
|
|
- conn.send_eol("portCfgShow " + options["--plug"])
|
|
-
|
|
- conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
|
|
-
|
|
- show_re = re.compile(r'^\s*Persistent Disable\s*(ON|OFF)\s*$', re.IGNORECASE)
|
|
- lines = conn.before.split("\n")
|
|
-
|
|
- for line in lines:
|
|
- res = show_re.search(line)
|
|
- if res != None:
|
|
- # We queried if it is disabled, so we have to negate answer
|
|
- if res.group(1) == "ON":
|
|
- return "off"
|
|
- else:
|
|
- return "on"
|
|
-
|
|
- fail(EC_STATUS)
|
|
def set_power_status(conn, options):
|
|
action = {
|
|
'on' : "portCfgPersistentEnable",
|
|
@@ -39,6 +21,27 @@ def set_power_status(conn, options):
|
|
conn.send_eol(action + " " + options["--plug"])
|
|
conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
|
|
|
|
+def get_power_status(conn, options):
|
|
+ line_re = re.compile(r'=========', re.IGNORECASE)
|
|
+ outlets = {}
|
|
+ in_index = False
|
|
+
|
|
+ conn.send_eol("switchshow")
|
|
+ conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
|
|
+ for line in str(conn.before).split("\n"):
|
|
+ if line_re.search(line):
|
|
+ in_index = True
|
|
+ elif in_index and line.lstrip()[0].isdigit():
|
|
+ tokens = line.lstrip().split()
|
|
+ status = "off" if len(tokens) > 7 and tokens[7] == "Disabled" else "on"
|
|
+ outlets[tokens[0]] = ("", status)
|
|
+
|
|
+ if options["--action"] == "status":
|
|
+ (_, status) = outlets[options["--plug"]]
|
|
+ return status
|
|
+ else:
|
|
+ return outlets
|
|
+
|
|
def main():
|
|
device_opt = ["ipaddr", "login", "passwd", "cmd_prompt", "secure", "port", "fabric_fencing"]
|
|
|
|
@@ -66,7 +69,7 @@ FC switch needs to be enabled. This can be done by running fence_brocade and spe
|
|
## Operate the fencing device
|
|
####
|
|
conn = fence_login(options)
|
|
- result = fence_action(conn, options, set_power_status, get_power_status, None)
|
|
+ result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
|
|
fence_logout(conn, "exit")
|
|
sys.exit(result)
|
|
|
|
--
|
|
1.8.4.5
|
|
|