- fence_openstack: fix list-action to avoid timeout when

there are 100+ VMs on the hypervisor

  Resolves: RHEL-155007
This commit is contained in:
Arslan Ahmad 2026-06-17 16:56:53 +05:30
parent 7cc3c145f5
commit cbeea82cce
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

@ -13,7 +13,7 @@
Name: fence-agents
Summary: Set of unified programs capable of host isolation ("fencing")
Version: 4.16.0
Release: 28%{?alphatag:.%{alphatag}}%{?dist}
Release: 29%{?alphatag:.%{alphatag}}%{?dist}
License: GPL-2.0-or-later AND LGPL-2.0-or-later
URL: https://github.com/ClusterLabs/fence-agents
Source0: https://fedorahosted.org/releases/f/e/fence-agents/%{name}-%{version}.tar.gz
@ -122,6 +122,7 @@ Patch20: RHEL-145086-fence_ibm_vpc-fix-missing-statuses.patch
Patch21: RHEL-170614-fence_virtd-fix-discard-const-error-with-GCC-16.patch
Patch22: RHEL-81658-fence_kubevirt-report-Succeeded-and-Failed-as-OFF.patch
Patch23: RHEL-140160-fence_ibm_vpc-set-proxy-when-token-is-expired-as-well.patch
Patch24: RHEL-155007-fence_openstack-fix-list-action-to-avoid-timeout-with-large-number-of-VMs.patch
%global supportedagents amt_ws apc apc_snmp bladecenter brocade cisco_mds cisco_ucs drac5 eaton_snmp emerson eps hpblade ibmblade ibm_powervs ibm_vpc ifmib ilo ilo_moonshot ilo_mp ilo_ssh intelmodular ipdu ipmilan kdump kubevirt lpar mpath nutanix_ahv redfish rhevm rsa rsb sbd scsi vmware_rest vmware_soap wti
%ifarch x86_64
@ -254,6 +255,7 @@ BuildRequires: %{systemd_units}
%patch -p1 -P 21
%patch -p1 -P 22
%patch -p1 -P 23
%patch -p1 -P 24
# prevent compilation of something that won't get used anyway
sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac
@ -1226,6 +1228,11 @@ are located on corosync cluster nodes.
%endif
%changelog
* Wed Jun 17 2026 Arslan Ahmad <arahmad@redhat.com> - 4.16.0-29
- fence_openstack: fix list-action to avoid timeout when
there are 100+ VMs on the hypervisor
Resolves: RHEL-155007
* Mon Jun 15 2026 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-28
- fence_ibm_vpc: set proxy when token has expired as well
Resolves: RHEL-140160