From 0953eff609addcf4d04b752cd141134e95f7ad2e Mon Sep 17 00:00:00 2001 From: Kiran Pawar Date: Tue, 20 May 2025 13:14:50 +0000 Subject: [PATCH] Add option to override API endpoint Provide an option to override API endpoint to address multiple manila deployments on same cloud. Usage as following: "openstack --os-endpoint-override share list" Closes-bug: #2111331 Co-authored-by: Chuan Miao Change-Id: I5e11256473ab88b08e7374fd68f58a0257adab1f Signed-off-by: Kiran Pawar --- doc/source/cli/osc_plugin_cli.rst | 7 +++++++ manilaclient/osc/plugin.py | 13 +++++++++++++ ...t-of-api-endpoint-override-e36e75246d39a367.yaml | 6 ++++++ 3 files changed, 26 insertions(+) create mode 100644 releasenotes/notes/add-support-of-api-endpoint-override-e36e75246d39a367.yaml diff --git a/doc/source/cli/osc_plugin_cli.rst b/doc/source/cli/osc_plugin_cli.rst index b43aead95..88e30318e 100644 --- a/doc/source/cli/osc_plugin_cli.rst +++ b/doc/source/cli/osc_plugin_cli.rst @@ -31,6 +31,13 @@ environment variables:: export OS_AUTH_URL=http://... export OS_SHARE_API_VERSION=2.51 +It is possible to use different Manila endpoint while using Openstack +Client. In this case, you can use configuration option +``--os-endpoint-override`` or set the corresponding environment +variable:: + + export OS_ENDPOINT_OVERRIDE=http://... + Getting help ============ diff --git a/manilaclient/osc/plugin.py b/manilaclient/osc/plugin.py index 568b2f3fd..e6392d657 100644 --- a/manilaclient/osc/plugin.py +++ b/manilaclient/osc/plugin.py @@ -113,4 +113,17 @@ def build_option_parser(parser): 'version supported by both the client and the server). ' '(Env: OS_SHARE_API_VERSION)', ) + parser.add_argument( + "--os-endpoint-override", + metavar="", + default=utils.env( + "OS_ENDPOINT_OVERRIDE", + "OS_MANILA_BYPASS_URL", + "MANILACLIENT_BYPASS_URL", + ), + help=( + "Use this API endpoint instead of the Service Catalog. " + "Defaults to env[OS_ENDPOINT_OVERRIDE]." + ), + ) return parser diff --git a/releasenotes/notes/add-support-of-api-endpoint-override-e36e75246d39a367.yaml b/releasenotes/notes/add-support-of-api-endpoint-override-e36e75246d39a367.yaml new file mode 100644 index 000000000..9eddf8734 --- /dev/null +++ b/releasenotes/notes/add-support-of-api-endpoint-override-e36e75246d39a367.yaml @@ -0,0 +1,6 @@ +--- +features: + - Manilaclient is updated to consider API endpoint override option + `--os-endpoint-override`. For example, "openstack share list" command + for different API endpoint will be "openstack --os-endpoint-override + share list".