From 4c5e4156efde86fc23778f6511f2af4eef1f8f6f Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 12 2020 10:08:46 +0000 Subject: import fence-agents-4.2.1-61.el8 --- diff --git a/SOURCES/bz1841087-fence_scsi-dont-write-key-device-to-file.patch b/SOURCES/bz1841087-fence_scsi-dont-write-key-device-to-file.patch new file mode 100644 index 0000000..5bc1198 --- /dev/null +++ b/SOURCES/bz1841087-fence_scsi-dont-write-key-device-to-file.patch @@ -0,0 +1,60 @@ +From 431e8bc40288d97d80f07ec195c0a07c5f8c065a Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Tue, 10 Nov 2020 12:46:50 +0100 +Subject: [PATCH] fence_scsi: dont write key to device if it's already + registered, and open file correctly to avoid using regex against end-of-file + +--- + agents/scsi/fence_scsi.py | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/agents/scsi/fence_scsi.py b/agents/scsi/fence_scsi.py +index 77817f35..9a86689d 100644 +--- a/agents/scsi/fence_scsi.py ++++ b/agents/scsi/fence_scsi.py +@@ -135,6 +135,8 @@ def register_dev(options, dev): + for slave in get_mpath_slaves(dev): + register_dev(options, slave) + return True ++ if get_reservation_key(options, dev, False) == options["--key"]: ++ return True + reset_dev(options, dev) + cmd = options["--sg_persist-path"] + " -n -o -I -S " + options["--key"] + " -d " + dev + cmd += " -Z" if "--aptpl" in options else "" +@@ -148,14 +150,14 @@ def reserve_dev(options, dev): + return not bool(run_cmd(options, cmd)["err"]) + + +-def get_reservation_key(options, dev): ++def get_reservation_key(options, dev, fail=True): + reset_dev(options,dev) + opts = "" + if "--readonly" in options: + opts = "-y " + cmd = options["--sg_persist-path"] + " -n -i " + opts + "-r -d " + dev + out = run_cmd(options, cmd) +- if out["err"]: ++ if out["err"] and fail: + fail_usage("Cannot get reservation key") + match = re.search(r"\s+key=0x(\S+)\s+", out["out"], re.IGNORECASE) + return match.group(1) if match else None +@@ -257,6 +259,7 @@ def dev_write(dev, options): + f = open(file_path, "a+") + except IOError: + fail_usage("Failed: Cannot open file \""+ file_path + "\"") ++ f.seek(0) + out = f.read() + if not re.search(r"^" + dev + "\s+", out, flags=re.MULTILINE): + f.write(dev + "\n") +@@ -277,11 +280,6 @@ def dev_read(fail=True): + return devs + + +-def dev_delete(options): +- file_path = options["store_path"] + ".dev" +- os.remove(file_path) if os.path.exists(file_path) else None +- +- + def get_clvm_devices(options): + devs = [] + cmd = options["--vgs-path"] + " " +\ diff --git a/SPECS/fence-agents.spec b/SPECS/fence-agents.spec index fda0c54..18d8721 100644 --- a/SPECS/fence-agents.spec +++ b/SPECS/fence-agents.spec @@ -29,7 +29,7 @@ Name: fence-agents Summary: Set of unified programs capable of host isolation ("fencing") Version: 4.2.1 -Release: 59%{?alphatag:.%{alphatag}}%{?dist} +Release: 61%{?alphatag:.%{alphatag}}%{?dist} License: GPLv2+ and LGPLv2+ Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents @@ -118,6 +118,7 @@ Patch76: bz1470813-fencing-1-disable-timeout.patch Patch77: bz1470813-fencing-2-fix-power-timeout.patch Patch78: bz1470813-fencing-3-make-timeout-0-mean-forever.patch Patch79: bz1470813-fencing-4-make-timeout-0-mean-forever.patch +Patch80: bz1841087-fence_scsi-dont-write-key-device-to-file.patch %if 0%{?fedora} || 0%{?rhel} > 7 %global supportedagents amt_ws apc apc_snmp bladecenter brocade cisco_mds cisco_ucs compute drac5 eaton_snmp emerson eps evacuate hds_cb hpblade ibmblade ifmib ilo ilo_moonshot ilo_mp ilo_ssh intelmodular ipdu ipmilan kdump lpar mpath redfish rhevm rsa rsb sbd scsi vmware_rest vmware_soap wti @@ -275,6 +276,7 @@ BuildRequires: python3-google-api-client %patch77 -p1 %patch78 -p1 %patch79 -p1 +%patch80 -p1 # prevent compilation of something that won't get used anyway sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac @@ -1163,6 +1165,12 @@ Fence agent for IBM z/VM over IP. %endif %changelog +* Tue Nov 10 2020 Oyvind Albrigtsen - 4.2.1-61 +- fence_scsi: dont write key to device if it's already registered, + and dont write device to file when cluster is started again + + Resolves: rhbz#1841087 + * Thu Nov 5 2020 Oyvind Albrigtsen - 4.2.1-59 - fencing: add disable-timeout parameter and make it true by default for Pacemaker 2.0+