ironic.objects.allocation module

class ironic.objects.allocation.Allocation(context=None, **kwargs)[source]

Bases: IronicObject, VersionedObjectDictCompat

VERSION = '1.1'
property candidate_nodes
property conductor_affinity
create(context=None)[source]

Create a Allocation record in the DB.

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.: Allocation(context)

Raises:

AllocationDuplicateName, AllocationAlreadyExists

property created_at
dbapi = <oslo_db.api.DBAPI object>
destroy(context=None)[source]

Delete the Allocation from the DB.

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.: Allocation(context)

Raises:

AllocationNotFound

property extra
fields = {'candidate_nodes': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'conductor_affinity': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'extra': FlexibleDict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'last_error': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'node_id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'owner': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'resource_class': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'state': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'traits': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'uuid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
classmethod get(context, allocation_ident)[source]

Find an allocation by its ID, UUID or name.

Parameters:
  • allocation_ident – The ID, UUID or name of an allocation.

  • context – Security context

Returns:

An Allocation object.

Raises:

InvalidIdentity

classmethod get_by_id(context, allocation_id)[source]

Find an allocation by its integer ID.

Parameters:
  • cls – the Allocation

  • context – Security context

  • allocation_id – The ID of an allocation.

Returns:

An Allocation object.

Raises:

AllocationNotFound

classmethod get_by_name(context, name)[source]

Find an allocation based by its name.

Parameters:
  • cls – the Allocation

  • context – Security context

  • name – The name of an allocation.

Returns:

An Allocation object.

Raises:

AllocationNotFound

classmethod get_by_uuid(context, uuid)[source]

Find an allocation by its UUID.

Parameters:
  • cls – the Allocation

  • context – Security context

  • uuid – The UUID of an allocation.

Returns:

An Allocation object.

Raises:

AllocationNotFound

property id
property last_error
classmethod list(context, filters=None, limit=None, marker=None, sort_key=None, sort_dir=None)[source]

Return a list of Allocation objects.

Parameters:
  • cls – the Allocation

  • context – Security context.

  • filters – Filters to apply.

  • limit – Maximum number of resources to return in a single result.

  • marker – Pagination marker for large data sets.

  • sort_key – Column to sort results by.

  • sort_dir – Direction to sort. “asc” or “desc”.

Returns:

A list of Allocation object.

Raises:

InvalidParameterValue

property name
property node_id
property owner
refresh(context=None)[source]

Loads updates for this Allocation.

Loads an allocation with the same uuid from the database and checks for updated attributes. Updates are applied from the loaded allocation column by column, if there are any updates.

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.: Allocation(context)

Raises:

AllocationNotFound

property resource_class
save(context=None)[source]

Save updates to this Allocation.

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.: Allocation(context)

Raises:

AllocationNotFound, AllocationDuplicateName

property state
property traits
property updated_at
property uuid
class ironic.objects.allocation.AllocationCRUDNotification(context=None, **kwargs)[source]

Bases: NotificationBase

Notification when ironic creates, updates or deletes an allocation.

VERSION = '1.0'
property created_at
property event_type
fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'event_type': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'level': NotificationLevel(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('debug', 'info', 'warning', 'error', 'critical')), 'payload': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'publisher': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
property level
property payload
property publisher
property updated_at
class ironic.objects.allocation.AllocationCRUDPayload(allocation, node_uuid=None)[source]

Bases: NotificationPayloadBase

SCHEMA = {'candidate_nodes': ('allocation', 'candidate_nodes'), 'created_at': ('allocation', 'created_at'), 'extra': ('allocation', 'extra'), 'last_error': ('allocation', 'last_error'), 'name': ('allocation', 'name'), 'owner': ('allocation', 'owner'), 'resource_class': ('allocation', 'resource_class'), 'state': ('allocation', 'state'), 'traits': ('allocation', 'traits'), 'updated_at': ('allocation', 'updated_at'), 'uuid': ('allocation', 'uuid')}
VERSION = '1.1'
property candidate_nodes
property created_at
property extra
fields = {'candidate_nodes': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'extra': FlexibleDict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'last_error': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'node_uuid': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'owner': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'resource_class': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'state': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'traits': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'uuid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
property last_error
property name
property node_uuid
property owner
property resource_class
property state
property traits
property updated_at
property uuid