summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-10-21 20:44:09 +0000
committerGerrit Code Review <review@openstack.org>2016-10-21 20:44:09 +0000
commit59a96bb72c66426db8972acd3be55601b6135be0 (patch)
treebc3eecf927b830d161ef477016a8e0b66fac7e8e
parent422ad9ccdb8b08a223af78a1d1f48df703dd1a9d (diff)
parent3f525e01798b433732139a9bff88d9360613cd71 (diff)
downloados-client-config-59a96bb72c66426db8972acd3be55601b6135be0.tar.gz
Merge "Add support for volumev3 service type"
-rw-r--r--os_client_config/cloud_config.py9
-rw-r--r--os_client_config/tests/test_cloud_config.py5
2 files changed, 11 insertions, 3 deletions
diff --git a/os_client_config/cloud_config.py b/os_client_config/cloud_config.py
index 147eb04..82442bb 100644
--- a/os_client_config/cloud_config.py
+++ b/os_client_config/cloud_config.py
@@ -160,9 +160,12 @@ class CloudConfig(object):
# atrocity from the as-yet-unsullied eyes of our users.
# Of course, if the user requests a volumev2, that structure should
# still work.
- if (service_type == 'volume' and
- self.get_api_version(service_type).startswith('2')):
- service_type = 'volumev2'
+ # What's even more amazing is that they did it AGAIN with cinder v3
+ if service_type == 'volume':
+ if self.get_api_version(service_type).startswith('2'):
+ service_type = 'volumev2'
+ elif self.get_api_version(service_type).startswith('3'):
+ service_type = 'volumev3'
return self.config.get(key, service_type)
def get_service_name(self, service_type):
diff --git a/os_client_config/tests/test_cloud_config.py b/os_client_config/tests/test_cloud_config.py
index 2763f4d..e3d1d5d 100644
--- a/os_client_config/tests/test_cloud_config.py
+++ b/os_client_config/tests/test_cloud_config.py
@@ -158,6 +158,11 @@ class TestCloudConfig(base.TestCase):
cc.config['volume_api_version'] = '2'
self.assertEqual('volumev2', cc.get_service_type('volume'))
+ def test_volume_override_v3(self):
+ cc = cloud_config.CloudConfig("test1", "region-al", fake_services_dict)
+ cc.config['volume_api_version'] = '3'
+ self.assertEqual('volumev3', cc.get_service_type('volume'))
+
def test_get_session_no_auth(self):
config_dict = defaults.get_defaults()
config_dict.update(fake_services_dict)