Convert volume api tests to use global CONF object

This commit takes all the uses of config in the volume api tests
and converts them to use the global CONF object.

Partially implements bp config-cleanup

Change-Id: I258f0b4df1850ab4d2d670c297b9c43b6916d036
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 32a355b..96e0264 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -12,11 +12,14 @@
 
 from tempest.api.volume import base
 from tempest.common.utils import data_utils
+from tempest import config
 from tempest.openstack.common import log as logging
 from tempest.services.volume.json.admin import volume_types_client
 from tempest.services.volume.json import volumes_client
 from tempest.test import attr
 
+CONF = config.CONF
+
 LOG = logging.getLogger(__name__)
 
 
@@ -26,24 +29,24 @@
     @classmethod
     def setUpClass(cls):
         super(VolumeMultiBackendTest, cls).setUpClass()
-        if not cls.config.volume_feature_enabled.multi_backend:
+        if not CONF.volume_feature_enabled.multi_backend:
             cls.tearDownClass()
             raise cls.skipException("Cinder multi-backend feature disabled")
 
-        cls.backend1_name = cls.config.volume.backend1_name
-        cls.backend2_name = cls.config.volume.backend2_name
+        cls.backend1_name = CONF.volume.backend1_name
+        cls.backend2_name = CONF.volume.backend2_name
 
-        adm_user = cls.config.identity.admin_username
-        adm_pass = cls.config.identity.admin_password
-        adm_tenant = cls.config.identity.admin_tenant_name
-        auth_url = cls.config.identity.uri
+        adm_user = CONF.identity.admin_username
+        adm_pass = CONF.identity.admin_password
+        adm_tenant = CONF.identity.admin_tenant_name
+        auth_url = CONF.identity.uri
 
