- fence_scsi: detect devices in shared VGs

Resolves: rhbz#2187329
This commit is contained in:
Oyvind Albrigtsen 2023-04-20 10:35:29 +02:00
parent 8fdbde907e
commit 871c7791c6
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,58 @@
From 4661b6f625c57a728ec58023da89ba378d4d1c27 Mon Sep 17 00:00:00 2001
From: Arslan Ahmad <arslan.ahmad97@googlemail.com>
Date: Mon, 17 Apr 2023 15:59:49 +0530
Subject: [PATCH] fence_scsi: Automatically detect devices for shared VGs
Currently, if no devices option is given, fence_scsi automatically
builds a device list containing all LVM PVs that back VGs with the
clustered ('c') bit set. With this commit, fence_scsi will also consider
VGs with the shared ('s') bit set.
Additionally, the existing check is too broad. We should consider a
volume group to be clustered or shared only if the 6th bit is set to 'c'
or 's'. This way, we can avoid false positives.
Closes RHBZ#2187327
Closes RHBZ#2187329
---
agents/scsi/fence_scsi.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/agents/scsi/fence_scsi.py b/agents/scsi/fence_scsi.py
index 85e4f29e6..3de4ba0b2 100644
--- a/agents/scsi/fence_scsi.py
+++ b/agents/scsi/fence_scsi.py
@@ -314,7 +314,7 @@ def dev_read(fail=True, opt=None):
return devs
-def get_clvm_devices(options):
+def get_shared_devices(options):
devs = []
cmd = options["--vgs-path"] + " " +\
"--noheadings " +\
@@ -324,10 +324,11 @@ def get_clvm_devices(options):
"--config 'global { locking_type = 0 } devices { preferred_names = [ \"^/dev/dm\" ] }'"
out = run_cmd(options, cmd)
if out["err"]:
- fail_usage("Failed: Cannot get clvm devices")
- for line in out["out"].split("\n"):
- if 'c' in line.split(":")[0]:
- devs.append(line.split(":")[1])
+ fail_usage("Failed: Cannot get shared devices")
+ for line in out["out"].splitlines():
+ vg_attr, pv_name = line.strip().split(":")
+ if vg_attr[5] in "cs":
+ devs.append(pv_name)
return devs
@@ -612,7 +613,7 @@ def main():
options["--key"] = options["--key"].lstrip('0')
if not ("--devices" in options and options["--devices"].split(",")):
- options["devices"] = get_clvm_devices(options)
+ options["devices"] = get_shared_devices(options)
else:
options["devices"] = options["--devices"].split(",")

View File

@ -87,7 +87,7 @@
Name: fence-agents
Summary: Set of unified programs capable of host isolation ("fencing")
Version: 4.2.1
Release: 112%{?alphatag:.%{alphatag}}%{?dist}
Release: 113%{?alphatag:.%{alphatag}}%{?dist}
License: GPLv2+ and LGPLv2+
Group: System Environment/Base
URL: https://github.com/ClusterLabs/fence-agents
@ -267,6 +267,7 @@ Patch124: bz2136076-fence_ibm_powervs-improve-defaults.patch
Patch125: bz2160478-fence_scsi-fix-validate-all.patch
Patch126: bz2152105-fencing-1-add-plug_separator.patch
Patch127: bz2152105-fencing-2-update-DEPENDENCY_OPT.patch
Patch128: bz2187329-fence_scsi-detect-devices-in-shared-vgs.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 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
@ -472,6 +473,7 @@ BuildRequires: python3-google-api-client python3-pip python3-wheel python3-jinja
%patch125 -p1
%patch126 -p1
%patch127 -p1
%patch128 -p1
# prevent compilation of something that won't get used anyway
sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac
@ -1469,6 +1471,10 @@ Fence agent for IBM z/VM over IP.
%endif
%changelog
* Thu Apr 20 2023 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.2.1-113
- fence_scsi: detect devices in shared VGs
Resolves: rhbz#2187329
* Thu Jan 26 2023 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.2.1-112
- fence_vmware_soap: set login_timeout lower than default
pcmk_monitor_timeout (20s) to remove tmp dirs