cinder.objects.volume module

cinder.objects.volume module

class MetadataObject(key=None, value=None)

Bases: dict

class Volume(*args, **kwargs)

Bases: CinderCleanableObject, CinderObject, CinderObjectDictCompat, CinderComparableObject, ClusteredObject

OPTIONAL_FIELDS = ('metadata', 'admin_metadata', 'glance_metadata', 'volume_type', 'volume_attachment', 'consistencygroup', 'snapshots', 'cluster', 'group')
VERSION = '1.9'
property admin_metadata
admin_metadata_update(metadata, delete, add=True, update=True)
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), 'use_quota': Boolean(default=True,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_migration_target()
is_multiattach()
is_replicated()
property launched_at
property metadata
property migration_status
model

alias of Volume

property multiattach
property name
property name_id

Actual volume’s UUID for driver usage.

There may be two different UUIDs for the same volume, the user facing one, and the one the driver should be using.

When a volume is created these two are the same, but when doing a generic migration (create new volume, then copying data) they will be different if we were unable to rename the new volume in the final migration steps.

So the volume will have been created using the new volume’s UUID and the driver will have to look for it using that UUID, but the user on the other hand will keep referencing the volume with the original UUID.

This property facilitates using the right UUID in the driver’s code.

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.

populate_consistencygroup()

Populate CG fields based on group fields.

Method assumes that consistencygroup_id and consistencygroup fields have not already been set.

This is a hack to support backward compatibility of consistencygroup, where we set the fields but don’t want to write them to the DB, so we mark them as not changed, so they won’t be stored on the next save().

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 use_quota
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: ObjectListBase, 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
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

Page Contents