- fence_gce: fix node list limit

Resolves: RHEL-128925
This commit is contained in:
Oyvind Albrigtsen 2025-11-18 12:56:14 +01:00
parent 7906be9824
commit 3ba2dbaebe
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From 07285aacbc2194c6a2dfc7dd62dda9a3308bc243 Mon Sep 17 00:00:00 2001
From: dfellmeth-google <dfellmeth@google.com>
Date: Mon, 17 Nov 2025 04:44:49 -0500
Subject: [PATCH] fence_gce: fix node list limit (#640)
This change introduces filtering using the plug to the instances.list method to reduce the number of results returned.
It also introduces pagination if the list returned is still too large.
---
agents/gce/fence_gce.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/agents/gce/fence_gce.py b/agents/gce/fence_gce.py
index 759567c6f..c7bd2a5dc 100644
--- a/agents/gce/fence_gce.py
+++ b/agents/gce/fence_gce.py
@@ -150,15 +150,24 @@ def get_nodes_list(conn, options):
result = {}
plug = options["--plug"] if "--plug" in options else ""
zones = options["--zone"] if "--zone" in options else ""
+ filter = "name="+plug if plug != "" else ""
+ max_results = 1 if options.get("--action") == "monitor" else 500
if not zones:
zones = get_zone(conn, options, plug) if "--plugzonemap" not in options else options["--plugzonemap"][plug]
try:
for zone in zones.split(","):
- instanceList = retry_api_execute(options, conn.instances().list(
+ request = conn.instances().list(
project=options["--project"],
- zone=zone))
+ zone=zone,
+ filter=filter,
+ maxResults=max_results)
+ while request is not None:
+ instanceList = retry_api_execute(options, request)
+ if "items" not in instanceList:
+ break
for instance in instanceList["items"]:
result[instance["id"]] = (instance["name"], translate_status(instance["status"]))
+ request = conn.instances().list_next(previous_request=request, previous_response=instanceList)
except Exception as err:
fail_fence_agent(options, "Failed: get_nodes_list: {}".format(str(err)))

View File

@ -13,7 +13,7 @@
Name: fence-agents
Summary: Set of unified programs capable of host isolation ("fencing")
Version: 4.16.0
Release: 16%{?alphatag:.%{alphatag}}%{?dist}
Release: 17%{?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
@ -115,6 +115,7 @@ Patch14: RHEL-95379-fence_kubevirt-force-off.patch
Patch15: RHEL-107504-fence_ibm_vpc-add-apikey-file-support.patch
Patch16: RHEL-78241-fence_aws-add-skipshutdown-parameter.patch
Patch17: RHEL-114752-fence_ibm_powervs-update-api-type-description.patch
Patch18: RHEL-128925-fence_gce-fix-node-list-limit.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
@ -241,6 +242,7 @@ BuildRequires: %{systemd_units}
%patch -p1 -P 15
%patch -p1 -P 16 -F2
%patch -p1 -P 17
%patch -p1 -P 18
# prevent compilation of something that won't get used anyway
sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac
@ -1213,6 +1215,10 @@ are located on corosync cluster nodes.
%endif
%changelog
* Tue Nov 18 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-17
- fence_gce: fix node list limit
Resolves: RHEL-128925
* Wed Sep 17 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-16
- fence_ibm_powervs: update description of api-type parameter to show
correct default value