- fence_openstack: fix list-action to avoid timeout when

there are 100+ VMs on the hypervisor
  Resolves: RHEL-186317
This commit is contained in:
Arslan Ahmad 2026-06-19 14:55:53 +05:30
parent 7d905bba04
commit a2ac39ae5a
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,56 @@
From 101344d675f5c4f4141a01ec60a3265898cea94d Mon Sep 17 00:00:00 2001
From: Arslan Ahmad <arslan.ahmad97@googlemail.com>
Date: Tue, 16 Jun 2026 21:02:53 +0530
Subject: [PATCH] fence_openstack: fix list-action to avoid timeout when there
are 100+ VMs on the hypervisor
Routine `monitor` actions internally translate to a full `list` command.
On large deployments, fetching all VMs from the Nova API creates massive
payloads that cause the agent to timeout.
Changes in this patch:
* Fetch only 1 VM (`limit=1`) during `monitor` operations to eliminate
API overhead and prevent timeouts.
Signed-off-by: Arslan Ahmad <arslan.ahmad97@googlemail.com>
---
agents/openstack/fence_openstack.py | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/agents/openstack/fence_openstack.py b/agents/openstack/fence_openstack.py
index 4054e5149..b90d80d6a 100644
--- a/agents/openstack/fence_openstack.py
+++ b/agents/openstack/fence_openstack.py
@@ -52,15 +52,24 @@ def get_cloud(options):
def get_nodes_list(conn, options):
- logging.info("Running %s action", options["--action"])
+ logging.info("Running %s action", options.get("--original-action", options.get("--action")))
result = {}
- response = conn.servers.list(detailed=True)
- if response is not None:
- for item in response:
- instance_id = item.id
- instance_name = item.name
- instance_status = item.status
- result[instance_id] = (instance_name, translate_status(instance_status))
+ search_opts = {}
+ max_results = 1 if options.get("--original-action") == "monitor" else None
+
+ if "--plug" in options:
+ search_opts["uuid"] = options["--plug"]
+
+ try:
+ response = conn.servers.list(detailed=True, search_opts=search_opts, limit=max_results)
+ if response is not None:
+ for item in response:
+ instance_id = item.id
+ instance_name = item.name
+ instance_status = item.status
+ result[instance_id] = (instance_name, translate_status(instance_status))
+ except Exception as e:
+ logging.error("Failed to retrieve node list: %s", e)
return result

View File

@ -87,7 +87,7 @@
Name: fence-agents
Summary: Set of unified programs capable of host isolation ("fencing")
Version: 4.2.1
Release: 129%{?alphatag:.%{alphatag}}%{?dist}.25
Release: 129%{?alphatag:.%{alphatag}}%{?dist}.26
License: GPLv2+ and LGPLv2+
Group: System Environment/Base
URL: https://github.com/ClusterLabs/fence-agents
@ -323,6 +323,7 @@ Patch150: RHEL-96179-fence_kubevirt-force-off.patch
Patch151: RHEL-110964-1-fence_nutanix_ahv.patch
Patch152: RHEL-110964-2-fence_nutanix_ahv-update-metadata.patch
Patch153: RHEL-145087-fence_ibm_vpc-fix-missing-statuses.patch
Patch154: RHEL-186317-fence_openstack-fix-list-action-to-avoid-timeout-with-large-number-of-VMs.patch
### HA support libs/utils ###
# all archs
@ -576,6 +577,7 @@ BuildRequires: python3-google-api-client python3-pip python3-wheel python3-jinja
%patch -p1 -P 151
%patch -p1 -P 152
%patch -p1 -P 153
%patch -p1 -P 154
# prevent compilation of something that won't get used anyway
sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac
@ -1648,6 +1650,11 @@ Fence agent for IBM z/VM over IP.
%endif
%changelog
* Fri Jun 19 2026 Arslan Ahmad <arahmad@redhat.com> - 4.2.1-129.26
- fence_openstack: fix list-action to avoid timeout when
there are 100+ VMs on the hypervisor
Resolves: RHEL-186317
* Mon Apr 27 2026 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.2.1-129.25
- bundled cryptography: replace with dependency to fix CVE-2026-26007
- bundled PyJWT: replace with dependency to fix CVE-2026-32597