aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/tempest/conf_utils.py
diff options
context:
space:
mode:
authorJuha Kosonen <juha.kosonen@nokia.com>2017-02-15 10:32:44 +0200
committerJuha Kosonen <juha.kosonen@nokia.com>2017-02-15 10:32:44 +0200
commitbc4c0c3cc4beea6b86a5f06663323c654385a04e (patch)
tree7580e07007b707d0748419a9181790bdb55b2964 /functest/opnfv_tests/openstack/tempest/conf_utils.py
parent8b0f0b5b5ce3395dddd938fc43f048eb90d8da8e (diff)
Fix tempest multisite config
Add multisite parameters into tempest config file after the file have been (re)configured by rally verifier. JIRA: FUNCTEST-721 Change-Id: I95fd7e29b5a7d1d9f82e84e383eb23e8fa813d19 Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/tempest/conf_utils.py')
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py45
1 files changed, 21 insertions, 24 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 028b085c9..893fff8c2 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -106,7 +106,19 @@ def get_verifier_deployment_dir(verifier_id, deployment_id):
'for-deployment-{}'.format(deployment_id))
-def configure_tempest(deployment_dir, IMAGE_ID=None, FLAVOR_ID=None):
+def backup_tempest_config(conf_file):
+ """
+ Copy config file to tempest results directory
+ """
+ if not os.path.exists(TEMPEST_RESULTS_DIR):
+ os.makedirs(TEMPEST_RESULTS_DIR)
+
+ shutil.copyfile(conf_file,
+ os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf'))
+
+
+def configure_tempest(deployment_dir, IMAGE_ID=None, FLAVOR_ID=None,
+ MODE=None):
"""
Calls rally verify and updates the generated tempest.conf with
given parameters
@@ -114,6 +126,8 @@ def configure_tempest(deployment_dir, IMAGE_ID=None, FLAVOR_ID=None):
conf_file = configure_verifier(deployment_dir)
configure_tempest_update_params(conf_file,
IMAGE_ID, FLAVOR_ID)
+ if MODE == 'feature_multisite':
+ configure_tempest_multisite_params(conf_file)
def configure_tempest_update_params(tempest_conf_file,
@@ -164,12 +178,7 @@ def configure_tempest_update_params(tempest_conf_file,
with open(tempest_conf_file, 'wb') as config_file:
config.write(config_file)
- # Copy tempest.conf to /home/opnfv/functest/results/tempest/
- if not os.path.exists(TEMPEST_RESULTS_DIR):
- os.makedirs(TEMPEST_RESULTS_DIR)
-
- shutil.copyfile(tempest_conf_file,
- os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf'))
+ backup_tempest_config(tempest_conf_file)
def configure_verifier(deployment_dir):
@@ -196,25 +205,11 @@ def configure_verifier(deployment_dir):
return tempest_conf_file
-def configure_tempest_multisite(deployment_dir):
+def configure_tempest_multisite_params(tempest_conf_file):
"""
- Add/update needed parameters into tempest.conf file generated by Rally
+ Add/update multisite parameters into tempest.conf file generated by Rally
"""
- logger.debug("configure the tempest")
- configure_tempest(deployment_dir)
-
- logger.debug("Finding tempest.conf file...")
- tempest_conf_old = os.path.join(deployment_dir, 'tempest.conf')
- if not os.path.isfile(tempest_conf_old):
- raise Exception("Tempest configuration file %s NOT found."
- % tempest_conf_old)
-
- # Copy tempest.conf to /home/opnfv/functest/results/tempest/
- cur_path = os.path.split(os.path.realpath(__file__))[0]
- tempest_conf_file = os.path.join(cur_path, 'tempest_multisite.conf')
- shutil.copyfile(tempest_conf_old, tempest_conf_file)
-
- logger.debug("Updating selected tempest.conf parameters...")
+ logger.debug("Updating multisite tempest.conf parameters...")
config = ConfigParser.RawConfigParser()
config.read(tempest_conf_file)
@@ -279,3 +274,5 @@ def configure_tempest_multisite(deployment_dir):
config.set('kingbird', 'api_version', kingbird_api_version)
with open(tempest_conf_file, 'wb') as config_file:
config.write(config_file)
+
+ backup_tempest_config(tempest_conf_file)