Cache for nodes currently under introspection.
Bases: object
Record about a node in the cache.
This class optionally allows to acquire a lock on a node. Note that the class instance itself is NOT thread-safe, you need to create a new instance for every thread.
Acquire a lock on the associated node.
Exits with success if a lock is already acquired using this NodeInfo object.
Parameters: | blocking – if True, wait for lock to be acquired, otherwise return immediately. |
---|---|
Returns: | boolean value, whether lock was acquired successfully |
Store look up attribute for a node in the database.
Parameters: |
|
---|---|
Raises: | Error if attributes values are already in database |
Create one or several ports for this node.
A warning is issued if port already exists on a node.
Delete port.
Parameters: |
|
---|
Record status for this node.
Also deletes look up attributes from the cache.
Parameters: | error – error message |
---|
Construct NodeInfo from a database row.
Get field value by ironic-style path (e.g. /extra/foo).
Parameters: | path – path to a field |
---|---|
Returns: | field value |
Raises: | KeyError if field was not found |
Apply JSON patches to a node.
Refreshes cached node instance.
Parameters: |
|
---|---|
Raises: | ironicclient exceptions |
Apply JSON patches to a port.
Parameters: |
|
---|
Get Ironic port objects associated with the cached node record.
This value is cached as well, use invalidate_cache() to clean.
Returns: | dict MAC -> port object |
---|
Release a lock on a node.
Does nothing if lock was not acquired using this NodeInfo object.
Replace a field on ironic node.
Parameters: |
|
---|---|
Raises: | KeyError if value is not found and default is not set |
Raises: | everything that patch() may raise |
List all MAC’s that are on introspection right now.
Store information about a node under introspection.
All existing information about this node is dropped. Empty values are skipped.
Parameters: |
|
---|---|
Returns: | NodeInfo |
Clean up the cache.
Returns: | list of timed out node UUID’s |
---|
Create ironic node and cache it.
Parameters: |
|
---|---|
Returns: | NodeInfo, or None in case error happened. |
Delete nodes which don’t exist in Ironic node UUIDs.
Parameters: | uuids – Ironic node UUIDs |
---|
Find node in cache.
This function acquires a lock on a node.
Parameters: | attributes – attributes known about this node (like macs, BMC etc) also ironic client instance may be passed under ‘ironic’ |
---|---|
Returns: | structure NodeInfo with attributes uuid and created_at |
Raises: | Error if node is not found |