From 53c9d79b6921d8369385e124de1f6f6e140b4d80 Mon Sep 17 00:00:00 2001 From: zhanghan Date: Wed, 23 Aug 2023 16:24:09 +0800 Subject: [PATCH] fence_mpath: fix fail_usage() issue and a couple of other minor issues w/the newly added plug/port parameter (cherry picked from commit 8907dd3770cf624751f850d0ef860f161bc7bb1e) --- fence-agents.spec | 8 +- ...ssue-and-a-couple-of-other-minor-iss.patch | 76 +++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 fix-fail_usage-issue-and-a-couple-of-other-minor-iss.patch diff --git a/fence-agents.spec b/fence-agents.spec index 91d2e3b..5d2fee7 100644 --- a/fence-agents.spec +++ b/fence-agents.spec @@ -6,12 +6,14 @@ Name: fence-agents Summary: Set of unified programs capable of host isolation ("fencing") Version: 4.5.0 -Release: 1 +Release: 2 License: GPLv2+ and LGPLv2+ Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents Source0: https://github.com/ClusterLabs/fence-agents/archive/v4.5.0.tar.gz +Patch0: fix-fail_usage-issue-and-a-couple-of-other-minor-iss.patch + %global allfenceagents %(cat < - 4.5.0-2 +- fix fail_usage() issue and a couple of other minor issues w/the newly added plug/port parameter + * Wed Jun 28 2023 zhaochaoxiang - 4.5.0-1 - Update package to version 4.5.0 diff --git a/fix-fail_usage-issue-and-a-couple-of-other-minor-iss.patch b/fix-fail_usage-issue-and-a-couple-of-other-minor-iss.patch new file mode 100644 index 0000000..9b98893 --- /dev/null +++ b/fix-fail_usage-issue-and-a-couple-of-other-minor-iss.patch @@ -0,0 +1,76 @@ +From 44b72f9ee7008e1b37c6be2288106dcd09676938 Mon Sep 17 00:00:00 2001 +From: zhanghan +Date: Wed, 23 Aug 2023 16:14:15 +0800 +Subject: [PATCH] fix fail_usage() issue and a couple of other minor issues + w/the newly added plug/port parameter + +--- + agents/mpath/fence_mpath.py | 12 +++++++----- + tests/data/metadata/fence_mpath.xml | 10 +++++----- + 2 files changed, 12 insertions(+), 10 deletions(-) + +diff --git a/agents/mpath/fence_mpath.py b/agents/mpath/fence_mpath.py +index 25aeb05..aa56242 100644 +--- a/agents/mpath/fence_mpath.py ++++ b/agents/mpath/fence_mpath.py +@@ -213,7 +213,7 @@ Each device must support SCSI-3 persistent reservations.", + "longopt" : "key", + "help" : "-k, --key=[key] Replaced by -n, --plug", + "required" : "0", +- "shortdesc" : "Replaced by -n, --plug", ++ "shortdesc" : "Replaced by port/-n/--plug", + "order": 1 + } + all_opt["mpathpersist_path"] = { +@@ -244,7 +244,8 @@ def main(): + + define_new_opts() + +- all_opt["port"]["help"] = "Key to use for the current operation" ++ all_opt["port"]["required"] = "0" ++ all_opt["port"]["help"] = "-n, --plug=[key] Key to use for the current operation" + all_opt["port"]["shortdesc"] = "Key to use for the current operation. \ + This key should be unique to a node and have to be written in \ + /etc/multipath.conf. For the \"on\" action, the key specifies the key use to \ +@@ -266,9 +267,10 @@ be removed from the device(s)." + if "--key" in options: + options["--plug"] = options["--key"] + del options["--key"] +- elif options["--action"] in ["off", "on", "reboot", "status"] \ +- and "--plug" not in options: +- fail_usage("Failed: You have to enter plug number or machine identification", stop) ++ elif "--help" not in options and options["--action"] in ["off", "on", \ ++ "reboot", "status", "validate-all"] and "--plug" not in options: ++ stop_after_error = False if options["--action"] == "validate-all" else True ++ fail_usage("Failed: You have to enter plug number or machine identification", stop_after_error) + + docs = {} + docs["shortdesc"] = "Fence agent for multipath persistent reservation" +diff --git a/tests/data/metadata/fence_mpath.xml b/tests/data/metadata/fence_mpath.xml +index fe9378d..f5e6082 100644 +--- a/tests/data/metadata/fence_mpath.xml ++++ b/tests/data/metadata/fence_mpath.xml +@@ -17,15 +17,15 @@ The fence_mpath agent works by having a unique key for each node that has to be + + + +- Replaced by -n, --plug ++ Replaced by port/-n/--plug + +- +- ++ ++ + + Key to use for the current operation. This key should be unique to a node and have to be written in /etc/multipath.conf. For the "on" action, the key specifies the key use to register the local node. For the "off" action, this key specifies the key to be removed from the device(s). + +- +- ++ ++ + + Key to use for the current operation. This key should be unique to a node and have to be written in /etc/multipath.conf. For the "on" action, the key specifies the key use to register the local node. For the "off" action, this key specifies the key to be removed from the device(s). + +-- +2.33.0 +