diff options
author | JingLu5 <lvjing5@huawei.com> | 2017-01-09 11:35:47 +0000 |
---|---|---|
committer | JingLu5 <lvjing5@huawei.com> | 2017-01-10 10:06:32 +0000 |
commit | 5386de98f7d9e44ab507904d82530fff3a3ae5e4 (patch) | |
tree | 5629791c65ee13f553a830344726a666b291edb3 /yardstick/orchestrator/heat.py | |
parent | 57011bd0769f54a98b90d489df0f38751ca76c0e (diff) |
associate an uuid to yardstick_key and yardstick_key.pub
JIRA: YARDSTICK-527
This work is to support yardstick parallel tasks in the future.
Currently, the RSA key we generated and used to access the VM is named
'yardstick_key'.
If more than two tasks are running paralleled, the later 'yardstick_key' will
cover the former.
We want associate an uuid to identify differnets for each tasks. So the key
files won't conflict.
The first 8 digits will be used, as there is no need to used a full-length uuid.
Change-Id: If8eaf47ae527cf9b3bd50f37ab3051fbdccf5f03
Signed-off-by: JingLu5 <lvjing5@huawei.com>
Diffstat (limited to 'yardstick/orchestrator/heat.py')
-rw-r--r-- | yardstick/orchestrator/heat.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py index 4839455e1..f1104d625 100644 --- a/yardstick/orchestrator/heat.py +++ b/yardstick/orchestrator/heat.py @@ -17,6 +17,7 @@ import logging import pkg_resources import json +from oslo_utils import encodeutils import heatclient from yardstick.common import template_format @@ -297,15 +298,19 @@ class HeatTemplate(HeatObject): } } - def add_keypair(self, name): + def add_keypair(self, name, key_uuid): '''add to the template a Nova KeyPair''' log.debug("adding Nova::KeyPair '%s'", name) self.resources[name] = { 'type': 'OS::Nova::KeyPair', 'properties': { 'name': name, - 'public_key': pkg_resources.resource_string( - 'yardstick.resources', 'files/yardstick_key.pub') + 'public_key': encodeutils.safe_decode( + pkg_resources.resource_string( + 'yardstick.resources', + 'files/yardstick_key-{:.{width}}.pub'.format( + key_uuid, width=8)), + 'utf-8') } } |