ironic.drivers.modules.console_utils module

Ironic console utilities.

ironic.drivers.modules.console_utils.acquire_port(host=None)[source]

Returns a free TCP port on current host.

Find and returns a free TCP port in the range of ‘CONF.console.port_range’.

ironic.drivers.modules.console_utils.get_shellinabox_console_url(port)[source]

Get a url to access the console via shellinaboxd.

Parameters:

port – the terminal port for the node.

ironic.drivers.modules.console_utils.get_socat_console_url(port)[source]

Get a URL to access the console via socat.

Parameters:

port – the terminal port (integer) for the node

Returns:

an access URL to the socat console of the node

ironic.drivers.modules.console_utils.make_persistent_password_file(path, password)[source]

Writes a file containing a password until deleted.

ironic.drivers.modules.console_utils.release_port(port)[source]

Release specified TCP port.

ironic.drivers.modules.console_utils.start_shellinabox_console(node_uuid, port, console_cmd)[source]

Open the serial console for a node.

Parameters:
  • node_uuid – the uuid for the node.

  • port – the terminal port for the node.

  • console_cmd – the shell command that gets the console.

Raises:

ConsoleError if the directory for the PID file cannot be created or an old process cannot be stopped.

Raises:

ConsoleSubprocessFailed when invoking the subprocess failed.

ironic.drivers.modules.console_utils.start_socat_console(node_uuid, port, console_cmd)[source]

Open the serial console for a node.

Parameters:
  • node_uuid – the uuid of the node

  • port – the terminal port for the node

  • console_cmd – the shell command that will be executed by socat to establish console to the node

Raises:
ironic.drivers.modules.console_utils.stop_shellinabox_console(node_uuid)[source]

Close the serial console for a node.

Parameters:

node_uuid – the UUID of the node

Raises:

ConsoleError if unable to stop the console process

ironic.drivers.modules.console_utils.stop_socat_console(node_uuid)[source]

Close the serial console for a node.

Parameters:

node_uuid – the UUID of the node

Raises:

ConsoleError – if unable to stop the console process