From 9363b4c4850a26fb906db66e7af5ade0780aa9df Mon Sep 17 00:00:00 2001 From: liupei Date: Mon, 4 Nov 2024 10:16:24 +0800 Subject: [PATCH] Mid: fence_mpath: Allow reservation_key in multipath.conf --- ...Allow-reservation_key-in-multipath.c.patch | 25 ++++++++++ ...0x-format-patch-causing-unfencing-is.patch | 47 +++++++++++++++++++ fence-agents.spec | 9 +++- 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 backport-Mid-fence_mpath-Allow-reservation_key-in-multipath.c.patch create mode 100644 backport-fence_mpath-fix-0x-format-patch-causing-unfencing-is.patch diff --git a/backport-Mid-fence_mpath-Allow-reservation_key-in-multipath.c.patch b/backport-Mid-fence_mpath-Allow-reservation_key-in-multipath.c.patch new file mode 100644 index 0000000..eeffe00 --- /dev/null +++ b/backport-Mid-fence_mpath-Allow-reservation_key-in-multipath.c.patch @@ -0,0 +1,25 @@ +From ca9ae93a90e28876a010e7a065f62a387b857ad2 Mon Sep 17 00:00:00 2001 +From: Hideo Yamauchi +Date: Mon, 26 Aug 2024 21:25:37 +0900 +Subject: [PATCH] Mid: fence_mpath: Allow reservation_key in multipath.conf to + be the same as reservation_key in pcmk_host_map. (#592) + +--- + agents/mpath/fence_mpath.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/agents/mpath/fence_mpath.py b/agents/mpath/fence_mpath.py +index 58450c2c..2d860149 100644 +--- a/agents/mpath/fence_mpath.py ++++ b/agents/mpath/fence_mpath.py +@@ -332,6 +332,7 @@ failing." + fail_usage("Failed: No devices found") + + options["devices"] = [d for d in re.split(r"\s*,\s*|\s+", options["--devices"].strip()) if d] ++ options["--plug"] = re.sub(r"^0x0*|^0+", "", options["--plug"]) + # Input control END + + result = fence_action(None, options, set_status, get_status) +-- +2.33.1.windows.1 + diff --git a/backport-fence_mpath-fix-0x-format-patch-causing-unfencing-is.patch b/backport-fence_mpath-fix-0x-format-patch-causing-unfencing-is.patch new file mode 100644 index 0000000..771a9c3 --- /dev/null +++ b/backport-fence_mpath-fix-0x-format-patch-causing-unfencing-is.patch @@ -0,0 +1,47 @@ +From 99c5c3289b23064441f998949808a0b3569c2e3b Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 10 Oct 2024 09:55:16 +0200 +Subject: [PATCH 08/10] fence_mpath: fix 0x-format patch causing unfencing + issue, and use re.MULTILINE to avoid duplicating device dev/key lines in + /run/cluster/mpath.devices + +--- + agents/mpath/fence_mpath.py | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/agents/mpath/fence_mpath.py b/agents/mpath/fence_mpath.py +index 2d860149..2a4a58b3 100644 +--- a/agents/mpath/fence_mpath.py ++++ b/agents/mpath/fence_mpath.py +@@ -40,7 +40,7 @@ def set_status(conn, options): + if options["--plug"] not in get_registration_keys(options, dev): + count += 1 + logging.debug("Failed to register key "\ +- + options["--plug"] + "on device " + dev + "\n") ++ + options["--plug"] + " on device " + dev + "\n") + continue + dev_write(options, dev) + +@@ -147,8 +147,9 @@ def dev_write(options, dev): + store_fh = open(file_path, "a+") + except IOError: + fail_usage("Failed: Cannot open file \""+ file_path + "\"") ++ store_fh.seek(0) + out = store_fh.read() +- if not re.search(r"^" + dev + r"\s+", out): ++ if not re.search(r"^{}\s+{}$".format(dev, options["--plug"]), out, flags=re.MULTILINE): + store_fh.write(dev + "\t" + options["--plug"] + "\n") + store_fh.close() + +@@ -332,7 +333,7 @@ failing." + fail_usage("Failed: No devices found") + + options["devices"] = [d for d in re.split(r"\s*,\s*|\s+", options["--devices"].strip()) if d] +- options["--plug"] = re.sub(r"^0x0*|^0+", "", options["--plug"]) ++ options["--plug"] = re.sub(r"^0x0*|^0+", "", options.get("--plug", "")) + # Input control END + + result = fence_action(None, options, set_status, get_status) +-- +2.33.1.windows.1 + diff --git a/fence-agents.spec b/fence-agents.spec index efa7312..e20543e 100644 --- a/fence-agents.spec +++ b/fence-agents.spec @@ -6,7 +6,7 @@ Name: fence-agents Summary: Set of unified programs capable of host isolation ("fencing") Version: 4.15.0 -Release: 3 +Release: 4 License: GPL-2.0-or-later and LGPL-2.0-or-later Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents @@ -15,6 +15,8 @@ Patch0: fence_scsi-preempt-clears-all-devices-on-the-mpath-d.patch Patch1: fence_bladecenter-fence_raritan_px3-use-r-on-regex-s.patch Patch2: backport-fence_ibm_powervs-add-private-endpoint-and-token-fil.patch Patch3: backport-fencing-fix-typo-in-required-field-for-the-login-par.patch +Patch4: backport-Mid-fence_mpath-Allow-reservation_key-in-multipath.c.patch +Patch5: backport-fence_mpath-fix-0x-format-patch-causing-unfencing-is.patch # skipped: pve, raritan, rcd-serial, virsh %global allfenceagents %(cat < - 4.15.0-4 +- Mid: fence_mpath: Allow reservation_key in multipath.conf to be the same as reservation_key in pcmk_host_map. +- fence_mpath: fix 0x-format patch causing unfencing issue, and use re.MULTILINE to avoid duplicating + device dev/key lines in /run/cluster/mpath.devices + * Thu Oct 31 2024 liupei - 4.15.0-3 - fence_ibm_powervs: add private endpoint and token file support - fencing: fix "?" typo in required field for the login parameter -- Gitee