aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/contexts/heat.py
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-03-06 09:32:15 +0000
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-03-06 14:17:46 +0000
commit0272210284bca74a386cf4ce19c4a4562e941aaf (patch)
treea707cc9d7838e81622daeab4080a7a8f9058ff33 /yardstick/benchmark/contexts/heat.py
parente5dbc64e2893788de4bd79530c1dbeb75095d930 (diff)
Move SSH key generation from "init" to "deploy"
In [1], the Context SSH key generation was modified; the SSH now has a name matching the name context (which depends on the given name and the task ID). In a test suite, the task ID is the same for all test cases executed in the same batch. If the context name of different test cases is the same (there is no impediment, e.g.: "demo", "yardstick"), the SSH key filename will be the same. Currently the SSH key generation is done during the initialization process, at the begining of the test suite executing. If, by coincidence, two test cases have the same context name, the first one will remove the SSH key file during the "undeploy" process; then the second one will rise an exception because the SSH key file is deleted. This patch moves the SSH key file generation from the initialization process to the context deploy process: TEST SUITE: - init: parse all test cases - test case 1: - deploy (generate SSH keys) - run - undeploy (delete SSH keys) - test case 2: ... [1] Id175061d6cfe23a068bb3d12ce176c1f176e8236 JIRA: YARDSTICK-1045 Change-Id: I05dc46db20d2a0cba3092c415ce9b248513406fb Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/benchmark/contexts/heat.py')
-rw-r--r--yardstick/benchmark/contexts/heat.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py
index 44078892b..892521e7a 100644
--- a/yardstick/benchmark/contexts/heat.py
+++ b/yardstick/benchmark/contexts/heat.py
@@ -134,16 +134,6 @@ class HeatContext(Context):
self.attrs = attrs
- self.key_filename = ''.join(
- [consts.YARDSTICK_ROOT_PATH,
- 'yardstick/resources/files/yardstick_key-',
- self.name])
- # Permissions may have changed since creation; this can be fixed. If we
- # overwrite the file, we lose future access to VMs using this key.
- # As long as the file exists, even if it is unreadable, keep it intact
- if not os.path.exists(self.key_filename):
- SSH.gen_keys(self.key_filename)
-
def check_environment(self):
try:
os.environ['OS_AUTH_URL']
@@ -308,7 +298,7 @@ class HeatContext(Context):
timeout=self.heat_timeout)
except KeyboardInterrupt:
raise y_exc.StackCreationInterrupt
- except:
+ except Exception:
LOG.exception("stack failed")
# let the other failures happen, we want stack trace
raise
@@ -325,6 +315,16 @@ class HeatContext(Context):
"""deploys template into a stack using cloud"""
LOG.info("Deploying context '%s' START", self.name)
+ self.key_filename = ''.join(
+ [consts.YARDSTICK_ROOT_PATH,
+ 'yardstick/resources/files/yardstick_key-',
+ self.name])
+ # Permissions may have changed since creation; this can be fixed. If we
+ # overwrite the file, we lose future access to VMs using this key.
+ # As long as the file exists, even if it is unreadable, keep it intact
+ if not os.path.exists(self.key_filename):
+ SSH.gen_keys(self.key_filename)
+
heat_template = HeatTemplate(self.name, self.template_file,
self.heat_parameters)