The ironic_lib.utils Module

Utilities and helper functions.

ironic_lib.utils.dd(src, dst, *args)[source]

Execute dd from src to dst.

Parameters:
  • src – the input file for dd command.
  • dst – the output file for dd command.
  • args – a tuple containing the arguments to be passed to dd command.
Raises:

processutils.ProcessExecutionError if it failed to run the process.

ironic_lib.utils.execute(*cmd, **kwargs)[source]

Convenience wrapper around oslo’s execute() method.

Executes and logs results from a system command. See docs for oslo_concurrency.processutils.execute for usage.

Parameters:
  • *cmd – positional arguments to pass to processutils.execute()
  • use_standard_locale – keyword-only argument. True | False. Defaults to False. If set to True, execute command with standard locale added to environment variables.
  • log_stdout – keyword-only argument. True | False. Defaults to True. If set to True, logs the output.
  • **kwargs – keyword arguments to pass to processutils.execute()
Returns:

(stdout, stderr) from process execution

Raises:

UnknownArgumentError on receiving unknown arguments

Raises:

ProcessExecutionError

Raises:

OSError

ironic_lib.utils.is_http_url(url)[source]
ironic_lib.utils.list_opts()[source]

Entry point for oslo-config-generator.

ironic_lib.utils.mkfs(fs, path, label=None)[source]

Format a file or block device

Parameters:
  • fs – Filesystem type (examples include ‘swap’, ‘ext3’, ‘ext4’ ‘btrfs’, etc.)
  • path – Path to file or block device to format
  • label – Volume label to use
ironic_lib.utils.parse_root_device_hints(root_device)[source]

Parse the root_device property of a node.

Parses and validates the root_device property of a node. These are hints for how a node’s root device is created. The ‘size’ hint should be a positive integer. The ‘rotational’ hint should be a Boolean value.

Parameters:root_device – the root_device dictionary from the node’s property.
Returns:a dictionary with the root device hints parsed or None if there are no hints.
Raises:ValueError, if some information is invalid.

Previous topic

The ironic_lib.tests.test_utils Module

Next topic

The ironic_lib.version Module

Project Source

This Page