diff options
| author | Vu Tran <vu.tran@windriver.com> | 2014-07-10 10:23:50 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-07-17 00:14:05 -0400 |
| commit | 7f3468c7dba61e9330dd1748e50c0ad275847bed (patch) | |
| tree | d71cbe7b9db9e11c20104eb5ee76f84d1d03c2e9 /meta-openstack/recipes-devtools/python | |
| parent | 3d16c9b202967ee9485943568db917d65288b6f3 (diff) | |
| download | meta-cloud-services-7f3468c7dba61e9330dd1748e50c0ad275847bed.tar.gz | |
Rally verification to use existing tempest
By default, Rally verification requires to do
following things:
* git clone tempest source from upstream
* setup virtualenv for this tempest
* setup testr environment with virtualenv above
* create tempest.conf for this tempest
If tempest is already installed/configured in rootfs
then force Rally to use this existing tempest.
A new introduced option "existing_tempest_config" in /etc/rally/rally.conf
can be used to configure Rally to either use the existing
tempest or to download from upstream.
If the option "existing_tempest_config" is not set then follows
the default path. If existing_tempest_config is set to absolute
path of tempest config folder (which contains tempest "tools"
and .testr.conf) then Rally uses this existing tempest.
Signed-off-by: Vu Tran <vu.tran@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python')
3 files changed, 127 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-rally/rally.conf b/meta-openstack/recipes-devtools/python/python-rally/rally.conf index 1c1f864..bc74be7 100644 --- a/meta-openstack/recipes-devtools/python/python-rally/rally.conf +++ b/meta-openstack/recipes-devtools/python/python-rally/rally.conf | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | [DEFAULT] | 1 | [DEFAULT] |
| 2 | 2 | ||
| 3 | # Inform Rally to use existing tempest instead of | ||
| 4 | # dynamically installing tempest from internet | ||
| 5 | existing_tempest_config=/etc/tempest/ | ||
| 6 | |||
| 3 | # | 7 | # |
| 4 | # Options defined in rally.exceptions | 8 | # Options defined in rally.exceptions |
| 5 | # | 9 | # |
diff --git a/meta-openstack/recipes-devtools/python/python-rally/verification-to-use-existing-tempest.patch b/meta-openstack/recipes-devtools/python/python-rally/verification-to-use-existing-tempest.patch new file mode 100644 index 0000000..4923c37 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-rally/verification-to-use-existing-tempest.patch | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | verification: to use existing tempest | ||
| 2 | |||
| 3 | By default, Rally verification requires to do | ||
| 4 | following things: | ||
| 5 | |||
| 6 | * git clone tempest source from upstream | ||
| 7 | * setup virtualenv for this tempest | ||
| 8 | * setup testr environement with virtualenv above | ||
| 9 | * create tempest.conf for this tempest | ||
| 10 | |||
| 11 | If tempest is already installed/configured in rootfs | ||
| 12 | then force Rally to use this existing tempest. | ||
| 13 | |||
| 14 | If the option "existing_tempest_config" in /etc/rally/rally.conf | ||
| 15 | is not set then follows the default path. If existing_tempest_config | ||
| 16 | is set to absolute path of tempest config folder (which | ||
| 17 | contains tempest "tools" amd .testr.conf) then Rally | ||
| 18 | uses this existing tempest. | ||
| 19 | |||
| 20 | Signed-off-by: Vu Tran <vu.tran@windriver.com> | ||
| 21 | |||
| 22 | diff --git a/rally/orchestrator/api.py b/rally/orchestrator/api.py | ||
| 23 | index d0cc769..644c16b 100644 | ||
| 24 | --- a/rally/orchestrator/api.py | ||
| 25 | +++ b/rally/orchestrator/api.py | ||
| 26 | @@ -143,8 +143,11 @@ def verify(deploy_id, set_name, regex): | ||
| 27 | verification = objects.Verification(deployment_uuid=deploy_id) | ||
| 28 | verifier = tempest.Tempest(deploy_id, verification=verification) | ||
| 29 | if not verifier.is_installed(): | ||
| 30 | - print("Tempest is not installed for specified deployment.") | ||
| 31 | - print("Installing Tempest for deployment %s" % deploy_id) | ||
| 32 | + if tempest.CONF.existing_tempest_config is None: | ||
| 33 | + print("Tempest is not installed for specified deployment.") | ||
| 34 | + print("Installing Tempest for deployment %s" % deploy_id) | ||
| 35 | + else: | ||
| 36 | + print("Configuring existing Tempest for deployment %s" % deploy_id) | ||
| 37 | verifier.install() | ||
| 38 | LOG.info("Starting verification of deployment: %s" % deploy_id) | ||
| 39 | |||
| 40 | diff --git a/rally/verification/verifiers/tempest/tempest.py b/rally/verification/verifiers/tempest/tempest.py | ||
| 41 | index 13a829d..428af49 100644 | ||
| 42 | --- a/rally/verification/verifiers/tempest/tempest.py | ||
| 43 | +++ b/rally/verification/verifiers/tempest/tempest.py | ||
| 44 | @@ -25,9 +25,17 @@ from rally.openstack.common import jsonutils | ||
| 45 | from rally import utils | ||
| 46 | from rally.verification.verifiers.tempest import config | ||
| 47 | from rally.verification.verifiers.tempest import subunit2json | ||
| 48 | +from oslo.config import cfg | ||
| 49 | |||
| 50 | LOG = logging.getLogger(__name__) | ||
| 51 | |||
| 52 | +CONF = cfg.CONF | ||
| 53 | +CONF.register_opts([ | ||
| 54 | + cfg.StrOpt("existing_tempest_config", default=None, | ||
| 55 | + help="Path to existing tempest config folder, this path " | ||
| 56 | + "should contain \"tools\" folder and .testr.conf file") | ||
| 57 | +]) | ||
| 58 | + | ||
| 59 | |||
| 60 | class Tempest(object): | ||
| 61 | |||
| 62 | @@ -41,8 +49,11 @@ class Tempest(object): | ||
| 63 | "for-deployment-%s" % deploy_id) | ||
| 64 | self.config_file = os.path.join(self.tempest_path, "tempest.conf") | ||
| 65 | self.log_file_raw = os.path.join(self.tempest_path, "subunit.stream") | ||
| 66 | - self.venv_wrapper = os.path.join(self.tempest_path, | ||
| 67 | + if CONF.existing_tempest_config is None: | ||
| 68 | + self.venv_wrapper = os.path.join(self.tempest_path, | ||
| 69 | "tools/with_venv.sh") | ||
| 70 | + else: | ||
| 71 | + self.venv_wrapper = "" | ||
| 72 | self.verification = verification | ||
| 73 | self._env = None | ||
| 74 | |||
| 75 | @@ -62,6 +73,9 @@ class Tempest(object): | ||
| 76 | return self._env | ||
| 77 | |||
| 78 | def _install_venv(self): | ||
| 79 | + if CONF.existing_tempest_config is not None: | ||
| 80 | + open(os.path.join(self.tempest_path, '.venv'), 'w').close() | ||
| 81 | + return | ||
| 82 | if not os.path.isdir(os.path.join(self.tempest_path, '.venv')): | ||
| 83 | LOG.info("No virtual environment found...Install the virtualenv.") | ||
| 84 | LOG.debug("Virtual environment directory: %s" % | ||
| 85 | @@ -111,10 +125,13 @@ class Tempest(object): | ||
| 86 | def install(self): | ||
| 87 | if not self.is_installed(): | ||
| 88 | try: | ||
| 89 | - if not os.path.exists(Tempest.tempest_base_path): | ||
| 90 | + if CONF.existing_tempest_config is None and \ | ||
| 91 | + not os.path.exists(Tempest.tempest_base_path): | ||
| 92 | Tempest._clone() | ||
| 93 | - | ||
| 94 | - if not os.path.exists(self.tempest_path): | ||
| 95 | + if CONF.existing_tempest_config is not None: | ||
| 96 | + shutil.copytree(CONF.existing_tempest_config, | ||
| 97 | + self.tempest_path) | ||
| 98 | + elif not os.path.exists(self.tempest_path): | ||
| 99 | shutil.copytree(Tempest.tempest_base_path, | ||
| 100 | self.tempest_path) | ||
| 101 | subprocess.check_call("git checkout master; " | ||
| 102 | @@ -128,7 +145,10 @@ class Tempest(object): | ||
| 103 | self.uninstall() | ||
| 104 | raise exceptions.TempestSetupFailure("failed cmd: '%s'", e.cmd) | ||
| 105 | else: | ||
| 106 | - print("Tempest has been successfully installed!") | ||
| 107 | + if CONF.existing_tempest_config is None: | ||
| 108 | + print("Tempest has been successfully installed!") | ||
| 109 | + else: | ||
| 110 | + print("Verifier has been successfully configured to use existing Tempest") | ||
| 111 | |||
| 112 | else: | ||
| 113 | print("Tempest is already installed") | ||
| 114 | @@ -139,7 +159,7 @@ class Tempest(object): | ||
| 115 | |||
| 116 | @utils.log_verification_wrapper(LOG.info, _("Run verification.")) | ||
| 117 | def _prepare_and_run(self, set_name, regex): | ||
| 118 | - if not self.is_configured(): | ||
| 119 | + if CONF.existing_tempest_config is None and not self.is_configured(): | ||
| 120 | self.generate_config_file() | ||
| 121 | |||
| 122 | if set_name == "full": | ||
diff --git a/meta-openstack/recipes-devtools/python/python-rally_git.bb b/meta-openstack/recipes-devtools/python/python-rally_git.bb index 77c140a..2a83457 100644 --- a/meta-openstack/recipes-devtools/python/python-rally_git.bb +++ b/meta-openstack/recipes-devtools/python/python-rally_git.bb | |||
| @@ -15,6 +15,7 @@ SRC_URI = "git://github.com/stackforge/${SRCNAME}.git;branch=master \ | |||
| 15 | file://task-example.json \ | 15 | file://task-example.json \ |
| 16 | file://deployment-existing.json \ | 16 | file://deployment-existing.json \ |
| 17 | file://remove-ironic-support.patch \ | 17 | file://remove-ironic-support.patch \ |
| 18 | file://verification-to-use-existing-tempest.patch \ | ||
| 18 | " | 19 | " |
| 19 | 20 | ||
| 20 | SRCREV="b297cf00750f263b8b5bdeb71f6952f672e87f5a" | 21 | SRCREV="b297cf00750f263b8b5bdeb71f6952f672e87f5a" |
