- fence_aws: add "skip_os_shutdown" parameter to allow hard poweroff
Resolves: RHEL-78241
This commit is contained in:
parent
32e3bbf79b
commit
dbd87af5f3
92
RHEL-78241-fence_aws-add-skipshutdown-parameter.patch
Normal file
92
RHEL-78241-fence_aws-add-skipshutdown-parameter.patch
Normal file
@ -0,0 +1,92 @@
|
||||
From 5cf006ffa3a948ccded3a55c15669f1d5efef5f5 Mon Sep 17 00:00:00 2001
|
||||
From: gguifelixamz <45173771+gguifelixamz@users.noreply.github.com>
|
||||
Date: Tue, 19 Aug 2025 02:04:53 -0700
|
||||
Subject: [PATCH] fence_aws: Add new skip_os_shutdown flag (#632)
|
||||
|
||||
---
|
||||
agents/aws/fence_aws.py | 29 ++++++++++++++++++++++++++---
|
||||
tests/data/metadata/fence_aws.xml | 5 +++++
|
||||
2 files changed, 31 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/agents/aws/fence_aws.py b/agents/aws/fence_aws.py
|
||||
index 5459a06c4..cddca4580 100644
|
||||
--- a/agents/aws/fence_aws.py
|
||||
+++ b/agents/aws/fence_aws.py
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
try:
|
||||
import boto3
|
||||
- from botocore.exceptions import ConnectionError, ClientError, EndpointConnectionError, NoRegionError
|
||||
+ from botocore.exceptions import ConnectionError, ClientError, EndpointConnectionError, NoRegionError, ParamValidationError
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
@@ -120,14 +120,28 @@ def get_self_power_status(conn, instance_id):
|
||||
def set_power_status(conn, options):
|
||||
my_instance = get_instance_id(options)
|
||||
try:
|
||||
+ if options.get("--skip-os-shutdown", "false").lower() in ["1", "yes", "on", "true"]:
|
||||
+ shutdown_option = {
|
||||
+ "SkipOsShutdown": True,
|
||||
+ "Force": True
|
||||
+ }
|
||||
+ else:
|
||||
+ shutdown_option = {
|
||||
+ "SkipOsShutdown": False,
|
||||
+ "Force": True
|
||||
+ }
|
||||
if (options["--action"]=="off"):
|
||||
if "--skip-race-check" in options or get_self_power_status(conn,my_instance) == "ok":
|
||||
- conn.instances.filter(InstanceIds=[options["--plug"]]).stop(Force=True)
|
||||
+ conn.instances.filter(InstanceIds=[options["--plug"]]).stop(**shutdown_option)
|
||||
logger.debug("Called StopInstance API call for %s", options["--plug"])
|
||||
else:
|
||||
logger.debug("Skipping fencing as instance is not in running status")
|
||||
elif (options["--action"]=="on"):
|
||||
conn.instances.filter(InstanceIds=[options["--plug"]]).start()
|
||||
+ except ParamValidationError:
|
||||
+ if (options["--action"] == "off"):
|
||||
+ logger.warning(f"SkipOsShutdown not supported with the current boto3 version {boto3.__version__} - falling back to graceful shutdown")
|
||||
+ conn.instances.filter(InstanceIds=[options["--plug"]]).stop(Force=True)
|
||||
except Exception as e:
|
||||
logger.debug("Failed to power %s %s: %s", \
|
||||
options["--action"], options["--plug"], e)
|
||||
@@ -183,12 +197,21 @@ def define_new_opts():
|
||||
"required": "0",
|
||||
"order": 7
|
||||
}
|
||||
+ all_opt["skip_os_shutdown"] = {
|
||||
+ "getopt" : ":",
|
||||
+ "longopt" : "skip-os-shutdown",
|
||||
+ "help" : "--skip-os-shutdown=[true|false] Uses SkipOsShutdown flag",
|
||||
+ "shortdesc" : "Use SkipOsShutdown flag to stop the EC2 instance",
|
||||
+ "required" : "0",
|
||||
+ "default" : "true",
|
||||
+ "order" : 8
|
||||
+ }
|
||||
|
||||
# Main agent method
|
||||
def main():
|
||||
conn = None
|
||||
|
||||
- device_opt = ["port", "no_password", "region", "access_key", "secret_key", "filter", "boto3_debug", "skip_race_check"]
|
||||
+ device_opt = ["port", "no_password", "region", "access_key", "secret_key", "filter", "boto3_debug", "skip_race_check", "skip_os_shutdown"]
|
||||
|
||||
atexit.register(atexit_handler)
|
||||
|
||||
diff --git a/tests/data/metadata/fence_aws.xml b/tests/data/metadata/fence_aws.xml
|
||||
index ad471c797..c53873bbe 100644
|
||||
--- a/tests/data/metadata/fence_aws.xml
|
||||
+++ b/tests/data/metadata/fence_aws.xml
|
||||
@@ -51,6 +51,11 @@ For instructions see: https://boto3.readthedocs.io/en/latest/guide/quickstart.ht
|
||||
<content type="boolean" />
|
||||
<shortdesc lang="en">Skip race condition check</shortdesc>
|
||||
</parameter>
|
||||
+ <parameter name="skip_os_shutdown" unique="0" required="0">
|
||||
+ <getopt mixed="--skip-os-shutdown=[true|false]" />
|
||||
+ <content type="string" default="true" />
|
||||
+ <shortdesc lang="en">Use SkipOsShutdown flag to stop the EC2 instance</shortdesc>
|
||||
+ </parameter>
|
||||
<parameter name="quiet" unique="0" required="0">
|
||||
<getopt mixed="-q, --quiet" />
|
||||
<content type="boolean" />
|
||||
@ -13,7 +13,7 @@
|
||||
Name: fence-agents
|
||||
Summary: Set of unified programs capable of host isolation ("fencing")
|
||||
Version: 4.16.0
|
||||
Release: 12%{?alphatag:.%{alphatag}}%{?dist}
|
||||
Release: 13%{?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
|
||||
@ -44,9 +44,9 @@ Source1151: aliyun-openapi-meta-5cf98b660.tar.gz
|
||||
## go mod vendor
|
||||
Source1152: aliyun-cli-go-vendor.tar.gz
|
||||
# aws
|
||||
Source1200: boto3-1.34.47.tar.gz
|
||||
Source1201: botocore-1.34.47.tar.gz
|
||||
Source1202: s3transfer-0.10.0.tar.gz
|
||||
Source1200: boto3-1.40.13.tar.gz
|
||||
Source1201: botocore-1.40.13.tar.gz
|
||||
Source1202: s3transfer-0.13.1.tar.gz
|
||||
# azure
|
||||
Source1300: azure-common-1.1.28.zip
|
||||
Source1301: azure_core-1.32.0.tar.gz
|
||||
@ -113,6 +113,7 @@ Patch12: RHEL-68322-2-fence_nutanix_ahv-update-metadata.patch
|
||||
Patch13: RHEL-88569-fence_ibm_powervs-fix-plaintext-token-file-support.patch
|
||||
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
|
||||
|
||||
%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
|
||||
@ -237,6 +238,7 @@ BuildRequires: %{systemd_units}
|
||||
%patch -p1 -P 13
|
||||
%patch -p1 -P 14
|
||||
%patch -p1 -P 15
|
||||
%patch -p1 -P 16 -F2
|
||||
|
||||
# prevent compilation of something that won't get used anyway
|
||||
sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac
|
||||
@ -414,9 +416,9 @@ Provides: bundled(python3-jmespath) = 0.10.0
|
||||
Provides: bundled(aliyun-cli) = 3.0.198
|
||||
Provides: bundled(aliyun-openapi-meta) = 5cf98b660
|
||||
# aws
|
||||
Provides: bundled(python3-boto3) = 1.34.47
|
||||
Provides: bundled(python3-botocore) = 1.34.47
|
||||
Provides: bundled(python3-s3transfer) = 0.10.0
|
||||
Provides: bundled(python3-boto3) = 1.40.13
|
||||
Provides: bundled(python3-botocore) = 1.40.13
|
||||
Provides: bundled(python3-s3transfer) = 0.13.1
|
||||
# azure
|
||||
Provides: bundled(python3-azure-common) = 1.1.28
|
||||
Provides: bundled(python3-azure-core) = 1.32.0
|
||||
@ -1209,6 +1211,10 @@ are located on corosync cluster nodes.
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Aug 20 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-13
|
||||
- fence_aws: add "skip_os_shutdown" parameter to allow hard poweroff
|
||||
Resolves: RHEL-78241
|
||||
|
||||
* Tue Aug 12 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-12
|
||||
- fence_ibm_vpc: add apikey file support
|
||||
Resolves: RHEL-107504
|
||||
|
||||
6
sources
6
sources
@ -12,9 +12,9 @@ SHA512 (jmespath-0.10.0.tar.gz) = 9e229b5809d2dd74eb7dbf518953f848175743fb0ee91f
|
||||
SHA512 (aliyun-cli-3.0.198.tar.gz) = d39f36205c1325ab7596da836d59db458beb877f870ddb9e61e85bc6a2be07c1db9042417fc0ef0edd82d307b0f45577ca62f977f37701215f50a806a4dc6473
|
||||
SHA512 (aliyun-openapi-meta-5cf98b660.tar.gz) = 0476feef9085f77a60ef80ae06ca703af0be807d3bdf1a9a7dfffb415409c1c45fcd184c86346c22a48b5794f84cebc410eeee2dfbf7dcef91c79c6fea8e15b9
|
||||
SHA512 (aliyun-cli-go-vendor.tar.gz) = 0e545d545245051efc10acdb3d0f22d3b81f60c5946f8479e5a0df16a8bcb390763212ca59ff9298633432434ebb221cce9a35e1bf00db9245eba32bfb84eb23
|
||||
SHA512 (boto3-1.34.47.tar.gz) = 619c0c9fc6bfdff106348bc4ce980403a6261a51dcfca17650e632f99548eaa4eeeece76b99974cf345eef26e2ba770ff308ed6453e211b46042d09b8d08ab13
|
||||
SHA512 (botocore-1.34.47.tar.gz) = c921a01dc9e020d447c6d16c7761ce5e04cec5c1c5792a221c5d5e833f7511a50a6568c20cb3e958553246e041fbab30be5cd835efd9eeb179fe0d29e52de5f8
|
||||
SHA512 (s3transfer-0.10.0.tar.gz) = 83c5f794770e4f3cfd2e54297a4fe228bed76d321b694380e918f39cbb7ebe5881b29499d7230a2af13e4c1c9bf2d67285116fc16cb9b6fa5f526ff1d25b607c
|
||||
SHA512 (boto3-1.40.13.tar.gz) = c1e4532e2d04d192dd23aac25a34d9a6d12f93604793f141ee32aee8808cbe91867055ae745c6c9e62ccc68cfd288e6448cef80d2db407c9558036c148d5822e
|
||||
SHA512 (botocore-1.40.13.tar.gz) = f0cbd8fd70141feef46c19002daf8c973eb2971362c56b06562ef1b35e5fcf896a575877c942cb6f2110b16c457e94f055a1aef66a3522598d5fc43386451f3a
|
||||
SHA512 (s3transfer-0.13.1.tar.gz) = 46ae91946ecb7f1c11cef7547e7f9532326298ba30e7b363738133963a86aed6477fa6128a13dd57c7668e11a3ad9505b55638acffcc9470e6162b8b73206429
|
||||
SHA512 (azure-common-1.1.28.zip) = cfa8d08e11ff7d855342a589f9780ba1b2386fd63cddcbcc04d83be8d4d8e41dceba494b617e27ed4e3da4366b9f1203819ec391ef4466a6700cc2c8b85f0c38
|
||||
SHA512 (azure_core-1.32.0.tar.gz) = a1b975e5f9560b5a9b0800c7cd41afc8040582f9b5e73aeb9216f7b076b3821337b741a5f5b7b183008108552dd62da120e0f8334492a06ea729188c85ffcbc0
|
||||
SHA512 (azure_mgmt_core-1.5.0.tar.gz) = ac88496015552ee473ebf8c7fe312bc7e79f10b33019c8a9d51e32cdcb237e8db45a5cc6bbbd94ca87bfc9090954417dd64c674847a78765377cb61468fd9987
|
||||
|
||||
Loading…
Reference in New Issue
Block a user