diff options
Diffstat (limited to 'yardstick/benchmark/scenarios/availability')
8 files changed, 19 insertions, 59 deletions
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py index 1d632799d..f7683fd84 100644 --- a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py +++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py @@ -39,16 +39,11 @@ class BaremetalAttacker(BaseAttacker): def setup(self): LOG.debug("config:%s context:%s", self._config, self._context) host = self._context.get(self._config['host'], None) - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") - self.host_ip = ip + self.host_ip = host['ip'] self.ipmi_ip = host.get("ipmi_ip", None) self.ipmi_user = host.get("ipmi_user", "root") @@ -90,25 +85,24 @@ class BaremetalAttacker(BaseAttacker): self.jump_connection = None if jump_host_name is not None: host = self._context.get(jump_host_name, None) - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - pwd = host.get("pwd", None) - - LOG.debug("jump_host ip:%s user:%s", ip, user) - self.jump_connection = ssh.SSH(user, ip, password=pwd, - port=ssh_port) + + LOG.debug("jump_host ip:%s user:%s", host['ip'], host['user']) + self.jump_connection = ssh.SSH.from_node( + host, + # why do we allow pwd for password? + defaults={"user": "root", "password": host.get("pwd")} + ) self.jump_connection.wait(timeout=600) LOG.debug("ssh jump host success!") if self.jump_connection is not None: with open(self.recovery_script, "r") as stdin_file: - exit_status, stdout, stderr = self.jump_connection.execute( + self.jump_connection.execute( "/bin/bash -s {0} {1} {2} {3}".format( self.ipmi_ip, self.ipmi_user, self.ipmi_pwd, "on"), stdin=stdin_file) else: - exit_status, stdout = _execute_shell_command( + _execute_shell_command( "/bin/bash -s {0} {1} {2} {3}".format( self.ipmi_ip, self.ipmi_user, self.ipmi_pwd, "on"), stdin=open(self.recovery_script, "r")) diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py index ab5e99860..35cbccd6e 100644 --- a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py +++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py @@ -24,13 +24,8 @@ class GeneralAttacker(BaseAttacker): def setup(self): LOG.debug("config:%s context:%s", self._config, self._context) host = self._context.get(self._config['host'], None) - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py index 66934afeb..93375a6dc 100644 --- a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py +++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py @@ -23,13 +23,8 @@ class ProcessAttacker(BaseAttacker): def setup(self): LOG.debug("config:%s context:%s", self._config, self._context) host = self._context.get(self._config['host'], None) - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py index 084f80225..033a2d721 100644 --- a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py +++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py @@ -42,13 +42,9 @@ class MonitorOpenstackCmd(basemonitor.BaseMonitor): node_name = self._config.get("host", None) if node_name: host = self._context[node_name] - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, + defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py index 78a603193..c6c5a75a1 100644 --- a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py +++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py @@ -24,10 +24,6 @@ class GeneralMonitor(basemonitor.BaseMonitor): def setup(self): host = self._context[self._config["host"]] - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") self.key = self._config["key"] self.monitor_key = self._config["monitor_key"] self.monitor_type = self._config["monitor_type"] @@ -42,8 +38,7 @@ class GeneralMonitor(basemonitor.BaseMonitor): self.monitor_key) self.monitor_script = self.get_script_fullpath( self.monitor_cfg['monitor_script']) - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py index 91b6ba31a..ca5cac1ff 100644 --- a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py +++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py @@ -22,13 +22,8 @@ class MonitorProcess(basemonitor.BaseMonitor): def setup(self): host = self._context[self._config["host"]] - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") self.check_script = self.get_script_fullpath( diff --git a/yardstick/benchmark/scenarios/availability/operation/operation_general.py b/yardstick/benchmark/scenarios/availability/operation/operation_general.py index bfd7d04b0..49c63cc75 100644 --- a/yardstick/benchmark/scenarios/availability/operation/operation_general.py +++ b/yardstick/benchmark/scenarios/availability/operation/operation_general.py @@ -26,13 +26,8 @@ class GeneralOperaion(BaseOperation): def setup(self): LOG.debug("config:%s context:%s", self._config, self._context) host = self._context.get(self._config['host'], None) - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") diff --git a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py index 8f987a647..ff6017b88 100644 --- a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py +++ b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py @@ -26,13 +26,8 @@ class GeneralResultChecker(BaseResultChecker): def setup(self): LOG.debug("config:%s context:%s", self._config, self._context) host = self._context.get(self._config['host'], None) - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") |