summaryrefslogtreecommitdiff
path: root/bz2065114-fence_lpar-refactor.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-08-01 14:21:23 +0000
committerCoprDistGit <infra@openeuler.org>2024-08-01 14:21:23 +0000
commit247fc79a80bec95c23eac2c1d19b47ed30f7350b (patch)
tree59f40f8d3835d3954a48242fe49c7195f9cb55c5 /bz2065114-fence_lpar-refactor.patch
parent656cec46a0f3499446d93967253acac7c8acfe6f (diff)
automatic import of fence-agentsopeneuler24.03_LTS
Diffstat (limited to 'bz2065114-fence_lpar-refactor.patch')
-rw-r--r--bz2065114-fence_lpar-refactor.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/bz2065114-fence_lpar-refactor.patch b/bz2065114-fence_lpar-refactor.patch
new file mode 100644
index 0000000..599a22c
--- /dev/null
+++ b/bz2065114-fence_lpar-refactor.patch
@@ -0,0 +1,65 @@
+From e3dff8570b70f0c19eca84cf02f0aadd68e16599 Mon Sep 17 00:00:00 2001
+From: Thomas Renninger <trenn@suse.com>
+Date: Fri, 25 Feb 2022 14:05:42 +0100
+Subject: [PATCH] fence_lpar: fix missing import logging, use fail_usage
+
+and slightly re-factor code to avoid duplicate code lines.
+Should be cleanup only, no functional change.
+---
+ agents/lpar/fence_lpar.py | 39 ++++++++++++++++++---------------------
+ 1 file changed, 18 insertions(+), 21 deletions(-)
+
+diff --git a/agents/lpar/fence_lpar.py b/agents/lpar/fence_lpar.py
+index ad18c6191..2046b0e4e 100644
+--- a/agents/lpar/fence_lpar.py
++++ b/agents/lpar/fence_lpar.py
+@@ -28,31 +28,28 @@ def _normalize_status(status):
+
+ def get_power_status(conn, options):
+ if options["--hmc-version"] == "3":
+- conn.send("lssyscfg -r lpar -m " + options["--managed"] + " -n " + options["--plug"] + " -F name,state\n")
+-
+- # First line (command) may cause parsing issues if long
+- conn.readline()
+- conn.log_expect(options["--command-prompt"], int(options["--power-timeout"]))
+-
+- try:
+- status = re.compile("^" + options["--plug"] + ",(.*?),.*$",
+- re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
+- except AttributeError as e:
+- logging.error("Failed: {}".format(str(e)))
+- fail(EC_STATUS_HMC)
++ command = "lssyscfg -r lpar -m " + options["--managed"] + " -n " + options["--plug"] + " -F name,state\n"
+ elif options["--hmc-version"] in ["4", "IVM"]:
+- conn.send("lssyscfg -r lpar -m "+ options["--managed"] +
+- " --filter 'lpar_names=" + options["--plug"] + "'\n")
++ command = "lssyscfg -r lpar -m "+ options["--managed"] + \
++ " --filter 'lpar_names=" + options["--plug"] + "'\n"
++ else:
++ # Bad HMC Version cannot be reached
++ fail(EC_STATUS_HMC)
+
+- # First line (command) may cause parsing issues if long
+- conn.readline()
+- conn.log_expect(options["--command-prompt"], int(options["--power-timeout"]))
++ conn.send(command)
++ # First line (command) may cause parsing issues if long
++ conn.readline()
++ conn.log_expect(options["--command-prompt"], int(options["--power-timeout"]))
+
+- try:
++ try:
++ if options["--hmc-version"] == "3":
++ status = re.compile("^" + options["--plug"] + ",(.*?),.*$",
++ re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
++ elif options["--hmc-version"] in ["4", "IVM"]:
+ status = re.compile(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1)
+- except AttributeError as e:
+- logging.error("Failed: {}".format(str(e)))
+- fail(EC_STATUS_HMC)
++ except AttributeError as e:
++ fail_usage("Command on HMC failed: {}\n{}".format(command, str(e)), False)
++ fail(EC_STATUS_HMC)
+
+ return _normalize_status(status)
+