Base code for plugins support.
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.
introspection_data – raw information sent by the ramdisk, may be modified by the hook.
kwargs – used for extensibility without breaking existing hooks
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.
introspection_data – processed data from the ramdisk.
node_info – NodeInfo instance.
kwargs – used for extensibility without breaking existing hooks.
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.
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.
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'}¶check
(node_info, field, params, **kwargs)[source]¶Check if condition holds for a given field.
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
ValueError – on unacceptable field value
True if check succeeded, otherwise False
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).
params – params as a dictionary
kwargs – used for extensibility without breaking existing plugins
ValueError on validation failure
ironic_inspector.plugins.base.
missing_entrypoints_callback
(names)[source]¶Raise MissingHookError with comma-separated list of missing hooks
ironic_inspector.plugins.base.
processing_hooks_manager
(*args)[source]¶Create a Stevedore extension manager for processing hooks.
args – arguments to pass to the hooks constructor.
ironic_inspector.plugins.base.
rule_actions_manager
()[source]¶Create a Stevedore extension manager for actions in rules.
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.
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.
port – The ironic port to patch.
iface_name – Name of the interface.
introspection_data – Introspection data.
The physical network to set, or None.
Gather capabilities from inventory.
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.
introspection_data – processed data from the ramdisk.
node_info – NodeInfo instance.
kwargs – used for extensibility without breaking existing hooks.
nothing.
[RFC 6902] - http://tools.ietf.org/html/rfc6902
Enroll node not found hook hook.
Example plugin.
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.
introspection_data – raw information sent by the ramdisk, may be modified by the hook.
kwargs – used for extensibility without breaking existing hooks
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.
introspection_data – processed data from the ramdisk.
node_info – NodeInfo instance.
kwargs – used for extensibility without breaking existing hooks.
nothing.
[RFC 6902] - http://tools.ietf.org/html/rfc6902
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.
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.
Backends for storing introspection data.
ironic_inspector.plugins.introspection_data.
BaseStorageBackend
[source]¶Bases: object
get
(node_uuid, processed=True, get_json=False)[source]¶Get introspected data from storage backend.
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.
the introspection data.
IntrospectionDataStoreDisabled if storage backend is disabled.
save
(node_uuid, data, processed=True)[source]¶Save introspected data to storage backend.
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.
IntrospectionDataStoreDisabled if storage backend is disabled.
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.
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.
the introspection data.
IntrospectionDataStoreDisabled if storage backend is disabled.
save
(node_uuid, data, processed=True)[source]¶Save introspected data to storage backend.
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.
IntrospectionDataStoreDisabled if storage backend is disabled.
LLDP Processing Hook for basic TLVs
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.
Generic LLDP Processing Hook
ironic_inspector.plugins.local_link_connection.
GenericLocalLinkConnectionHook
[source]¶Bases: ironic_inspector.plugins.base.ProcessingHook
Process mandatory LLDP packet fields
Non-vendor specific LLDP packet fields processed for each NIC found for a baremetal node, port ID and chassis ID. These fields if found and if valid will be saved into the local link connection info port id and switch id fields on the Ironic port that represents that NIC.
Gather and distinguish PCI devices from inventory.
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.
introspection_data – processed data from the ramdisk.
node_info – NodeInfo instance.
kwargs – used for extensibility without breaking existing hooks.
nothing.
[RFC 6902] - http://tools.ietf.org/html/rfc6902
Port Physical Network Hook
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.
Gather root device hint from recognized block devices.
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.
introspection_data – processed data from the ramdisk.
node_info – NodeInfo instance.
kwargs – used for extensibility without breaking existing hooks.
nothing.
[RFC 6902] - http://tools.ietf.org/html/rfc6902
Standard plugins for rules API.
ironic_inspector.plugins.rules.
AddTraitAction
[source]¶Bases: ironic_inspector.plugins.base.RuleActionPlugin
REQUIRED_PARAMS
= {'name'}¶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.
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
ValueError – on unacceptable field value
True if check succeeded, otherwise False
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.
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
ValueError – on unacceptable field value
True if check succeeded, otherwise False
ironic_inspector.plugins.rules.
EqCondition
[source]¶Bases: ironic_inspector.plugins.rules.SimpleCondition
op
()¶eq(a, b) – Same as a==b.
ironic_inspector.plugins.rules.
ExtendAttributeAction
[source]¶Bases: ironic_inspector.plugins.base.RuleActionPlugin
FORMATTED_PARAMS
= ['value']¶OPTIONAL_PARAMS
= {'unique'}¶REQUIRED_PARAMS
= {'path', 'value'}¶ironic_inspector.plugins.rules.
FailAction
[source]¶Bases: ironic_inspector.plugins.base.RuleActionPlugin
REQUIRED_PARAMS
= {'message'}¶ironic_inspector.plugins.rules.
GeCondition
[source]¶Bases: ironic_inspector.plugins.rules.SimpleCondition
op
()¶ge(a, b) – Same as a>=b.
ironic_inspector.plugins.rules.
GtCondition
[source]¶Bases: ironic_inspector.plugins.rules.SimpleCondition
op
()¶gt(a, b) – Same as a>b.
ironic_inspector.plugins.rules.
LeCondition
[source]¶Bases: ironic_inspector.plugins.rules.SimpleCondition
op
()¶le(a, b) – Same as a<=b.
ironic_inspector.plugins.rules.
LtCondition
[source]¶Bases: ironic_inspector.plugins.rules.SimpleCondition
op
()¶lt(a, b) – Same as a<b.
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.
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
ValueError – on unacceptable field value
True if check succeeded, otherwise False
ironic_inspector.plugins.rules.
NeCondition
[source]¶Bases: ironic_inspector.plugins.rules.SimpleCondition
op
()¶ne(a, b) – Same as a!=b.
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.
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
ValueError – on unacceptable field value
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).
params – params as a dictionary
kwargs – used for extensibility without breaking existing plugins
ValueError on validation failure
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).
params – params as a dictionary
kwargs – used for extensibility without breaking existing plugins
ValueError on validation failure
ironic_inspector.plugins.rules.
RemoveTraitAction
[source]¶Bases: ironic_inspector.plugins.base.RuleActionPlugin
REQUIRED_PARAMS
= {'name'}¶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.
node_info – NodeInfo object
params – parameters as a dictionary
kwargs – used for extensibility without breaking existing plugins
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).
params – params as a dictionary
kwargs – used for extensibility without breaking existing plugins
ValueError on validation failure
ironic_inspector.plugins.rules.
SetCapabilityAction
[source]¶Bases: ironic_inspector.plugins.base.RuleActionPlugin
FORMATTED_PARAMS
= ['value']¶OPTIONAL_PARAMS
= {'value'}¶REQUIRED_PARAMS
= {'name'}¶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.
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
ValueError – on unacceptable field value
True if check succeeded, otherwise False
op
= None¶Standard set of plugins.
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.
introspection_data – raw information sent by the ramdisk, may be modified by the hook.
kwargs – used for extensibility without breaking existing hooks
nothing.
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.
ironic_inspector.plugins.standard.
SchedulerHook
[source]¶Bases: ironic_inspector.plugins.base.ProcessingHook
Nova scheduler required properties.
KEYS
= ('cpus', 'cpu_arch', 'memory_mb')¶ironic_inspector.plugins.standard.
ValidateInterfacesHook
[source]¶Bases: ironic_inspector.plugins.base.ProcessingHook
Hook to validate network interfaces.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.