- fence_compute/fence_evacuate: dont use deprecated inspect.getargspec()
Resolves: RHEL-84448 - fence_sbd: get devices from SBD_DEVICE env variable if devices parameter isnt set Resolves: RHEL-79798
This commit is contained in:
parent
d53dbdb147
commit
ef224b03a8
@ -0,0 +1,160 @@
|
||||
From f73b6b4465de1bf2b2887efd3b9767d3f36abd24 Mon Sep 17 00:00:00 2001
|
||||
From: xin liang <xliang@suse.com>
|
||||
Date: Fri, 26 Jul 2024 10:49:55 +0800
|
||||
Subject: [PATCH 1/3] fence_sbd: if sbd devices are not specified with option,
|
||||
read SBD_DEVICE
|
||||
|
||||
from environment
|
||||
---
|
||||
agents/sbd/fence_sbd.py | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/agents/sbd/fence_sbd.py b/agents/sbd/fence_sbd.py
|
||||
index bf95bb72e..c36220295 100644
|
||||
--- a/agents/sbd/fence_sbd.py
|
||||
+++ b/agents/sbd/fence_sbd.py
|
||||
@@ -342,7 +342,7 @@ def define_new_opts():
|
||||
"longopt" : "devices",
|
||||
"help":"--devices=[device_a,device_b] \
|
||||
Comma separated list of sbd devices",
|
||||
- "required" : "1",
|
||||
+ "required" : "0",
|
||||
"shortdesc" : "SBD Device",
|
||||
"order": 1
|
||||
}
|
||||
@@ -382,10 +382,14 @@ def main():
|
||||
docs["vendorurl"] = ""
|
||||
show_docs(options, docs)
|
||||
|
||||
- # We need to check if --devices is given and not empty.
|
||||
+ # If not specified then read SBD_DEVICE from environment
|
||||
if "--devices" not in options:
|
||||
- fail_usage("No SBD devices specified. \
|
||||
- At least one SBD device is required.")
|
||||
+ dev_list = os.getenv("SBD_DEVICE")
|
||||
+ if dev_list:
|
||||
+ options["--devices"] = ",".join(dev_list.split(";"))
|
||||
+ else:
|
||||
+ fail_usage("No SBD devices specified. \
|
||||
+ At least one SBD device is required.")
|
||||
|
||||
run_delay(options)
|
||||
|
||||
|
||||
From 744d534225b51db26058660b753df2991b9356a0 Mon Sep 17 00:00:00 2001
|
||||
From: xin liang <xliang@suse.com>
|
||||
Date: Fri, 26 Jul 2024 17:45:07 +0800
|
||||
Subject: [PATCH 2/3] fence_sbd: Update fence_sbd.xml
|
||||
|
||||
---
|
||||
tests/data/metadata/fence_sbd.xml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/data/metadata/fence_sbd.xml b/tests/data/metadata/fence_sbd.xml
|
||||
index 82ded25b9..c2daf0c54 100644
|
||||
--- a/tests/data/metadata/fence_sbd.xml
|
||||
+++ b/tests/data/metadata/fence_sbd.xml
|
||||
@@ -8,7 +8,7 @@
|
||||
<content type="string" default="reboot" />
|
||||
<shortdesc lang="en">Fencing action</shortdesc>
|
||||
</parameter>
|
||||
- <parameter name="devices" unique="0" required="1">
|
||||
+ <parameter name="devices" unique="0" required="0">
|
||||
<getopt mixed="--devices=[device_a,device_b]" />
|
||||
<content type="string" />
|
||||
<shortdesc lang="en">SBD Device</shortdesc>
|
||||
|
||||
From 06457f95a4d89d4b6a856ae14ccbcda4d357bef6 Mon Sep 17 00:00:00 2001
|
||||
From: xin liang <xliang@suse.com>
|
||||
Date: Tue, 10 Dec 2024 10:00:00 +0800
|
||||
Subject: [PATCH 3/3] fence_sbd: Check if the sbd daemon is running before
|
||||
using SBD_DEVICE enviroment variable
|
||||
|
||||
And add @SBDPID_PATH@ for the sbd daemon pid file path
|
||||
---
|
||||
agents/sbd/fence_sbd.py | 31 ++++++++++++++++++++++++++++++-
|
||||
configure.ac | 2 ++
|
||||
make/fencebuild.mk | 1 +
|
||||
3 files changed, 33 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/agents/sbd/fence_sbd.py b/agents/sbd/fence_sbd.py
|
||||
index c36220295..bebc7fae1 100644
|
||||
--- a/agents/sbd/fence_sbd.py
|
||||
+++ b/agents/sbd/fence_sbd.py
|
||||
@@ -14,6 +14,7 @@
|
||||
DEVICE_NOT_INIT = -3
|
||||
PATH_NOT_EXISTS = -1
|
||||
PATH_NOT_BLOCK = -2
|
||||
+SBD_PID_FILE = "@SBDPID_PATH@"
|
||||
|
||||
def is_block_device(filename):
|
||||
"""Checks if a given path is a valid block device
|
||||
@@ -356,6 +357,34 @@ def define_new_opts():
|
||||
"order": 200
|
||||
}
|
||||
|
||||
+
|
||||
+def sbd_daemon_is_running():
|
||||
+ """Check if the sbd daemon is running
|
||||
+ """
|
||||
+ if not os.path.exists(SBD_PID_FILE):
|
||||
+ logging.info("SBD PID file %s does not exist", SBD_PID_FILE)
|
||||
+ return False
|
||||
+
|
||||
+ try:
|
||||
+ with open(SBD_PID_FILE, "r") as pid_file:
|
||||
+ pid = int(pid_file.read().strip())
|
||||
+ except Exception as e:
|
||||
+ logging.error("Failed to read PID file %s: %s", SBD_PID_FILE, e)
|
||||
+ return False
|
||||
+
|
||||
+ try:
|
||||
+ # send signal 0 to check if the process is running
|
||||
+ os.kill(pid, 0)
|
||||
+ except ProcessLookupError:
|
||||
+ logging.info("SBD daemon is not running")
|
||||
+ return False
|
||||
+ except Exception as e:
|
||||
+ logging.error("Failed to send signal 0 to PID %d: %s", pid, e)
|
||||
+ return False
|
||||
+
|
||||
+ return True
|
||||
+
|
||||
+
|
||||
def main():
|
||||
"""Main function
|
||||
"""
|
||||
@@ -385,7 +414,7 @@ def main():
|
||||
# If not specified then read SBD_DEVICE from environment
|
||||
if "--devices" not in options:
|
||||
dev_list = os.getenv("SBD_DEVICE")
|
||||
- if dev_list:
|
||||
+ if dev_list and sbd_daemon_is_running():
|
||||
options["--devices"] = ",".join(dev_list.split(";"))
|
||||
else:
|
||||
fail_usage("No SBD devices specified. \
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 6b7322419..0425a9d21 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -145,6 +145,8 @@ eval FENCETMPDIR="`eval echo ${FENCETMPDIR}`"
|
||||
AC_DEFINE_UNQUOTED(FENCETMPDIR,"$FENCETMPDIR", Where Fence agents keep state files)
|
||||
AC_SUBST(FENCETMPDIR)
|
||||
|
||||
+SBDPID_PATH=${localstatedir}/run/sbd.pid
|
||||
+AC_SUBST(SBDPID_PATH)
|
||||
|
||||
if test "x$AGENTS_LIST" = x; then
|
||||
AC_ERROR([No agents selected])
|
||||
diff --git a/make/fencebuild.mk b/make/fencebuild.mk
|
||||
index 9a3c6d6dd..bc9259190 100644
|
||||
--- a/make/fencebuild.mk
|
||||
+++ b/make/fencebuild.mk
|
||||
@@ -9,6 +9,7 @@ define gen_agent_from_py
|
||||
-e 's#@''SBINDIR@#${sbindir}#g' \
|
||||
-e 's#@''LIBEXECDIR@#${libexecdir}#g' \
|
||||
-e 's#@''FENCETMPDIR@#${FENCETMPDIR}#g' \
|
||||
+ -e 's#@''SBDPID_PATH@#${SBDPID_PATH}#g' \
|
||||
-e 's#@''IPMITOOL_PATH@#${IPMITOOL_PATH}#g' \
|
||||
-e 's#@''OPENSTACK_PATH@#${OPENSTACK_PATH}#g' \
|
||||
-e 's#@''AMTTOOL_PATH@#${AMTTOOL_PATH}#g' \
|
@ -0,0 +1,38 @@
|
||||
From deadda03cb331b766d83e332f06af9a53906a2a8 Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Fri, 21 Mar 2025 12:21:06 +0100
|
||||
Subject: [PATCH] fence_compute/fence_evacuate: dont use deprecated
|
||||
inspect.getargspec()
|
||||
|
||||
/usr/sbin/fence_compute:288: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
|
||||
---
|
||||
agents/compute/fence_compute.py | 2 +-
|
||||
agents/evacuate/fence_evacuate.py | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/agents/compute/fence_compute.py b/agents/compute/fence_compute.py
|
||||
index d862dca3f..01b535bb3 100644
|
||||
--- a/agents/compute/fence_compute.py
|
||||
+++ b/agents/compute/fence_compute.py
|
||||
@@ -285,7 +285,7 @@ def create_nova_connection(options):
|
||||
|
||||
nova_versions = [ "2.11", "2" ]
|
||||
for version in nova_versions:
|
||||
- clientargs = inspect.getargspec(client.Client).varargs
|
||||
+ clientargs = inspect.getfullargspec(client.Client).varargs
|
||||
# Some versions of Openstack prior to Ocata only
|
||||
# supported positional arguments for username,
|
||||
# password, and tenant.
|
||||
diff --git a/agents/evacuate/fence_evacuate.py b/agents/evacuate/fence_evacuate.py
|
||||
index 53d6fd15b..1ea020f69 100644
|
||||
--- a/agents/evacuate/fence_evacuate.py
|
||||
+++ b/agents/evacuate/fence_evacuate.py
|
||||
@@ -221,7 +221,7 @@ def create_nova_connection(options):
|
||||
|
||||
versions = [ "2.11", "2" ]
|
||||
for version in versions:
|
||||
- clientargs = inspect.getargspec(client.Client).varargs
|
||||
+ clientargs = inspect.getfullargspec(client.Client).varargs
|
||||
|
||||
# Some versions of Openstack prior to Ocata only
|
||||
# supported positional arguments for username,
|
@ -57,7 +57,7 @@
|
||||
Name: fence-agents
|
||||
Summary: Set of unified programs capable of host isolation ("fencing")
|
||||
Version: 4.10.0
|
||||
Release: 87%{?alphatag:.%{alphatag}}%{?dist}
|
||||
Release: 88%{?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
|
||||
@ -246,6 +246,8 @@ Patch60: RHEL-56138-fence_mpath-2-fix-unfencing-issue-use-MULTILINE-avoid-duplic
|
||||
Patch61: RHEL-62206-fence_ibm_powervs-add-private-endpoint-and-token-file-support.patch
|
||||
Patch62: RHEL-76493-fence_azure_arm-use-azure-identity.patch
|
||||
Patch63: RHEL-83255-fence_ibm_vpc-refresh-bearer-token.patch
|
||||
Patch64: RHEL-84448-fence_compute-fence_evacuate-dont-use-deprecated-getargspec.patch
|
||||
Patch65: RHEL-79798-fence_sbd-get-devices-from-SBD_DEVICE-if-devices-parameter-isnt-set.patch
|
||||
|
||||
### HA support libs/utils ###
|
||||
# all archs
|
||||
@ -430,6 +432,8 @@ BuildRequires: %{systemd_units}
|
||||
%patch -p1 -P 61
|
||||
%patch -p1 -P 62
|
||||
%patch -p1 -P 63
|
||||
%patch -p1 -P 64
|
||||
%patch -p1 -P 65
|
||||
|
||||
# prevent compilation of something that won't get used anyway
|
||||
sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac
|
||||
@ -1536,6 +1540,13 @@ are located on corosync cluster nodes.
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Mar 25 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.10.0-88
|
||||
- fence_compute/fence_evacuate: dont use deprecated inspect.getargspec()
|
||||
Resolves: RHEL-84448
|
||||
- fence_sbd: get devices from SBD_DEVICE env variable if devices
|
||||
parameter isnt set
|
||||
Resolves: RHEL-79798
|
||||
|
||||
* Fri Mar 14 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.10.0-87
|
||||
- fence_ibm_vpc: refresh bearer-token if token data is corrupt, and
|
||||
avoid edge-case of writing empty token file
|
||||
|
Loading…
Reference in New Issue
Block a user