Bugfix: HA kill process recovery has a conflict
[yardstick.git] / yardstick / benchmark / scenarios / compute / computecapacity.py
index 7f0c58d..688661c 100644 (file)
@@ -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
@@ -39,13 +42,9 @@ class ComputeCapacity(base.Scenario):
 
         nodes = self.context_cfg['nodes']
         node = nodes.get('host', None)
-        host_user = node.get('user', 'ubuntu')
-        ssh_port = node.get('ssh_port', ssh.DEFAULT_PORT)
-        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,
-                              port=ssh_port)
+        self.client = ssh.SSH.from_node(node, defaults={
+            "user": "ubuntu", "password": "root"
+        })
         self.client.wait(timeout=600)
 
         # copy script to host
@@ -66,4 +65,4 @@ class ComputeCapacity(base.Scenario):
         if status:
             raise RuntimeError(stderr)
 
-        result.update(json.loads(stdout))
+        result.update(jsonutils.loads(stdout))