cinder.objects.volume module

class MetadataObject(key=None, value=None)

Bases: dict

class Volume(*args, **kwargs)

Bases: cinder.objects.cleanable.CinderCleanableObject, cinder.objects.base.CinderObject, cinder.objects.base.CinderObjectDictCompat, cinder.objects.base.CinderComparableObject, cinder.objects.base.ClusteredObject

OPTIONAL_FIELDS = ('metadata', 'admin_metadata', 'glance_metadata', 'volume_type', 'volume_attachment', 'consistencygroup', 'snapshots', 'cluster', 'group')
VERSION = '1.8'
property admin_metadata
property attach_status
property availability_zone
begin_attach(attach_mode)
property bootable
property cluster
property cluster_name
property consistencygroup
property consistencygroup_id
create()
property created_at
delete_metadata_key(key)
property deleted
property deleted_at
destroy()
property display_description
property display_name
property ec2_id
property encryption_key_id
fields = {'_name_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'admin_metadata': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'attach_status': VolumeAttachStatus(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True,valid_values=('attached', 'attaching', 'detached', 'error_attaching', 'error_detaching', 'reserved', 'deleted')), 'availability_zone': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'bootable': Boolean(default=False,nullable=True), 'cluster': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'cluster_name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'consistencygroup': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'consistencygroup_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), 'ec2_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'encryption_key_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'glance_metadata': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'group': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'group_id': UUID(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), 'launched_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'metadata': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'migration_status': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'multiattach': Boolean(default=False,nullable=True), 'previous_status': 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_geometry': 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), 'replication_driver_data': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'replication_extended_status': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'replication_status': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'scheduled_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'service_uuid': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'shared_targets': Boolean(default=True,nullable=True), 'size': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'snapshot_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'snapshots': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'source_volid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'status': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'terminated_at': DateTime(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=True), 'volume_attachment': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'volume_type': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'volume_type_id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
finish_detach(attachment_id)
finish_volume_migration(dest_volume)
get_latest_snapshot()

Get volume’s latest snapshot

property glance_metadata
property group
property group_id
property host
property id
is_multiattach()
is_replicated()
property launched_at
property metadata
property migration_status
model

alias of cinder.db.sqlalchemy.models.Volume

property multiattach
property name
property name_id
obj_extra_fields = ['name', 'name_id', 'volume_metadata', 'volume_admin_metadata', 'volume_glance_metadata']
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_make_compatible(primitive, target_version)

Make a Volume representation compatible with a target version.

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 previous_status
property project_id
property provider_auth
property provider_geometry
property provider_id
property provider_location
property replication_driver_data
property replication_extended_status
property replication_status
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.

property scheduled_at
property service_uuid
property shared_targets
property size
property snapshot_id
property snapshots
property source_volid
property status
property terminated_at
property updated_at
property user_id
property volume_admin_metadata
property volume_attachment
property volume_glance_metadata
property volume_metadata
property volume_type
property volume_type_id
class VolumeList(*args, **kwargs)

Bases: cinder.objects.base.ObjectListBase, cinder.objects.base.CinderObject

VERSION = '1.1'
fields = {'objects': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}
classmethod get_all(context, marker=None, limit=None, sort_keys=None, sort_dirs=None, filters=None, offset=None)
classmethod get_all_active_by_window(context, begin, end)
classmethod get_all_by_generic_group(context, group_id, filters=None)
classmethod get_all_by_group(context, group_id, filters=None)
classmethod get_all_by_host(context, host, filters=None)
classmethod get_all_by_project(context, project_id, marker=None, limit=None, sort_keys=None, sort_dirs=None, filters=None, offset=None)
classmethod get_volume_summary(context, project_only, filters=None)
static include_in_cluster(context, cluster, partial_rename=True, **filters)

Include all volumes matching the filters into a cluster.

When partial_rename is set we will not set the cluster_name with cluster parameter value directly, we’ll replace provided cluster_name or host filter value with cluster instead.

This is useful when we want to replace just the cluster name but leave the backend and pool information as it is. If we are using cluster_name to filter, we’ll use that same DB field to replace the cluster value and leave the rest as it is. Likewise if we use the host to filter.

Returns the number of volumes that have been changed.

property objects