cinder.objects.snapshot module

class Snapshot(*args, **kwargs)

Bases: CinderCleanableObject, CinderObject, CinderObjectDictCompat, CinderComparableObject, ClusteredObject

OPTIONAL_FIELDS = ('volume', 'metadata', 'cgsnapshot', 'group_snapshot')
VERSION: str = '1.6'

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 cgsnapshot: Any
property cgsnapshot_id: Any
property cluster_name
create()
property created_at: Any
delete_metadata_key(context, key)
property deleted: Any
property deleted_at: Any
destroy()
property display_description: Any
property display_name: Any
property encryption_key_id: Any
fields: MutableMapping[str, Field[Any]] = {'cgsnapshot': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'cgsnapshot_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'created_at': 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': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'group_snapshot': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'group_snapshot_id': UUID(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=False), 'progress': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'project_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'provider_auth': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'provider_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'provider_location': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'status': SnapshotStatus(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True,valid_values=('error', 'available', 'creating', 'deleting', 'deleted', 'updating', 'error_deleting', 'unmanaging', 'backing-up', 'restoring')), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'use_quota': Boolean(default=True,nullable=False), 'user_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'volume': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'volume_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'volume_size': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'volume_type_id': UUID(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(),
}
property group_snapshot: Any
property group_snapshot_id: Any
property host

All cleanable VO must have a host property/attribute.

property id: Any
property metadata: Any
model

alias of Snapshot

property name
obj_extra_fields: Sequence[str] = ['name', 'volume_name']

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 progress: Any
property project_id: Any
property provider_auth: Any
property provider_id: Any
property provider_location: Any
save()

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.

classmethod snapshot_data_get_for_project(context, project_id, volume_type_id=None, host=None)
property status: Any
property updated_at: Any
property use_quota: Any
property user_id: Any
property volume: Any
property volume_id: Any
property volume_name
property volume_size: Any
property volume_type_id: Any
class SnapshotList(*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, filters, marker=None, limit=None, sort_keys=None, sort_dirs=None, offset=None)

Get all snapshot given some search_opts (filters).

Special filters accepted are host and cluster_name, that refer to the volume’s fields.

classmethod get_all_active_by_window(context, begin, end)
classmethod get_all_by_project(context, project_id, search_opts, marker=None, limit=None, sort_keys=None, sort_dirs=None, offset=None)
classmethod get_all_for_cgsnapshot(context, cgsnapshot_id)
classmethod get_all_for_group_snapshot(context, group_snapshot_id)
classmethod get_all_for_volume(context, volume_id)
classmethod get_by_host(context, host, filters=None)
classmethod get_snapshot_summary(context, project_only, filters=None)
property objects: Any