File 0001-fence_sbd-if-sbd-devices-are-not-specified-with-opti.patch of Package fence-agents.37578
From 4189a2698ec8bd34f9969c15f8bd211f325b2abf 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 5c498263..a0084ac2 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 @@ which can be used in environments where sbd can be used (shared storage)."
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)
--
2.45.2