The cinder.volume.drivers.rbd Module

The cinder.volume.drivers.rbd Module

RADOS Block Device Driver

class RADOSClient(driver, pool=None)

Bases: object

Context manager to simplify error handling for connecting to ceph.

features
class RBDDriver(active_backend_id=None, *args, **kwargs)

Bases: cinder.volume.driver.CloneableImageVD, cinder.volume.driver.MigrateVD, cinder.volume.driver.ManageableVD, cinder.volume.driver.BaseVD

Implements RADOS block device (RBD) volume commands.

CI_WIKI_NAME = 'Cinder_Jenkins'
RBDProxy()
SYSCONFDIR = '/etc/ceph/'
VERSION = '1.2.0'
check_for_setup_error()

Returns an error if prerequisites aren’t met.

clone_image(context, volume, image_location, image_meta, image_service)
copy_image_to_encrypted_volume(context, volume, image_service, image_id)
copy_image_to_volume(context, volume, image_service, image_id)
copy_volume_to_image(context, volume, image_service, image_meta)
create_cloned_volume(volume, src_vref)

Create a cloned volume from another volume.

Since we are cloning from a volume and not a snapshot, we must first create a snapshot of the source volume.

The user has the option to limit how long a volume’s clone chain can be by setting rbd_max_clone_depth. If a clone is made of another clone and that clone has rbd_max_clone_depth clones behind it, the dest volume will be flattened.

create_export(context, volume, connector)

Exports the volume.

create_snapshot(snapshot)

Creates an rbd snapshot.

create_volume(volume)

Creates a logical volume.

create_volume_from_snapshot(volume, snapshot)

Creates a volume from a snapshot.

delete_snapshot(snapshot)

Deletes an rbd snapshot.

delete_volume(volume)

Deletes a logical volume.

do_setup(context)

Performs initialization steps that could raise exceptions.

ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

extend_volume(volume, new_size)

Extend an existing volume.

failover_host(context, volumes, secondary_id=None, groups=None)

Failover to replication target.

get_backup_device(context, backup)

Get a backup device from an existing volume.

To support incremental backups on Ceph to Ceph we don’t clone the volume.

get_manageable_volumes(cinder_volumes, marker, limit, offset, sort_keys, sort_dirs)
get_volume_stats(refresh=False)

Return the current state of the volume service.

If ‘refresh’ is True, run the update first.

initialize_connection(volume, connector)
manage_existing(volume, existing_ref)

Manages an existing image.

Renames the image name to match the expected name for the volume. Error checking done by manage_existing_get_size is not repeated.

Parameters:
  • volume – volume ref info to be set
  • existing_ref – existing_ref is a dictionary of the form: {‘source-name’: <name of rbd image>}
manage_existing_get_size(volume, existing_ref)

Return size of an existing image for manage_existing.

Parameters:
  • volume – volume ref info to be set
  • existing_ref – existing_ref is a dictionary of the form: {‘source-name’: <name of rbd image>}
manage_existing_snapshot(snapshot, existing_ref)

Manages an existing snapshot.

Renames the snapshot name to match the expected name for the snapshot. Error checking done by manage_existing_get_size is not repeated.

Parameters:
  • snapshot – snapshot ref info to be set
  • existing_ref – existing_ref is a dictionary of the form: {‘source-name’: <name of rbd snapshot>}
manage_existing_snapshot_get_size(snapshot, existing_ref)

Return size of an existing image for manage_existing.

Parameters:
  • snapshot – snapshot ref info to be set
  • existing_ref – existing_ref is a dictionary of the form: {‘source-name’: <name of snapshot>}
migrate_volume(context, volume, host)
remove_export(context, volume)

Removes an export for a logical volume.

retype(context, volume, new_type, diff, host)

Retype from one volume type to another on the same backend.

terminate_connection(volume, connector, **kwargs)
unmanage(volume)
update_migrated_volume(ctxt, volume, new_volume, original_volume_status)

Return model update from RBD for migrated volume.

This method should rename the back-end volume name(id) on the destination host back to its original name(id) on the source host.

Parameters:
  • ctxt – The context used to run the method update_migrated_volume
  • volume – The original volume that was migrated to this backend
  • new_volume – The migration volume object that was created on this backend as part of the migration process
  • original_volume_status – The status of the original volume
Returns:

model_update to update DB with any needed changes

class RBDVolumeProxy(driver, name, pool=None, snapshot=None, read_only=False, remote=None, timeout=None, client=None, ioctx=None)

Bases: object

Context manager for dealing with an existing rbd volume.

This handles connecting to rados and opening an ioctx automatically, and otherwise acts like a librbd Image object.

Also this may reuse an external connection (client and ioctx args), but note, that caller will be responsible for opening/closing connection. Also pool, remote, timeout args will be ignored in that case.

The underlying librados client and ioctx can be accessed as the attributes ‘client’ and ‘ioctx’.

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.