From: Hans Feldt Date: Mon, 29 Jun 2015 13:39:34 +0000 (+0200) Subject: Rename server resources aligning with task file X-Git-Tag: brahmaputra.1.0~222 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F17%2F917%2F2;p=yardstick.git 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 --- 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)