cinder.volume.api module

Handles all requests relating to volumes.

class API(db_driver=None, image_service=None)

Bases: cinder.db.base.Base

API for interacting with the volume manager.

AVAILABLE_MIGRATION_STATUS = (None, 'deleting', 'error', 'success')
accept_transfer(context, volume, new_user, new_project, no_snapshots=False)
attach(context, volume, instance_uuid, host_name, mountpoint, mode)
attachment_create(ctxt, volume_ref, instance_uuid, connector=None, attach_mode='null')

Create an attachment record for the specified volume.

attachment_delete(ctxt, attachment)
attachment_update(ctxt, attachment_ref, connector)

Update an existing attachment record.

begin_detaching(context, volume)
calculate_resource_count(context, resource_type, filters)
check_volume_filters(filters, strict=False)

Sets the user filter value to accepted format

copy_volume_to_image(context, volume, metadata, force)

Create a new image from the specified volume.

create(context, size, name, description, snapshot=None, image_id=None, volume_type=None, metadata=None, availability_zone=None, source_volume=None, scheduler_hints=None, source_replica=None, consistencygroup=None, cgsnapshot=None, multiattach=False, source_cg=None, group=None, group_snapshot=None, source_group=None, backup=None)
create_snapshot(context, volume, name, description, metadata=None, cgsnapshot_id=None, group_snapshot_id=None)
create_snapshot_force(context, volume, name, description, metadata=None)
create_snapshot_in_db(context, volume, name, description, force, metadata, cgsnapshot_id, commit_quota=True, group_snapshot_id=None)
create_snapshots_in_db(context, volume_list, name, description, cgsnapshot_id, group_snapshot_id=None)
create_volume_metadata(context, volume, metadata)

Creates volume metadata.

delete(context, volume, force=False, unmanage_only=False, cascade=False)
delete_snapshot(context, snapshot, force=False, unmanage_only=False)
delete_snapshot_metadata(context, snapshot, key)

Delete the given metadata item from a snapshot.

delete_volume_metadata(context, volume, key, meta_type=<METADATA_TYPES.user: 1>)

Delete the given metadata item from a volume.

detach(context, volume, attachment_id)
extend(context, volume, new_size)
extend_attached_volume(context, volume, new_size)
failover(ctxt, host, cluster_name, secondary_id=None)
freeze_host(ctxt, host, cluster_name)
get(context, volume_id, viewable_admin_meta=False)
get_all(context, marker=None, limit=None, sort_keys=None, sort_dirs=None, filters=None, viewable_admin_meta=False, offset=None)
get_all_snapshots(context, search_opts=None, marker=None, limit=None, sort_keys=None, sort_dirs=None, offset=None)
get_list_volumes_image_metadata(context, volume_id_list)
get_manageable_snapshots(context, host, cluster_name, marker=None, limit=None, offset=None, sort_keys=None, sort_dirs=None)
get_manageable_volumes(context, host, cluster_name, marker=None, limit=None, offset=None, sort_keys=None, sort_dirs=None)
get_snapshot(context, snapshot_id)
get_snapshot_metadata(context, snapshot)

Get all metadata associated with a snapshot.

get_snapshot_metadata_value(snapshot, key)
get_volume(context, volume_id)
get_volume_admin_metadata(context, volume)

Get all administration metadata associated with a volume.

get_volume_image_metadata(context, volume)
get_volume_metadata(context, volume)

Get all metadata associated with a volume.

get_volume_summary(context, filters=None)
get_volumes_image_metadata(context)
initialize_connection(context, volume, connector)
list_availability_zones(enable_cache=False, refresh_cache=False)

Describe the known availability zones

Parameters
  • enable_cache – Enable az cache

  • refresh_cache – Refresh cache immediately

Returns

tuple of dicts, each with a ‘name’ and ‘available’ key

manage_existing(context, host, cluster_name, ref, name=None, description=None, volume_type=None, metadata=None, availability_zone=None, bootable=False)
manage_existing_snapshot(context, ref, volume, name=None, description=None, metadata=None)
migrate_volume(context, volume, host, cluster_name, force_copy, lock_volume)

Migrate the volume to the specified host or cluster.

migrate_volume_completion(context, volume, new_volume, error)
reserve_volume(context, volume)
retype(context, volume, new_type, migration_policy=None)

Attempt to modify the type associated with an existing volume.

revert_to_snapshot(context, volume, snapshot)

revert a volume to a snapshot

roll_detaching(context, volume)
terminate_connection(context, volume, connector, force=False)
thaw_host(ctxt, host, cluster_name)
unreserve_volume(context, volume)
update(context, volume, fields)
update_readonly_flag(context, volume, flag)
update_snapshot(context, snapshot, fields)
update_snapshot_metadata(context, snapshot, metadata, delete=False)

Updates or creates snapshot metadata.

If delete is True, metadata items that are not specified in the metadata argument will be deleted.

update_volume_admin_metadata(context, volume, metadata, delete=False, add=True, update=True)

Updates or creates volume administration metadata.

If delete is True, metadata items that are not specified in the metadata argument will be deleted.

update_volume_metadata(context, volume, metadata, delete=False, meta_type=<METADATA_TYPES.user: 1>)

Updates volume metadata.

If delete is True, metadata items that are not specified in the metadata argument will be deleted.

class HostAPI(db_driver=None)

Bases: cinder.db.base.Base

Sub-set of the Volume Manager API for managing host operations.

get_host_uptime(context, host)

Returns the result of calling “uptime” on the target host.

host_power_action(context, host, action)
set_host_enabled(context, host, enabled)

Sets the specified host’s ability to accept new volumes.

set_host_maintenance(context, host, mode)

Start/Stop host maintenance window.

On start, it triggers volume evacuation.