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_topic:What rpc topic to listen to (default: cinder-volume).
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 = '2.0'
accept_transfer(context, volume_id, new_user, new_project)
attach_volume(context, volume_id, instance_uuid, host_name, mountpoint, mode)

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_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_snapshot(inst, context, snapshot, **kwargs)
delete_volume(inst, context, volume_id, **kwargs)
detach_volume(inst, context, volume_id, attachment_id=None, **kwargs)
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.

init_host()

Perform any required initialization.

init_host_with_rpc()
initialize_connection(context, volume_id, connector)

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)
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(ctxt, 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.0>
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_migrated_volume(ctxt, volume, new_volume, volume_status)

Finalize migration process on backend device.

locked_detach_operation(f)

Lock decorator for volume detach operations.

Takes a named lock prior to executing the detach call. The lock is named with the operation executed and the id of the volume. This lock can then be used by other operations to avoid operation conflicts on shared volumes.

This locking mechanism is only for detach calls. We can’t use the locked_volume_operation, because detach requires an additional attachment_id in the parameter list.

locked_snapshot_operation(f)

Lock decorator for snapshot operations.

Takes a named lock prior to executing the operation. The lock is named with the operation executed and the id of the snapshot. This lock can then be used by other operations to avoid operation conflicts on shared snapshots.

Example use:

If a snapshot operation uses this decorator, it will block until the named lock is free. This is used to protect concurrent operations on the same snapshot e.g. delete SnapA while create volume VolA from SnapA is in progress.

locked_volume_operation(f)

Lock decorator for volume operations.

Takes a named lock prior to executing the operation. The lock is named with the operation executed and the id of the volume. This lock can then be used by other operations to avoid operation conflicts on shared volumes.

Example use:

If a volume operation uses this decorator, it will block until the named lock is free. This is used to protect concurrent operations on the same volume e.g. delete VolA while create volume VolB from VolA is in progress.

Previous topic

The cinder.volume.flows.manager.manage_existing_snapshot Module

Next topic

The cinder.volume.qos_specs Module

Project Source

This Page