|
|
5308cf |
From 868c494d17952eecc6736683c6df04aa9d3a3199 Mon Sep 17 00:00:00 2001
|
|
|
5308cf |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
5308cf |
Date: Fri, 20 Sep 2019 12:06:55 +0200
|
|
|
5308cf |
Subject: [PATCH] fence_mpath: fix fail_usage() issue and a couple of other
|
|
|
5308cf |
minor issues w/the newly added plug/port parameter
|
|
|
5308cf |
|
|
|
5308cf |
---
|
|
|
5308cf |
agents/mpath/fence_mpath.py | 12 +++++++-----
|
|
|
5308cf |
tests/data/metadata/fence_mpath.xml | 10 +++++-----
|
|
|
5308cf |
2 files changed, 12 insertions(+), 10 deletions(-)
|
|
|
5308cf |
|
|
|
5308cf |
diff --git a/agents/mpath/fence_mpath.py b/agents/mpath/fence_mpath.py
|
|
|
5308cf |
index 25aeb052..73517851 100644
|
|
|
5308cf |
--- a/agents/mpath/fence_mpath.py
|
|
|
5308cf |
+++ b/agents/mpath/fence_mpath.py
|
|
|
5308cf |
@@ -213,7 +213,7 @@ def define_new_opts():
|
|
|
5308cf |
"longopt" : "key",
|
|
|
5308cf |
"help" : "-k, --key=[key] Replaced by -n, --plug",
|
|
|
5308cf |
"required" : "0",
|
|
|
5308cf |
- "shortdesc" : "Replaced by -n, --plug",
|
|
|
5308cf |
+ "shortdesc" : "Replaced by port/-n/--plug",
|
|
|
5308cf |
"order": 1
|
|
|
5308cf |
}
|
|
|
5308cf |
all_opt["mpathpersist_path"] = {
|
|
|
5308cf |
@@ -244,7 +244,8 @@ def main():
|
|
|
5308cf |
|
|
|
5308cf |
define_new_opts()
|
|
|
5308cf |
|
|
|
5308cf |
- all_opt["port"]["help"] = "Key to use for the current operation"
|
|
|
5308cf |
+ all_opt["port"]["required"] = "0"
|
|
|
5308cf |
+ all_opt["port"]["help"] = "-n, --plug=[key] Key to use for the current operation"
|
|
|
5308cf |
all_opt["port"]["shortdesc"] = "Key to use for the current operation. \
|
|
|
5308cf |
This key should be unique to a node and have to be written in \
|
|
|
5308cf |
/etc/multipath.conf. For the \"on\" action, the key specifies the key use to \
|
|
|
5308cf |
@@ -266,9 +267,10 @@ def main():
|
|
|
5308cf |
if "--key" in options:
|
|
|
5308cf |
options["--plug"] = options["--key"]
|
|
|
5308cf |
del options["--key"]
|
|
|
5308cf |
- elif options["--action"] in ["off", "on", "reboot", "status"] \
|
|
|
5308cf |
- and "--plug" not in options:
|
|
|
5308cf |
- fail_usage("Failed: You have to enter plug number or machine identification", stop)
|
|
|
5308cf |
+ elif "--help" not in options and options["--action"] in ["off", "on", \
|
|
|
5308cf |
+ "reboot", "status", "validate-all"] and "--plug" not in options:
|
|
|
5308cf |
+ stop_after_error = False if options["--action"] == "validate-all" else True
|
|
|
5308cf |
+ fail_usage("Failed: You have to enter plug number or machine identification", stop_after_error)
|
|
|
5308cf |
|
|
|
5308cf |
docs = {}
|
|
|
5308cf |
docs["shortdesc"] = "Fence agent for multipath persistent reservation"
|
|
|
5308cf |
diff --git a/tests/data/metadata/fence_mpath.xml b/tests/data/metadata/fence_mpath.xml
|
|
|
5308cf |
index fe9378df..f5e60823 100644
|
|
|
5308cf |
--- a/tests/data/metadata/fence_mpath.xml
|
|
|
5308cf |
+++ b/tests/data/metadata/fence_mpath.xml
|
|
|
5308cf |
@@ -17,15 +17,15 @@ The fence_mpath agent works by having a unique key for each node that has to be
|
|
|
5308cf |
<parameter name="key" unique="0" required="0">
|
|
|
5308cf |
<getopt mixed="-k, --key=[key]" />
|
|
|
5308cf |
<content type="string" />
|
|
|
5308cf |
- <shortdesc lang="en">Replaced by -n, --plug</shortdesc>
|
|
|
5308cf |
+ <shortdesc lang="en">Replaced by port/-n/--plug</shortdesc>
|
|
|
5308cf |
</parameter>
|
|
|
5308cf |
- <parameter name="plug" unique="0" required="1" obsoletes="port">
|
|
|
5308cf |
- <getopt mixed="Key to use for the current operation" />
|
|
|
5308cf |
+ <parameter name="plug" unique="0" required="0" obsoletes="port">
|
|
|
5308cf |
+ <getopt mixed="-n, --plug=[key]" />
|
|
|
5308cf |
<content type="string" />
|
|
|
5308cf |
<shortdesc lang="en">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).</shortdesc>
|
|
|
5308cf |
</parameter>
|
|
|
5308cf |
- <parameter name="port" unique="0" required="1" deprecated="1">
|
|
|
5308cf |
- <getopt mixed="Key to use for the current operation" />
|
|
|
5308cf |
+ <parameter name="port" unique="0" required="0" deprecated="1">
|
|
|
5308cf |
+ <getopt mixed="-n, --plug=[key]" />
|
|
|
5308cf |
<content type="string" />
|
|
|
5308cf |
<shortdesc lang="en">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).</shortdesc>
|
|
|
5308cf |
</parameter>
|