ironic_python_agent.device_hints module

ironic_python_agent.device_hints.find_devices_by_hints(devices, root_device_hints)[source]

Find all devices that match the root device hints.

Try to find devices that match the root device hints. In order for a device to be matched it needs to satisfy all the given hints.

Parameters:
  • devices

    A list of dictionaries representing the devices

    containing one or more of the following keys:

    name:

    (String) The device name, e.g /dev/sda

    size:

    (Integer) Size of the device in bytes

    model:

    (String) Device model

    vendor:

    (String) Device vendor name

    serial:

    (String) Device serial number

    wwn:

    (String) Unique storage identifier

    wwn_with_extension:

    (String): Unique storage identifier with the vendor extension appended

    wwn_vendor_extension:

    (String): United vendor storage identifier

    rotational:

    (Boolean) Whether it’s a rotational device or not. Useful to distinguish HDDs (rotational) and SSDs (not rotational).

    hctl:

    (String): The SCSI address: Host, channel, target and lun. For example: ‘1:0:0:0’.

    by_path:

    (String): The alternative device name, e.g. /dev/disk/by-path/pci-0000:00

  • root_device_hints – A dictionary with the root device hints.

Raises:

ValueError, if some information is invalid.

Returns:

A generator with all matching devices as dictionaries.

ironic_python_agent.device_hints.match_root_device_hints(devices, root_device_hints)[source]

Try to find a device that matches the root device hints.

Try to find a device that matches the root device hints. In order for a device to be matched it needs to satisfy all the given hints.

Parameters:
  • devices

    A list of dictionaries representing the devices

    containing one or more of the following keys:

    name:

    (String) The device name, e.g /dev/sda

    size:

    (Integer) Size of the device in bytes

    model:

    (String) Device model

    vendor:

    (String) Device vendor name

    serial:

    (String) Device serial number

    wwn:

    (String) Unique storage identifier

    wwn_with_extension:

    (String): Unique storage identifier with the vendor extension appended

    wwn_vendor_extension:

    (String): United vendor storage identifier

    rotational:

    (Boolean) Whether it’s a rotational device or not. Useful to distinguish HDDs (rotational) and SSDs (not rotational).

    hctl:

    (String): The SCSI address: Host, channel, target and lun. For example: ‘1:0:0:0’.

    by_path:

    (String): The alternative device name, e.g. /dev/disk/by-path/pci-0000:00

  • root_device_hints – A dictionary with the root device hints.

Raises:

ValueError, if some information is invalid.

Returns:

The first device to match all the hints or None.

ironic_python_agent.device_hints.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.