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(*args, **kwargs)

Bases: cinder.volume.driver.TransferVD, cinder.volume.driver.ExtendVD, cinder.volume.driver.CloneableImageVD, cinder.volume.driver.SnapshotVD, cinder.volume.driver.MigrateVD, cinder.volume.driver.BaseVD

Implements RADOS block device (RBD) volume commands.

RBDProxy()
VERSION = '1.2.0'
backup_volume(context, backup, backup_service)

Create a new backup from an existing volume.

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_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 source 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.

ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

extend_volume(volume, new_size)

Extend an existing volume.

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>}
migrate_volume(context, volume, host)
remove_export(context, volume)

Removes an export for a logical volume.

restore_backup(context, backup, volume, backup_service)

Restore an existing backup to a new or existing volume.

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

Retypes a volume, allow Qos and extra_specs change.

terminate_connection(volume, connector, **kwargs)
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 RBDImageIOWrapper(rbd_meta)

Bases: io.RawIOBase

Enables LibRBD.Image objects to be treated as Python IO objects.

Calling unimplemented interfaces will raise IOError.

close()
fileno()

RBD does not have support for fileno() so we raise IOError.

Raising IOError is recommended way to notify caller that interface is not supported - see http://docs.python.org/2/library/io.html#io.IOBase

flush()
rbd_conf
rbd_image
rbd_pool
rbd_user
read(length=None)
seek(offset, whence=0)
seekable()
tell()
write(data)
class RBDImageMetadata(image, pool, user, conf)

Bases: object

RBD image metadata to be used with RBDImageIOWrapper.

class RBDVolumeProxy(driver, name, pool=None, snapshot=None, read_only=False)

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.

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

Previous topic

The cinder.volume.drivers.quobyte Module

Next topic

The cinder.volume.drivers.remotefs Module

Project Source

This Page