The ironic.objects.base Module

Ironic common internal object model

class ironic.objects.base.IronicObject(context, **kwargs)[source]

Bases: object

Base class and object factory.

This forms the base of all objects that can be remoted or instantiated via RPC. Simply defining a class that inherits from this base class will make it remotely instantiatable. Objects should implement the necessary “get” classmethod routines as well as “save” object methods as appropriate.

as_dict()[source]
get(key, value=<class ironic.objects.base.NotSpecifiedSentinel at 0x7f3738c1a9a8>)[source]

For backwards-compatibility with dict-based objects.

NOTE(danms): May be removed in the future.

items()
iteritems()[source]

For backwards-compatibility with dict-based objects.

NOTE(danms): May be removed in the future.

obj_attr_is_set(attrname)[source]

Test object to see if attrname is present.

Returns True if the named attribute has a value set, or False if not. Raises AttributeError if attrname is not a valid attribute for this object.

classmethod obj_class_from_name(objname, objver)[source]

Returns a class from the registry based on a name and version.

obj_clone()[source]

Create a copy.

classmethod obj_from_primitive(primitive, context=None)[source]

Simple base-case hydration.

This calls self._attr_from_primitive() for each item in fields.

obj_get_changes()[source]

Returns a dict of changed fields and their new values.

obj_load_attr(attrname)[source]

Load an additional attribute from the real object.

This should use self._conductor, and cache any data that might be useful for future load operations.

classmethod obj_name()[source]

Get canonical object name.

This object name will be used over the wire for remote hydration.

obj_reset_changes(fields=None)[source]

Reset the list of fields that have been changed.

Note that this is NOT “revert to previous values”

obj_to_primitive()[source]

Simple base-case dehydration.

This calls self._attr_to_primitive() for each item in fields.

obj_what_changed()[source]

Returns a set of fields that have been modified.

save(context)[source]

Save the changed fields back to the store.

This is optional for subclasses, but is presented here in the base class for consistency among those that do.

update(updates)[source]

For backwards-compatibility with dict-base objects.

NOTE(danms): May be removed in the future.

class ironic.objects.base.IronicObjectMetaclass(names, bases, dict_)[source]

Bases: type

Metaclass that allows tracking of object classes.

class ironic.objects.base.IronicObjectSerializer[source]

Bases: oslo_messaging.serializer.NoOpSerializer

A IronicObject-aware Serializer.

This implements the Oslo Serializer interface and provides the ability to serialize and deserialize IronicObject entities. Any service that needs to accept or return IronicObjects as arguments or result values should pass this to its RpcProxy and RpcDispatcher objects.

deserialize_entity(context, entity)[source]
serialize_entity(context, entity)[source]
class ironic.objects.base.NotSpecifiedSentinel[source]
class ironic.objects.base.ObjectListBase[source]

Bases: object

Mixin class for lists of objects.

This mixin class can be added as a base class for an object that is implementing a list of objects. It adds a single field of ‘objects’, which is the list store, and behaves like a list itself. It supports serialization of the list of objects automatically.

count(value)[source]

List count of value occurrences.

index(value)[source]

List index of value.

obj_make_compatible(primitive, target_version)[source]
obj_what_changed()[source]

This Page