From 58418ed9fe91112ad1a9521a3e7a9e45f8807072 Mon Sep 17 00:00:00 2001 From: liupei Date: Fri, 11 Oct 2024 11:24:51 +0800 Subject: [PATCH] fence_scsi: preempt clears all devices on the mpath device & fence_bladecenter/fence_raritan_px3: use r"" on regex string (cherry picked from commit cfa8b6bc2d2b7eb30f7a917e5a1a9a0fd595c858) --- fence-agents.spec | 8 +++- ...r-fence_raritan_px3-use-r-on-regex-s.patch | 40 +++++++++++++++++ ...pt-clears-all-devices-on-the-mpath-d.patch | 43 +++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 fence_bladecenter-fence_raritan_px3-use-r-on-regex-s.patch create mode 100644 fence_scsi-preempt-clears-all-devices-on-the-mpath-d.patch diff --git a/fence-agents.spec b/fence-agents.spec index 9093a7f..f00ab9c 100644 --- a/fence-agents.spec +++ b/fence-agents.spec @@ -6,11 +6,13 @@ Name: fence-agents Summary: Set of unified programs capable of host isolation ("fencing") Version: 4.15.0 -Release: 1 +Release: 2 License: GPL-2.0-or-later and LGPL-2.0-or-later Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents Source0: https://github.com/ClusterLabs/fence-agents/archive//v%{version}/%{name}-%{version}.tar.gz +Patch0: fence_scsi-preempt-clears-all-devices-on-the-mpath-d.patch +Patch1: fence_bladecenter-fence_raritan_px3-use-r-on-regex-s.patch # skipped: pve, raritan, rcd-serial, virsh %global allfenceagents %(cat < - 4.15.0-2 +- fence_scsi: preempt clears all devices on the mpath device, so only run it for the first device +- fence_bladecenter/fence_raritan_px3: use r"" on regex string to avoid SyntaxWarning + * Tue Aug 06 2024 zouzhimin - 4.15.0-1 - update to 4.15.0 - fence_sbd: --sbd-path defaults to /usr/sbin/sbd diff --git a/fence_bladecenter-fence_raritan_px3-use-r-on-regex-s.patch b/fence_bladecenter-fence_raritan_px3-use-r-on-regex-s.patch new file mode 100644 index 0000000..691e2fc --- /dev/null +++ b/fence_bladecenter-fence_raritan_px3-use-r-on-regex-s.patch @@ -0,0 +1,40 @@ +From 989a079547b5c62d4e98ac0609136007e229c09e Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Fri, 20 Sep 2024 09:15:51 +0200 +Subject: [PATCH 2/3] fence_bladecenter/fence_raritan_px3: use r"" on regex + string to avoid SyntaxWarning + +--- + agents/bladecenter/fence_bladecenter.py | 2 +- + agents/raritan_px3/fence_raritan_px3.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/agents/bladecenter/fence_bladecenter.py b/agents/bladecenter/fence_bladecenter.py +index 2f2c65fc..a1e53066 100644 +--- a/agents/bladecenter/fence_bladecenter.py ++++ b/agents/bladecenter/fence_bladecenter.py +@@ -96,7 +96,7 @@ and uses the command line interface to power on and off blades." + ## + ## Operate the fencing device + ###### +- conn = fence_login(options, "(username\s*:\s*)") ++ conn = fence_login(options, r"(username\s*:\s*)") + result = fence_action(conn, options, set_power_status, get_power_status, get_blades_list) + fence_logout(conn, "exit") + sys.exit(result) +diff --git a/agents/raritan_px3/fence_raritan_px3.py b/agents/raritan_px3/fence_raritan_px3.py +index 9b8ce1bf..b1c7436b 100644 +--- a/agents/raritan_px3/fence_raritan_px3.py ++++ b/agents/raritan_px3/fence_raritan_px3.py +@@ -157,7 +157,7 @@ firmware versions. It's recommended to update to at least version 3.6.x" + docs["vendorurl"] = "http://www.raritan.com/" + show_docs(options, docs) + +- conn = fence_login(options, re_login_string="Username.*") ++ conn = fence_login(options, re_login_string=r"Username.*") + + px3_get_outlet_list(conn, options) + try: +-- +2.33.1.windows.1 + diff --git a/fence_scsi-preempt-clears-all-devices-on-the-mpath-d.patch b/fence_scsi-preempt-clears-all-devices-on-the-mpath-d.patch new file mode 100644 index 0000000..76f491d --- /dev/null +++ b/fence_scsi-preempt-clears-all-devices-on-the-mpath-d.patch @@ -0,0 +1,43 @@ +From cb57f1c2ee734a40d01249305965ea4ecdf02039 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 5 Sep 2024 09:06:34 +0200 +Subject: [PATCH 1/3] fence_scsi: preempt clears all devices on the mpath + device, so only run it for the first device + +--- + agents/scsi/fence_scsi.py | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/agents/scsi/fence_scsi.py b/agents/scsi/fence_scsi.py +index a1598411..12f7fb49 100644 +--- a/agents/scsi/fence_scsi.py ++++ b/agents/scsi/fence_scsi.py +@@ -131,11 +131,13 @@ def reset_dev(options, dev): + return run_cmd(options, options["--sg_turs-path"] + " " + dev)["rc"] + + +-def register_dev(options, dev, key): ++def register_dev(options, dev, key, do_preempt=True): + dev = os.path.realpath(dev) + if re.search(r"^dm", dev[5:]): +- for slave in get_mpath_slaves(dev): +- register_dev(options, slave, key) ++ devices = get_mpath_slaves(dev) ++ register_dev(options, devices[0], key) ++ for device in devices[1:]: ++ register_dev(options, device, key, False) + return True + + # Check if any registration exists for the key already. We track this in +@@ -153,7 +155,7 @@ def register_dev(options, dev, key): + # If key matches, make sure it matches with the connection that + # exists right now. To do this, we can issue a preempt with same key + # which should replace the old invalid entries from the target. +- if not preempt(options, key, dev, key): ++ if do_preempt and not preempt(options, key, dev, key): + return False + + # If there was no reservation, we need to issue another registration +-- +2.33.1.windows.1 + -- Gitee