aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorJingLu5 <lvjing5@huawei.com>2017-03-08 03:28:27 +0000
committerJing Lu <lvjing5@huawei.com>2017-03-20 09:34:00 +0000
commit1cdfec0e2e8caa12ff5cd65d3f5451a4e59d26f5 (patch)
tree968ec50e5288476185a33851bead5861e6c53091 /yardstick
parent0e57aadfce643a23c7efe65739f400de859840cd (diff)
Add CPU pinning support for node context
JIRA: YARDSTICK-573 Since the yardstick framework now has supported an improved node type context, this patch adds support for VM vcpu pinning ability in the node type context. It provides several scripts that can be used to configurate the controller and compute nodes. Change-Id: If2c6e7b1b85ff78b9d2a5997bf03bdc6877aaf74 Signed-off-by: JingLu5 <lvjing5@huawei.com> (cherry picked from commit f138b480ea4c9954d107555d7a46ec3d4375653f)
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/benchmark/contexts/node.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/yardstick/benchmark/contexts/node.py b/yardstick/benchmark/contexts/node.py
index f8c38cb1c..8bf915609 100644
--- a/yardstick/benchmark/contexts/node.py
+++ b/yardstick/benchmark/contexts/node.py
@@ -78,18 +78,39 @@ class NodeContext(Context):
LOG.debug("Env: %r", self.env)
def deploy(self):
- setups = self.env.get('setup', [])
- for setup in setups:
- for host, info in setup.items():
- self._execute_script(host, info)
+ config_type = self.env.get('type', '')
+ if config_type == 'ansible':
+ self._dispatch_ansible('setup')
+ elif config_type == 'script':
+ self._dispatch_script('setup')
def undeploy(self):
- teardowns = self.env.get('teardown', [])
- for teardown in teardowns:
- for host, info in teardown.items():
+ config_type = self.env.get('type', '')
+ if config_type == 'ansible':
+ self._dispatch_ansible('teardown')
+ elif config_type == 'script':
+ self._dispatch_script('teardown')
+ super(NodeContext, self).undeploy()
+
+ def _dispatch_script(self, key):
+ steps = self.env.get(key, [])
+ for step in steps:
+ for host, info in step.items():
self._execute_script(host, info)
- super(NodeContext, self).undeploy()
+ def _dispatch_ansible(self, key):
+ try:
+ step = self.env[key]
+ except KeyError:
+ pass
+ else:
+ self._do_ansible_job(step)
+
+ def _do_ansible_job(self, path):
+ cmd = 'ansible-playbook -i inventory.ini %s' % path
+ base = '/home/opnfv/repos/yardstick/ansible'
+ p = subprocess.Popen(cmd, shell=True, cwd=base)
+ p.communicate()
def _get_server(self, attr_name):
"""lookup server info by name from context