Convert thirdparty and stress tests to use global CONF object
This commit takes all the uses of config in the thirdparty and stress
tests and converts them to use the global CONF object.
Partially implements bp config-cleanup
Change-Id: I683577f133643f6159dbfe7295911d155b613f92
diff --git a/tempest/stress/actions/server_create_destroy.py b/tempest/stress/actions/server_create_destroy.py
index 84c7cf5..4a9f0d5 100644
--- a/tempest/stress/actions/server_create_destroy.py
+++ b/tempest/stress/actions/server_create_destroy.py
@@ -13,14 +13,17 @@
# limitations under the License.
from tempest.common.utils import data_utils
+from tempest import config
import tempest.stress.stressaction as stressaction
+CONF = config.CONF
+
class ServerCreateDestroyTest(stressaction.StressAction):
def setUp(self, **kwargs):
- self.image = self.manager.config.compute.image_ref
- self.flavor = self.manager.config.compute.flavor_ref
+ self.image = CONF.compute.image_ref
+ self.flavor = CONF.compute.flavor_ref
def run(self):
name = data_utils.rand_name("instance")
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 28de771..a34a20d 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -14,9 +14,12 @@
import subprocess
from tempest.common.utils import data_utils
+from tempest import config
import tempest.stress.stressaction as stressaction
import tempest.test
+CONF = config.CONF
+
class FloatingStress(stressaction.StressAction):
@@ -109,8 +112,8 @@
self.logger.info("Deleted Floating IP %s", str(self.floating['ip']))
def setUp(self, **kwargs):
- self.image = self.manager.config.compute.image_ref
- self.flavor = self.manager.config.compute.flavor_ref
+ self.image = CONF.compute.image_ref
+ self.flavor = CONF.compute.flavor_ref
self.vm_extra_args = kwargs.get('vm_extra_args', {})
self.wait_after_vm_create = kwargs.get('wait_after_vm_create',
True)
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index e6fcb81..c2e6072 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -12,14 +12,17 @@
# limitations under the License.
from tempest.common.utils import data_utils
+from tempest import config
import tempest.stress.stressaction as stressaction
+CONF = config.CONF
+
class VolumeAttachDeleteTest(stressaction.StressAction):
def setUp(self, **kwargs):
- self.image = self.manager.config.compute.image_ref
- self.flavor = self.manager.config.compute.flavor_ref
+ self.image = CONF.compute.image_ref
+ self.flavor = CONF.compute.flavor_ref
def run(self):
# Step 1: create volume
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index d37ab6d..d4689c4 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -20,11 +20,14 @@
from tempest import clients
from tempest.common import ssh
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import importutils
from tempest.openstack.common import log as logging
from tempest.stress import cleanup
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
processes = []
@@ -110,14 +113,13 @@
"""
admin_manager = clients.AdminManager()
- ssh_user = admin_manager.config.stress.target_ssh_user
- ssh_key = admin_manager.config.stress.target_private_key_path
- logfiles = admin_manager.config.stress.target_logfiles
- log_check_interval = int(admin_manager.config.stress.log_check_interval)
- default_thread_num = int(admin_manager.config.stress.
- default_thread_number_per_action)
+ ssh_user = CONF.stress.target_ssh_user
+ ssh_key = CONF.stress.target_private_key_path
+ logfiles = CONF.stress.target_logfiles
+ log_check_interval = int(CONF.stress.log_check_interval)
+ default_thread_num = int(CONF.stress.default_thread_number_per_action)
if logfiles:
- controller = admin_manager.config.stress.target_controller
+ controller = CONF.stress.target_controller
computes = _get_compute_nodes(controller, ssh_user, ssh_key)
for node in computes:
do_ssh("rm -f %s" % logfiles, node, ssh_user, ssh_key)
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 8a08cc2..19ddd18 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -18,6 +18,7 @@
from tempest import clients
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.test import attr
@@ -27,6 +28,8 @@
from tempest.thirdparty.boto.utils.wait import re_search_wait
from tempest.thirdparty.boto.utils.wait import state_wait
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -42,12 +45,11 @@
cls.s3_client = cls.os.s3_client
cls.ec2_client = cls.os.ec2api_client
cls.zone = cls.ec2_client.get_good_zone()
- config = cls.config
- cls.materials_path = config.boto.s3_materials_path
- ami_manifest = config.boto.ami_manifest
- aki_manifest = config.boto.aki_manifest
- ari_manifest = config.boto.ari_manifest
- cls.instance_type = config.boto.instance_type
+ cls.materials_path = CONF.boto.s3_materials_path
+ ami_manifest = CONF.boto.ami_manifest
+ aki_manifest = CONF.boto.aki_manifest
+ ari_manifest = CONF.boto.ari_manifest
+ cls.instance_type = CONF.boto.instance_type
cls.bucket_name = data_utils.rand_name("s3bucket-")
cls.keypair_name = data_utils.rand_name("keypair-")
cls.keypair = cls.ec2_client.create_key_pair(cls.keypair_name)
@@ -281,7 +283,7 @@
# NOTE(afazekas): it may be reports availble before it is available
ssh = RemoteClient(address.public_ip,
- self.os.config.compute.ssh_user,
+ CONF.compute.ssh_user,
pkey=self.keypair.material)
text = data_utils.rand_name("Pattern text for console output -")
resp = ssh.write_to_console(text)
diff --git a/tempest/thirdparty/boto/test_s3_ec2_images.py b/tempest/thirdparty/boto/test_s3_ec2_images.py
index 4b7d9dd..722577b 100644
--- a/tempest/thirdparty/boto/test_s3_ec2_images.py
+++ b/tempest/thirdparty/boto/test_s3_ec2_images.py
@@ -17,10 +17,13 @@
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest.test import attr
from tempest.thirdparty.boto.test import BotoTestCase
from tempest.thirdparty.boto.utils.s3 import s3_upload_dir
+CONF = config.CONF
+
class S3ImagesTest(BotoTestCase):
@@ -33,11 +36,10 @@
cls.os = clients.Manager()
cls.s3_client = cls.os.s3_client
cls.images_client = cls.os.ec2api_client
- config = cls.config
- cls.materials_path = config.boto.s3_materials_path
- cls.ami_manifest = config.boto.ami_manifest
- cls.aki_manifest = config.boto.aki_manifest
- cls.ari_manifest = config.boto.ari_manifest
+ cls.materials_path = CONF.boto.s3_materials_path
+ cls.ami_manifest = CONF.boto.ami_manifest
+ cls.aki_manifest = CONF.boto.aki_manifest
+ cls.ari_manifest = CONF.boto.ari_manifest
cls.ami_path = cls.materials_path + os.sep + cls.ami_manifest
cls.aki_path = cls.materials_path + os.sep + cls.aki_manifest
cls.ari_path = cls.materials_path + os.sep + cls.ari_manifest