-        cls.volume_client = volumes_client.VolumesClientJSON(cls.config,
+        cls.volume_client = volumes_client.VolumesClientJSON(CONF,
                                                              adm_user,
                                                              adm_pass,
                                                              auth_url,
                                                              adm_tenant)
-        cls.type_client = volume_types_client.VolumeTypesClientJSON(cls.config,
+        cls.type_client = volume_types_client.VolumeTypesClientJSON(CONF,
                                                                     adm_user,
                                                                     adm_pass,
                                                                     auth_url,
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index 4add2c1..d481251 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -15,8 +15,11 @@
 
 from tempest.api.volume import base
 from tempest.common.utils import data_utils
+from tempest import config
 from tempest.test import attr
 
+CONF = config.CONF
+
 
 class VolumeTypesTest(base.BaseVolumeV1AdminTest):
     _interface = "json"
@@ -43,8 +46,8 @@
         volume = {}
         vol_name = data_utils.rand_name("volume-")
         vol_type_name = data_utils.rand_name("volume-type-")
-        proto = self.config.volume.storage_protocol
-        vendor = self.config.volume.vendor_name
+        proto = CONF.volume.storage_protocol
+        vendor = CONF.volume.vendor_name
         extra_specs = {"storage_protocol": proto,
                        "vendor_name": vendor}
         body = {}
@@ -86,8 +89,8 @@
         # Create/get volume type.
         body = {}
         name = data_utils.rand_name("volume-type-")
-        proto = self.config.volume.storage_protocol
-        vendor = self.config.volume.vendor_name
+        proto = CONF.volume.storage_protocol
+        vendor = CONF.volume.vendor_name
         extra_specs = {"storage_protocol": proto,
                        "vendor_name": vendor}
         resp, body = self.client.create_volume_type(
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 9c6eebe..de2b240 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -15,9 +15,12 @@
 
 from tempest import clients
 from tempest.common.utils import data_utils
+from tempest import config
 from tempest.openstack.common import log as logging
 import tempest.test
 
+CONF = config.CONF
+
 LOG = logging.getLogger(__name__)
 
 
@@ -30,17 +33,17 @@
         cls.set_network_resources()
         super(BaseVolumeTest, cls).setUpClass()
 
-        if not cls.config.service_available.cinder:
+        if not CONF.service_available.cinder:
             skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
             raise cls.skipException(skip_msg)
 
         cls.os = cls.get_client_manager()
 
         cls.servers_client = cls.os.servers_client
-        cls.image_ref = cls.config.compute.image_ref
-        cls.flavor_ref = cls.config.compute.flavor_ref
-        cls.build_interval = cls.config.volume.build_interval
-        cls.build_timeout = cls.config.volume.build_timeout
+        cls.image_ref = CONF.compute.image_ref
+        cls.flavor_ref = CONF.compute.flavor_ref
+        cls.build_interval = CONF.volume.build_interval
+        cls.build_timeout = CONF.volume.build_timeout
         cls.snapshots = []
         cls.volumes = []
 
@@ -109,7 +112,7 @@
 class BaseVolumeV1Test(BaseVolumeTest):
     @classmethod
     def setUpClass(cls):
-        if not cls.config.volume_feature_enabled.api_v1:
+        if not CONF.volume_feature_enabled.api_v1:
             msg = "Volume API v1 not supported"
             raise cls.skipException(msg)
         super(BaseVolumeV1Test, cls).setUpClass()
@@ -123,14 +126,14 @@
     @classmethod
     def setUpClass(cls):
         super(BaseVolumeV1AdminTest, cls).setUpClass()
-        cls.adm_user = cls.config.identity.admin_username
-        cls.adm_pass = cls.config.identity.admin_password
-        cls.adm_tenant = cls.config.identity.admin_tenant_name
+        cls.adm_user = CONF.identity.admin_username
+        cls.adm_pass = CONF.identity.admin_password
+        cls.adm_tenant = CONF.identity.admin_tenant_name
         if not all((cls.adm_user, cls.adm_pass, cls.adm_tenant)):
             msg = ("Missing Volume Admin API credentials "
                    "in configuration.")
             raise cls.skipException(msg)
-        if cls.config.compute.allow_tenant_isolation:
+        if CONF.compute.allow_tenant_isolation:
             creds = cls.isolated_creds.get_admin_creds()
             admin_username, admin_tenant_name, admin_password = creds
             cls.os_adm = clients.Manager(username=admin_username,
diff --git a/tempest/api/volume/test_extensions.py b/tempest/api/volume/test_extensions.py
index deef8a1..cceffd6 100644
--- a/tempest/api/volume/test_extensions.py
+++ b/tempest/api/volume/test_extensions.py
@@ -15,9 +15,12 @@
 
 
 from tempest.api.volume import base
+from tempest import config
 from tempest.openstack.common import log as logging
 from tempest.test import attr
 
+CONF = config.CONF
+
 
 LOG = logging.getLogger(__name__)
 
@@ -30,11 +33,11 @@
         # List of all extensions
         resp, extensions = self.volumes_extension_client.list_extensions()
         self.assertEqual(200, resp.status)
-        if len(self.config.volume_feature_enabled.api_extensions) == 0:
+        if len(CONF.volume_feature_enabled.api_extensions) == 0:
             raise self.skipException('There are not any extensions configured')
         extension_list = [extension.get('alias') for extension in extensions]
         LOG.debug("Cinder extensions: %s" % ','.join(extension_list))
-        ext = self.config.volume_feature_enabled.api_extensions[0]
+        ext = CONF.volume_feature_enabled.api_extensions[0]
         if ext == 'all':
             self.assertIn('Hosts', map(lambda x: x['name'], extensions))
         elif ext:
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 4ee7bd0..fc4f07d 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -15,8 +15,11 @@
 
 from tempest.api.volume import base
 from tempest import clients
+from tempest import config
 from tempest.test import attr
 
+CONF = config.CONF
+
 
 class VolumesTransfersTest(base.BaseVolumeV1Test):
     _interface = "json"
@@ -26,7 +29,7 @@
         super(VolumesTransfersTest, cls).setUpClass()
 
         # Add another tenant to test volume-transfer
-        if cls.config.compute.allow_tenant_isolation:
+        if CONF.compute.allow_tenant_isolation:
             creds = cls.isolated_creds.get_alt_creds()
             username, tenant_name, password = creds
             cls.os_alt = clients.Manager(username=username,
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index e767ec0..5924c7e 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -15,10 +15,13 @@
 
 from tempest.api.volume import base
 from tempest.common.utils import data_utils
+from tempest import config
 from tempest.test import attr
 from tempest.test import services
 from tempest.test import stresstest
 
+CONF = config.CONF
+
 
 class VolumesActionsTest(base.BaseVolumeV1Test):
     _interface = "json"
@@ -98,7 +101,7 @@
         image_name = data_utils.rand_name('Image-')
         resp, body = self.client.upload_volume(self.volume['id'],
                                                image_name,
-                                               self.config.volume.disk_format)
+                                               CONF.volume.disk_format)
         image_id = body["image_id"]
         self.addCleanup(self.image_client.delete_image, image_id)
         self.assertEqual(202, resp.status)
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 79a4365..28c332e 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -15,9 +15,12 @@
 
 from tempest.api.volume import base
 from tempest.common.utils import data_utils
+from tempest import config
 from tempest.test import attr
 from tempest.test import services
 
+CONF = config.CONF
+
 
 class VolumesGetTest(base.BaseVolumeV1Test):
     _interface = "json"
@@ -131,8 +134,7 @@
     @attr(type='smoke')
     @services('image')
     def test_volume_create_get_update_delete_from_image(self):
-        self._volume_create_get_update_delete(imageRef=self.
-                                              config.compute.image_ref)
+        self._volume_create_get_update_delete(imageRef=CONF.compute.image_ref)
 
     @attr(type='gate')
     def test_volume_create_get_update_delete_as_clone(self):