ironic_inspector.plugins package

Submodules

ironic_inspector.plugins.base module

Base code for plugins support.

class ironic_inspector.plugins.base.ProcessingHook[source]

Bases: object

Abstract base class for introspection data processing hooks.

before_processing(introspection_data, **kwargs)[source]

Hook to run before any other data processing.

This hook is run even before sanity checks.

Parameters
  • introspection_data – raw information sent by the ramdisk, may be modified by the hook.

  • kwargs – used for extensibility without breaking existing hooks

Returns

nothing.

before_update(introspection_data, node_info, **kwargs)[source]

Hook to run before Ironic node update.

This hook is run after node is found and ports are created, just before the node is updated with the data.

Parameters
  • introspection_data – processed data from the ramdisk.

  • node_info – NodeInfo instance.

  • kwargs – used for extensibility without breaking existing hooks.

Returns

nothing.

[RFC 6902] - http://tools.ietf.org/html/rfc6902

dependencies = []

An ordered list of hooks that must be enabled before this one.

The items here should be entry point names, not classes.

class ironic_inspector.plugins.base.RuleActionPlugin[source]

Bases: ironic_inspector.plugins.base.WithValidation

Abstract base class for rule action plugins.

FORMATTED_PARAMS = []

List of params will be formatted with python format.

abstract apply(node_info, params, **kwargs)[source]

Run action on successful rule match.

Parameters
  • node_info – NodeInfo object

  • params – parameters as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

utils.Error on failure

class ironic_inspector.plugins.base.RuleConditionPlugin[source]

Bases: ironic_inspector.plugins.base.WithValidation

Abstract base class for rule condition plugins.

ALLOW_NONE = False

Whether this condition accepts None when field is not found.

REQUIRED_PARAMS = {'value'}
abstract check(node_info, field, params, **kwargs)[source]

Check if condition holds for a given field.

Parameters
  • node_info – NodeInfo object

  • field – field value

  • params – parameters as a dictionary, changing it here will change what will be stored in database

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError – on unacceptable field value

Returns

True if check succeeded, otherwise False

class ironic_inspector.plugins.base.WithValidation[source]

Bases: object

OPTIONAL_PARAMS = {}

Set with names of optional parameters.

REQUIRED_PARAMS = {}

Set with names of required parameters.

validate(params, **kwargs)[source]

Validate params passed during creation.

Default implementation checks for presence of fields from REQUIRED_PARAMS and fails for unexpected fields (not from REQUIRED_PARAMS + OPTIONAL_PARAMS).

Parameters
  • params – params as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError on validation failure

ironic_inspector.plugins.base.introspection_data_manager()[source]
ironic_inspector.plugins.base.missing_entrypoints_callback(names)[source]

Raise MissingHookError with comma-separated list of missing hooks

ironic_inspector.plugins.base.node_not_found_hook_manager(*args)[source]
ironic_inspector.plugins.base.processing_hooks_manager(*args)[source]

Create a Stevedore extension manager for processing hooks.

Parameters

args – arguments to pass to the hooks constructor.

ironic_inspector.plugins.base.reset()[source]

Reset cached managers.

ironic_inspector.plugins.base.rule_actions_manager()[source]

Create a Stevedore extension manager for actions in rules.

ironic_inspector.plugins.base.rule_conditions_manager()[source]

Create a Stevedore extension manager for conditions in rules.

ironic_inspector.plugins.base.validate_processing_hooks()[source]

Validate the enabled processing hooks.

Raises

MissingHookError on missing or failed to load hooks

Raises

RuntimeError on validation failure

Returns

the list of hooks passed validation

ironic_inspector.plugins.base_physnet module

class ironic_inspector.plugins.base_physnet.BasePhysnetHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Base class for plugins that assign a physical network to ports.

The mechanism for mapping a port to a physical network should be provided by a subclass via the get_physnet() method.

before_update(introspection_data, node_info, **kwargs)[source]

Process introspection data and patch port physical network.

abstract get_physnet(port, iface_name, introspection_data)[source]

Return a physical network to apply to a port.

Subclasses should implement this method to determine how to map a port to a physical network.

Parameters
  • port – The ironic port to patch.

  • iface_name – Name of the interface.

  • introspection_data – Introspection data.

