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(s) of ‘CONF.console.port_range’.
- 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.start_socat_console(node_uuid, port, console_cmd, env_variables=None)[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
env_variables – optional dict of environment variables to pass to the subprocess (e.g. IPMI_PASSWORD for ipmitool -E).
- Raises:
ConsoleError – if the directory for the PID file or the PID file cannot be created
ConsoleSubprocessFailed – when invoking the subprocess failed
- 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