ironic.objects.firmware module

class ironic.objects.firmware.FirmwareComponent(context=None, **kwargs)[source]

Bases: IronicObject

VERSION = '1.2'

Object version field

Each service has its set of objects, each with a version attached. When a client attempts to call an object method, the server checks to see if the version of that object matches (in a compatible way) its object implementation. If so, cool, and if not, fail.

This version is allowed to have three parts, X.Y.Z, where the .Z element is reserved for stable branch backports. The .Z is ignored for the purposes of triggering a backport, which means anything changed under a .Z must be additive and non-destructive such that a node that knows about X.Y can consider X.Y.Z equivalent.

property component
create(context=None)[source]

Create a Firmware record in the DB.

Parameters:

context – Security context.

Raises:

NodeNotFound if the node is not found.

Raises:

FirmwareComponentAlreadyExists if the record already exists.

property created_at
property current_version
dbapi = <oslo_db.api.DBAPI object>
fields = {'component': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'current_version': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'initial_version': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'last_version_flashed': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'model': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'node_id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'serial_number': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'vendor': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}

The fields present in this object as key:field pairs.

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
classmethod get(context, node_id, name)[source]

Get a FirmwareComponent based on its node_id and name.

Parameters:
  • context – Security context.

  • node_id – The node id.

  • name – The Firmware Component name.

Raises:

NodeNotFound if the node id is not found.

Raises:

FirmwareComponentNotFound if the Firmware Component name is not found.

Returns:

A :class:’FirmwareComponent’ object.

property id
property initial_version
property last_version_flashed
property model
property node_id
obj_make_compatible(primitive, target_version)[source]

Make an object representation compatible with a target version.

This is responsible for taking the primitive representation of an object and making it suitable for the given target_version. This may mean converting the format of object attributes, removing attributes that have been added since the target version, etc. In general:

  • If a new version of an object adds a field, this routine should remove it for older versions.

  • If a new version changed or restricted the format of a field, this should convert it back to something a client knowing only of the older version will tolerate.

  • If an object that this object depends on is bumped, then this object should also take a version bump. Then, this routine should backlevel the dependent object (by calling its obj_make_compatible()) if the requested version of this object is older than the version where the new dependent object was added.

Parameters:
  • primitive – The result of obj_to_primitive()

  • target_version – The version string requested by the recipient of the object

Raises:

oslo_versionedobjects.exception.UnsupportedObjectError if conversion is not possible for some reason

save(context=None)[source]

Save updates to this Firmware Component.

Updates will be made column by column based on the result of self.what_changed()

Parameters:

context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: FirmwareComponent(context)

Raises:

NodeNotFound if the node id is not found.

Raises:

FirmwareComponentNotFound if the component is not found.

property serial_number
property updated_at
property vendor
class ironic.objects.firmware.FirmwareComponentList(*args, **kwargs)[source]

Bases: IronicObjectListBase, IronicObject

VERSION = '1.1'

Object version field

Each service has its set of objects, each with a version attached. When a client attempts to call an object method, the server checks to see if the version of that object matches (in a compatible way) its object implementation. If so, cool, and if not, fail.

This version is allowed to have three parts, X.Y.Z, where the .Z element is reserved for stable branch backports. The .Z is ignored for the purposes of triggering a backport, which means anything changed under a .Z must be additive and non-destructive such that a node that knows about X.Y can consider X.Y.Z equivalent.

property created_at
dbapi = <oslo_db.api.DBAPI object>
fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'objects': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}

The fields present in this object as key:field pairs.

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
classmethod get_by_node_id(context, node_id)[source]

Get FirmwareComponent based on node_id.

Parameters:
  • context – Security context.

  • node_id – The node id.

Raises:

NodeNotFound if the node is not found.

Returns:

A list of FirmwareComponent objects.

property objects
classmethod sync_firmware_components(context, node_id, components)[source]

Returns a list of create/update components.

This method sync with the ‘firmware_information’ database table and sorts three lists - create / update / unchanged components.

Parameters:
  • context – Security context.

  • node_id – The node id.

  • components – List of FirmwareComponents.

Returns:

A 3-tuple of lists of Firmware Components to be created, updated and unchanged.

property updated_at