From cdac869412a48ba0e33542ff7859bcc5ccc0544e Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Tue, 24 Mar 2020 07:23:00 -0500
Subject: [PATCH] Honor endpoint override from config for volume

I'm guessing we should do this for everyone, but we have volume on
the brain right now. Rackspace is in the weird situation where
they do support v2 but only have v1 in the catalog (wut) So we
need to override the block-storage enpdoint by config. To do that,
we need to actually honor the config setting over here in OSC.

NOTE: We need to systemically overhaul how we're injesting config
over here - because there's too much variation. But we can leave
that for another day.

Story: 2007459
Task: 39137
Change-Id: Ifddf1ddd5abaa768ab18049c09d18bc269f3a4f5
---
 openstackclient/volume/client.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py
index fdd1794be5..1fbfaaee78 100644
--- a/openstackclient/volume/client.py
+++ b/openstackclient/volume/client.py
@@ -67,11 +67,15 @@ def make_client(instance):
     # Remember interface only if it is set
     kwargs = utils.build_kwargs_dict('endpoint_type', instance.interface)
 
+    endpoint_override = instance.sdk_connection.config.get_endpoint(
+        'block-storage')
+
     client = volume_client(
         session=instance.session,
         extensions=extensions,
         http_log_debug=http_log_debug,
         region_name=instance.region_name,
+        endpoint_override=endpoint_override,
         **kwargs
     )