cinder.objects.backup module

class Backup(*args, **kwargs)

Bases: CinderPersistentObject, CinderObject, CinderObjectDictCompat, CinderComparableObject

OPTIONAL_FIELDS = ('metadata', 'parent')
VERSION: str = '1.7'

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 availability_zone: Any
property container: Any
create() None
property created_at: Any
property data_timestamp: Any
static decode_record(backup_url) dict

Deserialize backup metadata from string into a dictionary.

Raises:

InvalidInput

property deleted: Any
property deleted_at: Any
destroy() None
property display_description: Any
property display_name: Any
encode_record(**kwargs) str

Serialize backup object, with optional extra info, into a string.

property encryption_key_id: Any
property fail_reason: Any
fields: MutableMapping[str, Field[Any]] = {'availability_zone': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'container': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'data_timestamp': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'deleted': Boolean(default=False,nullable=True), 'deleted_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'display_description': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'display_name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'encryption_key_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'fail_reason': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'host': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'metadata': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'num_dependent_backups': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'object_count': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'parent': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'parent_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'project_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'restore_volume_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'service': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'service_metadata': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'size': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'snapshot_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'status': BackupStatus(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True,valid_values=('error', 'error_deleting', 'creating', 'available', 'deleting', 'deleted', 'restoring')), 'temp_snapshot_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'temp_volume_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'user_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'volume_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}

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

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
property has_dependent_backups: bool
property host: Any
property id: Any
property is_incremental: bool
property metadata: Any
model

alias of Backup

property name
property num_dependent_backups: Any
obj_extra_fields: Sequence[str] = ['name', 'is_incremental', 'has_dependent_backups']

List of additional object attributes to expose alongside fields.

Names listed here are typically implemented as Python properties and are included in obj_fields and exposed through iteration, but they are not versioned and not serialized during RPC:

class MyObject(VersionedObject):
    fields = {'foo': obj_fields.IntegerField()}
    obj_extra_fields = ['bar']

    @property
    def bar(self):
        return self.foo * 2
obj_load_attr(attrname)

Load an additional attribute from the real object.

This should load self.$attrname and cache any data that might be useful for future load operations.

obj_reset_changes(fields=None)

Reset the list of fields that have been changed.

Parameters:
  • fields – List of fields to reset, or “all” if None.

  • recursive – Call obj_reset_changes(recursive=True) on any sub-objects within the list of fields being reset.

This is NOT “revert to previous values”.

Specifying fields on recursive resets will only be honored at the top level. Everything below the top will reset all.

obj_what_changed()

Returns a set of fields that have been modified.

property object_count: Any
property parent: Any
property parent_id: Any
property project_id: Any
property restore_volume_id: Any
save() None

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.

property service: Any
property service_metadata: Any
property size: Any
property snapshot_id: Any
property status: Any
property temp_snapshot_id: Any
property temp_volume_id: Any
property updated_at: Any
property user_id: Any
property volume_id: Any
class BackupDeviceInfo(context: Any = None, **kwargs: Any)

Bases: CinderObject, CinderObjectDictCompat, CinderComparableObject

VERSION: str = '1.0'

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 device_obj
fields: MutableMapping[str, Field[Any]] = {'secure_enabled': Boolean(default=False,nullable=False), 'snapshot': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'volume': Object(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 from_primitive(primitive, context, expected_attrs=None)
property is_snapshot
obj_extra_fields: Sequence[str] = ['is_snapshot', 'device_obj']

List of additional object attributes to expose alongside fields.

Names listed here are typically implemented as Python properties and are included in obj_fields and exposed through iteration, but they are not versioned and not serialized during RPC:

class MyObject(VersionedObject):
    fields = {'foo': obj_fields.IntegerField()}
    obj_extra_fields = ['bar']

    @property
    def bar(self):
        return self.foo * 2
property secure_enabled: Any
property snapshot: Any
to_primitive(context)
property volume: Any
class BackupImport(*args, **kwargs)

Bases: Backup

Special object for Backup Imports.

This class should not be used for anything but Backup creation when importing backups to the DB.

On creation it allows to specify the ID for the backup, since it’s the reference used in parent_id it is imperative that this is preserved.

Backup Import objects get promoted to standard Backups when the import is completed.

property availability_zone: Any
property container: Any
create()
property created_at: Any
property data_timestamp: Any
property deleted: Any
property deleted_at: Any
property display_description: Any
property display_name: Any
property encryption_key_id: Any
property fail_reason: Any
fields: MutableMapping[str, Field[Any]] = {'availability_zone': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'container': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'data_timestamp': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'deleted': Boolean(default=False,nullable=True), 'deleted_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'display_description': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'display_name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'encryption_key_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'fail_reason': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'host': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'metadata': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'num_dependent_backups': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'object_count': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'parent': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'parent_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'project_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'restore_volume_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'service': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'service_metadata': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'size': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'snapshot_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'status': BackupStatus(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True,valid_values=('error', 'error_deleting', 'creating', 'available', 'deleting', 'deleted', 'restoring')), 'temp_snapshot_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'temp_volume_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'user_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'volume_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}

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

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
property host: Any
property id: Any
property metadata: Any
model

alias of Backup

property num_dependent_backups: Any
property object_count: Any
property parent: Any
property parent_id: Any
property project_id: Any
property restore_volume_id: Any
property service: Any
property service_metadata: Any
property size: Any
property snapshot_id: Any
property status: Any
property temp_snapshot_id: Any
property temp_volume_id: Any
property updated_at: Any
property user_id: Any
property volume_id: Any
class BackupList(*args: Any, **kwargs: Any)

Bases: ObjectListBase, CinderObject

VERSION: str = '1.0'

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.

fields: MutableMapping[str, Field[Any]] = {'objects': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}

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

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
classmethod get_all(context: RequestContext, filters=None, marker=None, limit=None, offset=None, sort_keys=None, sort_dirs=None) BackupList
classmethod get_all_active_by_window(context, begin, end)
classmethod get_all_by_host(context: RequestContext, host: str) BackupList
classmethod get_all_by_project(context, project_id, filters=None, marker=None, limit=None, offset=None, sort_keys=None, sort_dirs=None)
classmethod get_all_by_volume(context: RequestContext, volume_id: str, vol_project_id: str, filters=None) BackupList
property objects: Any