ironic.drivers.modules.inspect_utils module

exception ironic.drivers.modules.inspect_utils.AutoEnrollPossible(message=None, **kwargs)[source]

Bases: IronicException

Exception to indicate that the node can be enrolled.

The error message and code is the same as for NotFound to make sure we don’t disclose any information when discovery is disabled.

code = 404
ironic.drivers.modules.inspect_utils.cache_lookup_addresses(node)[source]

Cache lookup addresses for a quick access.

ironic.drivers.modules.inspect_utils.clean_up_swift_entries(task)[source]

Delete swift entries containing inspection data.

Delete swift entries related to the node in task.node containing inspection data. The entries are inspector_data-<task.node.uuid>-inventory for hardware inventory and similar for -plugin containing the rest of the inspection data.

Parameters:

task – A TaskManager instance.

ironic.drivers.modules.inspect_utils.clear_lookup_addresses(node)[source]

Remove lookup addresses cached on the node.

ironic.drivers.modules.inspect_utils.create_ports_if_not_exist(task, macs=None)[source]

Create ironic ports from MAC addresses data dict.

Creates ironic ports from MAC addresses data returned with inspection or as requested by operator. Helper argument to detect the MAC address get_mac_address defaults to ‘value’ part of MAC address dict key-value pair.

Parameters:
  • task – A TaskManager instance.

  • macs – A sequence of MAC addresses. If None, fetched from the task’s management interface.

ironic.drivers.modules.inspect_utils.get_inspection_data(node, context)[source]

Get inspection data.

Retrieve the inspection data for a node either from database or the Object Storage API (swift/radosgw) as configured.

Parameters:
  • node – the Ironic node that the required data is about

  • context – an admin context

Returns:

dictionary with inventory and plugin_data fields

Raises:

NodeInventoryNotFound if no inventory has been saved

ironic.drivers.modules.inspect_utils.lookup_node(context, mac_addresses, bmc_addresses, node_uuid=None)[source]

Do a node lookup by the information from the inventory.

Parameters:
  • context – Request context

  • mac_addresses – List of MAC addresses.

  • bmc_addresses – List of BMC (realistically, IPMI) addresses.

  • node_uuid – Node UUID (if known).

Raises:

NotFound with a generic message for all failures to avoid disclosing any information.

ironic.drivers.modules.inspect_utils.store_inspection_data(node, inventory, plugin_data, context)[source]

Store inspection data.

Store the inspection data for a node. The storage is either the database or the Object Storage API (swift/radosgw) as configured.

Parameters:
  • node – the Ironic node that the inspection data is about

  • inventory – the inventory to store

  • plugin_data – the plugin data (if any) to store

  • context – an admin context