Returns

The physical network to set, or None.

ironic_inspector.plugins.capabilities module

Gather capabilities from inventory.

class ironic_inspector.plugins.capabilities.CapabilitiesHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Processing hook for detecting capabilities.

before_update(introspection_data, node_info, **kwargs)[source]

Hook to run before Ironic node update.

This hook is run after node is found and ports are created, just before the node is updated with the data.

Parameters
  • introspection_data – processed data from the ramdisk.

  • node_info – NodeInfo instance.

  • kwargs – used for extensibility without breaking existing hooks.

Returns

nothing.

[RFC 6902] - http://tools.ietf.org/html/rfc6902

ironic_inspector.plugins.discovery module

Enroll node not found hook hook.

ironic_inspector.plugins.discovery.enroll_node_not_found_hook(introspection_data, **kwargs)[source]

ironic_inspector.plugins.example module

Example plugin.

class ironic_inspector.plugins.example.ExampleProcessingHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

before_processing(introspection_data, **kwargs)[source]

Hook to run before any other data processing.

This hook is run even before sanity checks.

Parameters
  • introspection_data – raw information sent by the ramdisk, may be modified by the hook.

  • kwargs – used for extensibility without breaking existing hooks

Returns

nothing.

before_update(introspection_data, node_info, **kwargs)[source]

Hook to run before Ironic node update.

This hook is run after node is found and ports are created, just before the node is updated with the data.

Parameters
  • introspection_data – processed data from the ramdisk.

  • node_info – NodeInfo instance.

  • kwargs – used for extensibility without breaking existing hooks.

Returns

nothing.

[RFC 6902] - http://tools.ietf.org/html/rfc6902

class ironic_inspector.plugins.example.ExampleRuleAction[source]

Bases: ironic_inspector.plugins.base.RuleActionPlugin

apply(node_info, params, **kwargs)[source]

Run action on successful rule match.

Parameters
  • node_info – NodeInfo object

  • params – parameters as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

utils.Error on failure

ironic_inspector.plugins.example.example_not_found_hook(introspection_data, **kwargs)[source]

ironic_inspector.plugins.extra_hardware module

Plugin to store extra hardware information in Swift.

Stores the value of the ‘data’ key returned by the ramdisk as a JSON encoded string in a Swift object. The object is named ‘extra_hardware-<node uuid>’ and is stored in the ‘inspector’ container.

class ironic_inspector.plugins.extra_hardware.ExtraHardwareHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Processing hook for saving extra hardware information in Swift.

before_update(introspection_data, node_info, **kwargs)[source]

Stores the ‘data’ key from introspection_data in Swift.

If the ‘data’ key exists, updates Ironic extra column ‘hardware_swift_object’ key to the name of the Swift object, and stores the data in the ‘inspector’ container in Swift.

Otherwise, it does nothing.

ironic_inspector.plugins.introspection_data module

Backends for storing introspection data.

class ironic_inspector.plugins.introspection_data.BaseStorageBackend[source]

Bases: object

abstract get(node_uuid, processed=True, get_json=False)[source]

Get introspected data from storage backend.

Parameters
  • node_uuid – node UUID.

  • processed – Specify whether the data to be retrieved is processed or not.

  • get_json – Specify whether return the introspection data in json format, string value is returned if False.

Returns

the introspection data.

Raises

IntrospectionDataStoreDisabled if storage backend is disabled.

abstract save(node_uuid, data, processed=True)[source]

Save introspected data to storage backend.

Parameters
  • node_uuid – node UUID.

  • data – the introspected data to be saved, in dict format.

  • processed – Specify whether the data to be saved is processed or not.

Raises

IntrospectionDataStoreDisabled if storage backend is disabled.

class ironic_inspector.plugins.introspection_data.DatabaseStore[source]

Bases: object

get(node_uuid, processed=True, get_json=False)[source]
save(node_uuid, data, processed=True)[source]
class ironic_inspector.plugins.introspection_data.NoStore[source]

Bases: ironic_inspector.plugins.introspection_data.BaseStorageBackend

get(node_uuid, processed=True, get_json=False)[source]

Get introspected data from storage backend.

