From 08c1f1d01a4c434f823642d3cfcb95664a2a0d82 Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Wed, 9 Dec 2015 17:47:27 +0800 Subject: [PATCH] Use node.uuid directly in stop_console() There's no need to call _parse_driver_info() to convert all parameters, we can directly use node.uuid. Change-Id: I88fb5901de91236c67cafb36030fe9bf46824067 --- ironic/drivers/modules/ipminative.py | 9 ++------- ironic/drivers/modules/ipmitool.py | 6 ++---- ironic/drivers/modules/seamicro.py | 6 +----- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/ironic/drivers/modules/ipminative.py b/ironic/drivers/modules/ipminative.py index af03354c1b..3df9ff94d1 100644 --- a/ironic/drivers/modules/ipminative.py +++ b/ironic/drivers/modules/ipminative.py @@ -611,17 +611,12 @@ class NativeIPMIShellinaboxConsole(base.ConsoleInterface): """Stop the remote console session for the node. :param task: a TaskManager instance containing the node to act on. - :raises: MissingParameterValue when required IPMI credentials or - the IPMI terminal port are missing - :raises: InvalidParameterValue when the IPMI terminal port is not - an integer. :raises: ConsoleError if unable to stop the console process. """ - driver_info = _parse_driver_info(task.node) try: - console_utils.stop_shellinabox_console(driver_info['uuid']) + console_utils.stop_shellinabox_console(task.node.uuid) finally: - password_file = _console_pwfile_path(driver_info['uuid']) + password_file = _console_pwfile_path(task.node.uuid) utils.unlink_without_raise(password_file) def get_console(self, task): diff --git a/ironic/drivers/modules/ipmitool.py b/ironic/drivers/modules/ipmitool.py index 3693bd09ea..5beb398063 100644 --- a/ironic/drivers/modules/ipmitool.py +++ b/ironic/drivers/modules/ipmitool.py @@ -1132,15 +1132,13 @@ class IPMIShellinaboxConsole(base.ConsoleInterface): """Stop the remote console session for the node. :param task: a task from TaskManager - :raises: InvalidParameterValue if required ipmi parameters are missing :raises: ConsoleError if unable to stop the console """ - driver_info = _parse_driver_info(task.node) try: - console_utils.stop_shellinabox_console(driver_info['uuid']) + console_utils.stop_shellinabox_console(task.node.uuid) finally: utils.unlink_without_raise( - _console_pwfile_path(driver_info['uuid'])) + _console_pwfile_path(task.node.uuid)) def get_console(self, task): """Get the type and connection information about the console.""" diff --git a/ironic/drivers/modules/seamicro.py b/ironic/drivers/modules/seamicro.py index b55f8faa38..82e1005146 100644 --- a/ironic/drivers/modules/seamicro.py +++ b/ironic/drivers/modules/seamicro.py @@ -663,14 +663,10 @@ class ShellinaboxConsole(base.ConsoleInterface): """Stop the remote console session for the node. :param task: a task from TaskManager - :raises: MissingParameterValue if required seamicro parameters are - missing :raises: ConsoleError if unable to stop the console - :raises: InvalidParameterValue if required parameter are invalid. """ - driver_info = _parse_driver_info(task.node) - console_utils.stop_shellinabox_console(driver_info['uuid']) + console_utils.stop_shellinabox_console(task.node.uuid) def get_console(self, task): """Get the type and connection information about the console.