The cinder.volume.manager Module

Volume manager manages creating, attaching, detaching, and persistent storage.

Persistent storage volumes keep their state independent of instances. You can attach to an instance, terminate the instance, spawn a new instance (even one from a different image) and re-attach the volume with the same data intact.

Related Flags

volume_manager:The module name of a class derived from manager.Manager (default: cinder.volume.manager.Manager).
volume_driver:Used by Manager. Defaults to cinder.volume.drivers.lvm.LVMVolumeDriver.
volume_group:Name of the group that will contain exported volumes (default: cinder-volumes)
num_shell_tries:
 Number of times to attempt to run commands (default: 3)
class VolumeManager(volume_driver=None, service_name=None, *args, **kwargs)

Bases: cinder.manager.SchedulerDependentManager

Manages attachable block storage devices.

RPC_API_VERSION = '3.0'
accept_transfer(context, volume_id, new_user, new_project)
attach_volume(*a, **k)

Updates db to show volume is attached.

copy_volume_to_image(context, volume_id, image_meta)

Uploads the specified volume to Glance.

image_meta is a dictionary containing the following keys: ‘id’, ‘container_format’, ‘disk_format’

create_cgsnapshot(context, cgsnapshot)

Creates the cgsnapshot.

create_consistencygroup(context, group)

Creates the consistency group.

create_consistencygroup_from_src(context, group, cgsnapshot=None, source_cg=None)

Creates the consistency group from source.

The source can be a CG snapshot or a source CG.

create_group(context, group)

Creates the group.

create_group_from_src(context, group, group_snapshot=None, source_group=None)

Creates the group from source.

The source can be a group snapshot or a source group.

create_group_snapshot(context, group_snapshot)

Creates the group_snapshot.

create_snapshot(context, volume_id, snapshot)

Creates and exports the snapshot.

create_volume(context, volume_id, request_spec=None, filter_properties=None, allow_reschedule=True, volume=None)

Creates the volume.

delete_cgsnapshot(context, cgsnapshot)

Deletes cgsnapshot.

delete_consistencygroup(context, group)

Deletes consistency group and the volumes in the group.

delete_group(context, group)

Deletes group and the volumes in the group.

delete_group_snapshot(context, group_snapshot)

Deletes group_snapshot.

delete_snapshot(*a, **k)

Deletes and unexports snapshot.

delete_volume(*a, **k)

Deletes and unexports volume.

  1. Delete a volume(normal case) Delete a volume and update quotas.
  2. Delete a migration volume If deleting the volume in a migration, we want to skip quotas but we need database updates for the volume.
detach_volume(*a, **k)

Updates db to show volume is detached.

extend_volume(context, volume_id, new_size, reservations, volume=None)
failover_host(context, secondary_backend_id=None)

Failover a backend to a secondary replication target.

Instructs a replication capable/configured backend to failover to one of it’s secondary replication targets. host=None is an acceptable input, and leaves it to the driver to failover to the only configured target, or to choose a target on it’s own. All of the hosts volumes will be passed on to the driver in order for it to determine the replicated volumes on the host, if needed.

Parameters:
  • context – security context
  • secondary_backend_id – Specifies backend_id to fail over to
freeze_host(context)

Freeze management plane on this backend.

Basically puts the control/management plane into a Read Only state. We should handle this in the scheduler, however this is provided to let the driver know in case it needs/wants to do something specific on the backend.

Parameters:context – security context
get_backup_device(ctxt, backup)
get_capabilities(context, discover)

Get capabilities of backend storage.

get_manageable_snapshots(ctxt, marker, limit, offset, sort_keys, sort_dirs)
get_manageable_volumes(ctxt, marker, limit, offset, sort_keys, sort_dirs)
init_host(added_to_cluster=None)

Perform any required initialization.

init_host_with_rpc()
initialize_connection(context, volume_id, connector, volume=None)

Prepare volume for connection from host represented by connector.

This method calls the driver initialize_connection and returns it to the caller. The connector parameter is a dictionary with information about the host that will connect to the volume in the following format:

{
    'ip': ip,
    'initiator': initiator,
}

ip: the ip address of the connecting machine

initiator: the iscsi initiator name of the connecting machine. This can be None if the connecting machine does not support iscsi connections.

driver is responsible for doing any necessary security setup and returning a connection_info dictionary in the following format:

{
    'driver_volume_type': driver_volume_type,
    'data': data,
}
driver_volume_type: a string to identify the type of volume. This
can be used by the calling code to determine the strategy for connecting to the volume. This could be ‘iscsi’, ‘rbd’, ‘sheepdog’, etc.
data: this is the data that the calling code will use to connect
to the volume. Keep in mind that this will be serialized to json in various places, so it should not contain any non-json data types.
is_working()

Return if Manager is ready to accept requests.

This is to inform Service class that in case of volume driver initialization failure the manager is actually down and not ready to accept any requests.

manage_existing(ctxt, volume_id, ref=None, volume=None)
manage_existing_snapshot(ctxt, snapshot, ref=None)
migrate_volume(ctxt, volume_id, host, force_host_copy=False, new_type_id=None, volume=None)

Migrate the volume to the specified host (called on source host).

migrate_volume_completion(ctxt, volume_id, new_volume_id, error=False, volume=None, new_volume=None)
promote_replica(ctxt, volume_id)

Promote volume replica secondary to be the primary volume.

publish_service_capabilities(context)

Collect driver status and then publish.

reenable_replication(ctxt, volume_id)

Re-enable replication of secondary volume with primary volumes.

remove_export(context, volume_id)

Removes an export for a volume.

retype(context, volume_id, new_type_id, host, migration_policy='never', reservations=None, volume=None, old_reservations=None)
secure_file_operations_enabled(ctxt, volume)
target = <Target version=2.6>
terminate_connection(context, volume_id, connector, force=False)

Cleanup connection from host represented by connector.

The format of connector is the same as for initialize_connection.

thaw_host(context)

UnFreeze management plane on this backend.

Basically puts the control/management plane back into a normal state. We should handle this in the scheduler, however this is provided to let the driver know in case it needs/wants to do something specific on the backend.

Parameters:context – security context
update_consistencygroup(context, group, add_volumes=None, remove_volumes=None)

Updates consistency group.

Update consistency group by adding volumes to the group, or removing volumes from the group.

update_group(context, group, add_volumes=None, remove_volumes=None)

Updates group.

Update group by adding volumes to the group, or removing volumes from the group.

update_migrated_volume(ctxt, volume, new_volume, volume_status)

Finalize migration process on backend device.

Previous topic

The cinder.volume.group_types Module

Next topic

The cinder.volume.qos_specs Module

This Page