diff options
Diffstat (limited to 'yardstick/benchmark/contexts/heat.py')
-rw-r--r-- | yardstick/benchmark/contexts/heat.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py index 9cf29981b..7bd430bc5 100644 --- a/yardstick/benchmark/contexts/heat.py +++ b/yardstick/benchmark/contexts/heat.py @@ -8,6 +8,7 @@ ############################################################################## import sys +import pkg_resources from yardstick.benchmark.contexts.base import Context from yardstick.benchmark.contexts.model import Server @@ -195,10 +196,13 @@ class HeatContext(Context): print "Context '%s' undeployed" % self.name def _get_server(self, attr_name): - '''lookup server object by name from context + '''lookup server info by name from context attr_name: either a name for a server created by yardstick or a dict with attribute name mapping when using external heat templates ''' + key_filename = pkg_resources.resource_filename( + 'yardstick.resources', 'files/yardstick_key') + if type(attr_name) is dict: cname = attr_name["name"].split(".")[1] if cname != self.name: @@ -216,8 +220,21 @@ class HeatContext(Context): server = Server(attr_name["name"].split(".")[0], self, {}) server.public_ip = public_ip server.private_ip = private_ip - return server else: if attr_name not in self._server_map: return None - return self._server_map[attr_name] + server = self._server_map[attr_name] + + if server is None: + return None + + result = { + "user": server.context.user, + "key_filename": key_filename, + "private_ip": server.private_ip + } + # Target server may only have private_ip + if server.public_ip: + result["ip"] = server.public_ip + + return result |