Parameters
  • node_uuid – node UUID.

  • processed – Specify whether the data to be retrieved is processed or not.

  • get_json – Specify whether return the introspection data in json format, string value is returned if False.

Returns

the introspection data.

Raises

IntrospectionDataStoreDisabled if storage backend is disabled.

save(node_uuid, data, processed=True)[source]

Save introspected data to storage backend.

Parameters
  • node_uuid – node UUID.

  • data – the introspected data to be saved, in dict format.

  • processed – Specify whether the data to be saved is processed or not.

Raises

IntrospectionDataStoreDisabled if storage backend is disabled.

class ironic_inspector.plugins.introspection_data.SwiftStore[source]

Bases: object

get(node_uuid, processed=True, get_json=False)[source]
save(node_uuid, data, processed=True)[source]

ironic_inspector.plugins.lldp_basic module

LLDP Processing Hook for basic TLVs

class ironic_inspector.plugins.lldp_basic.LLDPBasicProcessingHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Process mandatory and optional LLDP packet fields

Loop through raw LLDP TLVs and parse those from the basic management, 802.1, and 802.3 TLV sets. Store parsed data back to the ironic-inspector database.

before_update(introspection_data, node_info, **kwargs)[source]

Process LLDP data and update all_interfaces with processed data

ironic_inspector.plugins.pci_devices module

Gather and distinguish PCI devices from inventory.

class ironic_inspector.plugins.pci_devices.PciDevicesHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Processing hook for counting and distinguishing various PCI devices.

That information can be later used by nova for node scheduling.

aliases = {}
before_update(introspection_data, node_info, **kwargs)[source]

Hook to run before Ironic node update.

This hook is run after node is found and ports are created, just before the node is updated with the data.

Parameters
  • introspection_data – processed data from the ramdisk.

  • node_info – NodeInfo instance.

  • kwargs – used for extensibility without breaking existing hooks.

Returns

nothing.

[RFC 6902] - http://tools.ietf.org/html/rfc6902

ironic_inspector.plugins.physnet_cidr_map module

Port Physical Network Hook

class ironic_inspector.plugins.physnet_cidr_map.PhysnetCidrMapHook[source]

Bases: ironic_inspector.plugins.base_physnet.BasePhysnetHook

Process port physical network

Set the physical_network field of baremetal ports based on a cidr to physical network mapping in the configuration.

get_physnet(port, iface_name, introspection_data)[source]

Return a physical network to apply to a port.

Parameters
  • port – The ironic port to patch.

  • iface_name – Name of the interface.

  • introspection_data – Introspection data.

Returns

The physical network to set, or None.

ironic_inspector.plugins.raid_device module

Gather root device hint from recognized block devices.

