From da2d2731a79da35b07a4ef0d4b6f8a426f853b41 Mon Sep 17 00:00:00 2001 From: Hans Feldt Date: Mon, 29 Jun 2015 15:39:34 +0200 Subject: [PATCH] Rename server resources aligning with task file In the task file we have cross referencing between servers (VMs). This is done with DNS style naming. However servers created in the cloud does not get the same type of name. This patch aligns the cloud resource name with the one in the task file. This prepares for running external scripts that takes server names as input (see YARDSTICK-46) The "instances" support in model.Server is not really working and should be removed or fixed. No sample task file is using this feature for now. Change-Id: If2f752a82d224f07e4b5ee2361c1ff2454f39462 JIRA: - Signed-off-by: Hans Feldt --- yardstick/benchmark/context/model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yardstick/benchmark/context/model.py b/yardstick/benchmark/context/model.py index 08778598d..6e754d421 100644 --- a/yardstick/benchmark/context/model.py +++ b/yardstick/benchmark/context/model.py @@ -119,7 +119,7 @@ class Server(Object): def __init__(self, name, context, attrs): super(Server, self).__init__(name, context) - self.stack_name = context.name + "-" + self.name + self.stack_name = self.name + "." + context.name self.keypair_name = context.keypair_name self.secgroup_name = context.secgroup_name self.context = context @@ -211,12 +211,13 @@ class Server(Object): def add_to_template(self, template, networks, scheduler_hints=None): '''adds to the template one or more servers (instances)''' if self.instances == 1: - server_name = "%s-%s" % (template.name, self.name) + server_name = self.stack_name self._add_instance(template, server_name, networks, scheduler_hints=scheduler_hints) else: + # TODO(hafe) fix or remove, no test/sample for this for i in range(self.instances): - server_name = "%s-%s-%d" % (template.name, self.name, i) + server_name = "%s-%d" % (self.stack_name, i) self._add_instance(template, server_name, networks, scheduler_hints=scheduler_hints) -- 2.16.6