X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Fscenarios%2Fstorage%2Fstoragecapacity.py;h=b6c403f477f0142ec1b8df05bd6feb860521f18b;hb=99abbb424007da2e01762f3c040a39c0157cbe1f;hp=bf5bc281003da10c8e3082d248c15d21cbeb5e88;hpb=d66ba5a3b6cfb7743913ef4e6da2eaabe1778e34;p=yardstick.git diff --git a/yardstick/benchmark/scenarios/storage/storagecapacity.py b/yardstick/benchmark/scenarios/storage/storagecapacity.py index bf5bc2810..b6c403f47 100644 --- a/yardstick/benchmark/scenarios/storage/storagecapacity.py +++ b/yardstick/benchmark/scenarios/storage/storagecapacity.py @@ -6,9 +6,13 @@ # 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 +from six.moves import range import yardstick.ssh as ssh from yardstick.benchmark.scenarios import base @@ -53,14 +57,10 @@ class StorageCapacity(base.Scenario): host = self.context_cfg['host'] if host is None: raise RuntimeError('No right node.Please check the configuration') - host_user = host.get('user', 'ubuntu') - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - host_ip = host.get('ip', None) - host_pwd = host.get('password', 'root') - LOG.debug("user:%s, host:%s", host_user, host_ip) - - self.client = ssh.SSH(host_user, host_ip, password=host_pwd, - port=ssh_port) + + self.client = ssh.SSH.from_node(host, defaults={ + "user": "ubuntu", "password": "root" + }) self.client.wait(timeout=600) # copy script to host @@ -131,4 +131,4 @@ class StorageCapacity(base.Scenario): if status: raise RuntimeError(stderr) - result.update(json.loads(stdout)) + result.update(jsonutils.loads(stdout))