class ironic_inspector.plugins.raid_device.RaidDeviceDetection[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Processing hook for learning the root device after RAID creation.

The plugin can figure out the root device in 2 runs. First, it saves the discovered block device serials in node.extra. The second run will check the difference between the recently discovered block devices and the previously saved ones. After saving the root device in node.properties, it will delete the temporarily saved block device serials in node.extra.

This way, it helps to figure out the root device hint in cases when otherwise Ironic doesn’t have enough information to do so. Such a usecase is DRAC RAID configuration where the BMC doesn’t provide any useful information about the created RAID disks. Using this plugin immediately before and after creating the root RAID device will solve the issue of root device hints.

In cases where there’s no RAID volume on the node, the standard plugin will fail due to the missing local_gb value. This plugin fakes the missing value, until it’s corrected during later runs. Note, that for this to work the plugin needs to take precedence over the standard plugin.

before_processing(introspection_data, **kwargs)[source]

Adds fake local_gb value if it’s missing from introspection_data.

before_update(introspection_data, node_info, **kwargs)[source]

Hook to run before Ironic node update.

This hook is run after node is found and ports are created, just before the node is updated with the data.

Parameters
  • introspection_data – processed data from the ramdisk.

  • node_info – NodeInfo instance.

  • kwargs – used for extensibility without breaking existing hooks.

Returns

nothing.

[RFC 6902] - http://tools.ietf.org/html/rfc6902

ironic_inspector.plugins.rules module

Standard plugins for rules API.

class ironic_inspector.plugins.rules.AddTraitAction[source]

Bases: ironic_inspector.plugins.base.RuleActionPlugin

REQUIRED_PARAMS = {'name'}
apply(node_info, params, **kwargs)[source]

Run action on successful rule match.

Parameters
  • node_info – NodeInfo object

  • params – parameters as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

utils.Error on failure

class ironic_inspector.plugins.rules.ContainsCondition[source]

Bases: ironic_inspector.plugins.rules.ReCondition

check(node_info, field, params, **kwargs)[source]

Check if condition holds for a given field.

Parameters
  • node_info – NodeInfo object

  • field – field value

  • params – parameters as a dictionary, changing it here will change what will be stored in database

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError – on unacceptable field value

Returns

True if check succeeded, otherwise False

class ironic_inspector.plugins.rules.EmptyCondition[source]

Bases: ironic_inspector.plugins.base.RuleConditionPlugin

ALLOW_NONE = True
REQUIRED_PARAMS = {}
check(node_info, field, params, **kwargs)[source]

Check if condition holds for a given field.

Parameters
  • node_info – NodeInfo object

  • field – field value

  • params – parameters as a dictionary, changing it here will change what will be stored in database

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError – on unacceptable field value

Returns

True if check succeeded, otherwise False

class ironic_inspector.plugins.rules.EqCondition[source]

Bases: ironic_inspector.plugins.rules.SimpleCondition

op()

eq(a, b) – Same as a==b.

class ironic_inspector.plugins.rules.ExtendAttributeAction[source]

Bases: ironic_inspector.plugins.base.RuleActionPlugin

FORMATTED_PARAMS = ['value']
OPTIONAL_PARAMS = {'unique'}
REQUIRED_PARAMS = {'path', 'value'}
apply(node_info, params, **kwargs)[source]

Run action on successful rule match.

Parameters
  • node_info – NodeInfo object

  • params – parameters as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

utils.Error on failure

class ironic_inspector.plugins.rules.FailAction[source]

Bases: ironic_inspector.plugins.base.RuleActionPlugin

REQUIRED_PARAMS = {'message'}
apply(node_info, params, **kwargs)[source]

Run action on successful rule match.

Parameters
  • node_info – NodeInfo object

  • params – parameters as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

utils.Error on failure

class ironic_inspector.plugins.rules.GeCondition[source]

Bases: ironic_inspector.plugins.rules.SimpleCondition

op()

ge(a, b) – Same as a>=b.

class ironic_inspector.plugins.rules.GtCondition[source]

Bases: ironic_inspector.plugins.rules.SimpleCondition

op()

gt(a, b) – Same as a>b.

class ironic_inspector.plugins.rules.LeCondition[source]

Bases: ironic_inspector.plugins.rules.SimpleCondition

op()

le(a, b) – Same as a<=b.

class ironic_inspector.plugins.rules.LtCondition[source]

Bases: ironic_inspector.plugins.rules.SimpleCondition

op()

lt(a, b) – Same as a<b.

class ironic_inspector.plugins.rules.MatchesCondition[source]

Bases: ironic_inspector.plugins.rules.ReCondition

check(node_info, field, params, **kwargs)[source]

Check if condition holds for a given field.

Parameters
  • node_info – NodeInfo object

  • field – field value

  • params – parameters as a dictionary, changing it here will change what will be stored in database

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError – on unacceptable field value

Returns

True if check succeeded, otherwise False

class ironic_inspector.plugins.rules.NeCondition[source]

Bases: ironic_inspector.plugins.rules.SimpleCondition

op()

ne(a, b) – Same as a!=b.

class ironic_inspector.plugins.rules.NetCondition[source]

Bases: ironic_inspector.plugins.base.RuleConditionPlugin

check(node_info, field, params, **kwargs)[source]

Check if condition holds for a given field.

Parameters
  • node_info – NodeInfo object

  • field – field value

  • params – parameters as a dictionary, changing it here will change what will be stored in database

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError – on unacceptable field value

Returns

True if check succeeded, otherwise False

validate(params, **kwargs)[source]

Validate params passed during creation.

Default implementation checks for presence of fields from REQUIRED_PARAMS and fails for unexpected fields (not from REQUIRED_PARAMS + OPTIONAL_PARAMS).

Parameters
  • params – params as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError on validation failure

class ironic_inspector.plugins.rules.ReCondition[source]

Bases: ironic_inspector.plugins.base.RuleConditionPlugin

validate(params, **kwargs)[source]

Validate params passed during creation.

Default implementation checks for presence of fields from REQUIRED_PARAMS and fails for unexpected fields (not from REQUIRED_PARAMS + OPTIONAL_PARAMS).

Parameters
  • params – params as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError on validation failure

class ironic_inspector.plugins.rules.RemoveTraitAction[source]

Bases: ironic_inspector.plugins.base.RuleActionPlugin

REQUIRED_PARAMS = {'name'}
apply(node_info, params, **kwargs)[source]

Run action on successful rule match.

Parameters
  • node_info – NodeInfo object

  • params – parameters as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

utils.Error on failure

class ironic_inspector.plugins.rules.SetAttributeAction[source]

Bases: ironic_inspector.plugins.base.RuleActionPlugin

FORMATTED_PARAMS = ['value']
OPTIONAL_PARAMS = {'reset_interfaces', 'value'}
REQUIRED_PARAMS = {'path'}
apply(node_info, params, **kwargs)[source]

Run action on successful rule match.

Parameters
  • node_info – NodeInfo object

  • params – parameters as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

utils.Error on failure

validate(params, **kwargs)[source]

Validate params passed during creation.

Default implementation checks for presence of fields from REQUIRED_PARAMS and fails for unexpected fields (not from REQUIRED_PARAMS + OPTIONAL_PARAMS).

Parameters
  • params – params as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError on validation failure

class ironic_inspector.plugins.rules.SetCapabilityAction[source]

Bases: ironic_inspector.plugins.base.RuleActionPlugin

FORMATTED_PARAMS = ['value']
OPTIONAL_PARAMS = {'value'}
REQUIRED_PARAMS = {'name'}
apply(node_info, params, **kwargs)[source]

Run action on successful rule match.

Parameters
  • node_info – NodeInfo object

  • params – parameters as a dictionary

  • kwargs – used for extensibility without breaking existing plugins

Raises

utils.Error on failure

class ironic_inspector.plugins.rules.SimpleCondition[source]

Bases: ironic_inspector.plugins.base.RuleConditionPlugin

check(node_info, field, params, **kwargs)[source]

Check if condition holds for a given field.

Parameters
  • node_info – NodeInfo object

  • field – field value

  • params – parameters as a dictionary, changing it here will change what will be stored in database

  • kwargs – used for extensibility without breaking existing plugins

Raises

ValueError – on unacceptable field value

Returns

True if check succeeded, otherwise False

op = None
ironic_inspector.plugins.rules.coerce(value, expected)[source]

ironic_inspector.plugins.standard module

Standard set of plugins.

class ironic_inspector.plugins.standard.RamdiskErrorHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Hook to process error send from the ramdisk.

before_processing(introspection_data, **kwargs)[source]

Hook to run before any other data processing.

This hook is run even before sanity checks.

Parameters
  • introspection_data – raw information sent by the ramdisk, may be modified by the hook.

  • kwargs – used for extensibility without breaking existing hooks

Returns

nothing.

class ironic_inspector.plugins.standard.RootDiskSelectionHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Smarter root disk selection using Ironic root device hints.

This hook must always go before SchedulerHook, otherwise root_disk field might not be updated.

before_update(introspection_data, node_info, **kwargs)[source]

Process root disk information.

class ironic_inspector.plugins.standard.SchedulerHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Nova scheduler required properties.

KEYS = ('cpus', 'cpu_arch', 'memory_mb')
before_update(introspection_data, node_info, **kwargs)[source]

Update node with scheduler properties.

class ironic_inspector.plugins.standard.ValidateInterfacesHook[source]

Bases: ironic_inspector.plugins.base.ProcessingHook

Hook to validate network interfaces.

before_processing(introspection_data, **kwargs)[source]

Validate information about network interfaces.

before_update(introspection_data, node_info, **kwargs)[source]

Create new ports and drop ports that are not present in the data.

Module contents