X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=yardstick%2Fbenchmark%2Fscenarios%2Fcompute%2Fcomputecapacity.py;h=688661c5f7d5250a22645750a7f4cb24508f0d0a;hb=1c67f896d6f8c19bb1589bba16f0e1ce2ebaae0a;hp=366b470e85ea6899ed2bbfee6ba2b934b84d28a5;hpb=41dde94d0a4e575317c297e124ba0624e64c8552;p=yardstick.git diff --git a/yardstick/benchmark/scenarios/compute/computecapacity.py b/yardstick/benchmark/scenarios/compute/computecapacity.py index 366b470e8..688661c5f 100644 --- a/yardstick/benchmark/scenarios/compute/computecapacity.py +++ b/yardstick/benchmark/scenarios/compute/computecapacity.py @@ -6,9 +6,12 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -import pkg_resources +from __future__ import absolute_import + import logging -import json + +import pkg_resources +from oslo_serialization import jsonutils import yardstick.ssh as ssh from yardstick.benchmark.scenarios import base @@ -38,17 +41,14 @@ class ComputeCapacity(base.Scenario): ComputeCapacity.TARGET_SCRIPT) nodes = self.context_cfg['nodes'] - node = nodes.get('host1', None) - host_user = node.get('user', 'ubuntu') - host_ip = node.get('ip', None) - host_pwd = node.get('password', 'root') - LOG.debug("user:%s, host:%s", host_user, host_ip) - self.client = ssh.SSH(host_user, host_ip, password=host_pwd) + node = nodes.get('host', None) + self.client = ssh.SSH.from_node(node, defaults={ + "user": "ubuntu", "password": "root" + }) self.client.wait(timeout=600) # copy script to host - self.client.run("cat > ~/computecapacity.sh", - stdin=open(self.target_script, 'rb')) + self.client._put_file_shell(self.target_script, '~/computecapacity.sh') self.setup_done = True @@ -65,4 +65,4 @@ class ComputeCapacity(base.Scenario): if status: raise RuntimeError(stderr) - result.update(json.loads(stdout)) + result.update(jsonutils.loads(stdout))