- fence_scsi: detect devices in shared VGs

Resolves: rhbz#2187327
This commit is contained in:
Oyvind Albrigtsen 2023-04-20 10:35:29 +02:00
parent e23492c138
commit 242bca3411
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["rc"]:
- 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

@ -60,7 +60,7 @@
Name: fence-agents
Summary: Set of unified programs capable of host isolation ("fencing")
Version: 4.10.0
Release: 43%{?alphatag:.%{alphatag}}%{?dist}
Release: 44%{?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
@ -231,6 +231,7 @@ Patch36: bz2149655-fence_virtd-update-fence_virt.conf-manpage.patch
Patch37: bz2160480-fence_scsi-fix-validate-all.patch
Patch38: bz2152107-fencing-1-add-plug_separator.patch
Patch39: bz2152107-fencing-2-update-DEPENDENCY_OPT.patch
Patch40: bz2187327-fence_scsi-detect-devices-in-shared-vgs.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
@ -381,6 +382,7 @@ BuildRequires: %{systemd_units}
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
# prevent compilation of something that won't get used anyway
sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac
@ -1447,6 +1449,10 @@ are located on corosync cluster nodes.
%endif
%changelog
* Thu Apr 20 2023 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.10.0-44
- fence_scsi: detect devices in shared VGs
Resolves: rhbz#2187327
* Thu Jan 26 2023 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.10.0-43
- fence_vmware_soap: set login_timeout lower than default
pcmk_monitor_timeout (20s) to remove tmp dirs