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 +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) + diff --git a/fence-agents.spec b/fence-agents.spec index 7f2efb1..4b9f63e 100644 --- a/fence-agents.spec +++ b/fence-agents.spec @@ -59,7 +59,7 @@ Name: fence-agents Summary: Set of unified programs capable of host isolation ("fencing") Version: 4.10.0 -Release: 20%{?alphatag:.%{alphatag}}%{?dist} +Release: 21%{?alphatag:.%{alphatag}}%{?dist} License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/fence-agents Source0: https://fedorahosted.org/releases/f/e/fence-agents/%{name}-%{version}.tar.gz @@ -233,6 +233,7 @@ Patch16: bz2041933-bz2041935-1-fence_openstack-clouds-openrc.patch Patch17: bz2041933-bz2041935-2-fence_openstack-clouds-openrc.patch Patch18: bz2042496-fence_ibm_vpc-fence_ibm_powervs.patch Patch19: bz2022334-fence_zvmip-add-disable-ssl.patch +Patch20: bz2065114-fence_lpar-refactor.patch %global supportedagents amt_ws apc apc_snmp bladecenter brocade cisco_mds cisco_ucs compute drac5 eaton_snmp emerson eps evacuate hpblade ibmblade ibm_powervs ibm_vpc ifmib ilo ilo_moonshot ilo_mp ilo_ssh intelmodular ipdu ipmilan kdump kubevirt lpar mpath redfish rhevm rsa rsb sbd scsi vmware_rest vmware_soap wti %ifarch x86_64 @@ -363,6 +364,7 @@ BuildRequires: %{systemd_units} %patch17 -p1 %patch18 -p1 %patch19 -p1 +%patch20 -p1 # prevent compilation of something that won't get used anyway sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac @@ -1454,6 +1456,10 @@ are located on corosync cluster nodes. %endif %changelog +* Wed Apr 6 2022 Oyvind Albrigtsen - 4.10.0-21 +- fence_lpar: refactor to avoid duplicate code + Resolves: rhbz#2065114 + * Wed Mar 30 2022 Oyvind Albrigtsen - 4.10.0-20 - fence_azure_arm: fix sovereign cloud and MSI support Resolves: rhbz#2010652