X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Fcontexts%2Fheat.py;h=ff3e5f8014a573e766f42f5879040ed476cfd86d;hb=0c0ba9bff5e54d02b924fe1bfe30c68190a24956;hp=a4bec638277aa13dc66e00b27a5ad82c1f37fe4b;hpb=be6e7ed6f053a4a697af939fa0ddcd5dce54c0c8;p=yardstick.git diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py index a4bec6382..ff3e5f801 100644 --- a/yardstick/benchmark/contexts/heat.py +++ b/yardstick/benchmark/contexts/heat.py @@ -300,7 +300,7 @@ class HeatContext(Context): def deploy(self): """deploys template into a stack using cloud""" - print("Deploying context '%s'" % self.name) + LOG.info("Deploying context '%s' START", self.name) heat_template = HeatTemplate(self.name, self.template_file, self.heat_parameters) @@ -330,7 +330,7 @@ class HeatContext(Context): server.public_ip = \ self.stack.outputs[server.floating_ip["stack_name"]] - print("Context '%s' deployed" % self.name) + LOG.info("Deploying context '%s' DONE", self.name) def add_server_port(self, server): # use private ip from first port in first network @@ -361,6 +361,8 @@ class HeatContext(Context): 'subnet', 'gateway_ip')] return { + # add default port name + "name": port, "private_ip": private_ip, "subnet_id": outputs[h_join(stack_name, "subnet_id")], "subnet_cidr": output_subnet_cidr, @@ -380,10 +382,10 @@ class HeatContext(Context): def undeploy(self): """undeploys stack from cloud""" if self.stack: - print("Undeploying context '%s'" % self.name) + LOG.info("Undeploying context '%s' START", self.name) self.stack.delete() self.stack = None - print("Context '%s' undeployed" % self.name) + LOG.info("Undeploying context '%s' DONE", self.name) if os.path.exists(self.key_filename): try: @@ -413,10 +415,6 @@ class HeatContext(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', - h_join('files/yardstick_key', get_short_key_uuid(self.key_uuid))) - if isinstance(attr_name, collections.Mapping): node_name, cname = self.split_name(attr_name['name']) if cname is None or cname != self.name: @@ -434,14 +432,20 @@ class HeatContext(Context): if server is None: return None + pkey = pkg_resources.resource_string( + 'yardstick.resources', + h_join('files/yardstick_key', get_short_key_uuid(self.key_uuid))).decode('utf-8') + result = { "user": server.context.user, - "key_filename": key_filename, + "pkey": pkey, "private_ip": server.private_ip, "interfaces": server.interfaces, "routing_table": self.generate_routing_table(server), # empty IPv6 routing table "nd_route_tbl": [], + # we want to save the contex name so we can generate pod.yaml + "name": server.name, } # Target server may only have private_ip if server.public_ip: