The cinder.volume.drivers.lvm Module

Driver for Linux servers running LVM.

class LVMVolumeDriver(vg_obj=None, *args, **kwargs)

Bases: cinder.volume.driver.VolumeDriver

Executes commands relating to Volumes.

CI_WIKI_NAME = ‘Cinder_Jenkins’
VERSION = ‘3.0.0’
check_for_setup_error()

Verify that requirements are in place to use LVM driver.

clone_image(context, volume, image_location, image_meta, image_service)
copy_image_to_volume(context, volume, image_service, image_id)

Fetch the image from image_service and write it to the volume.

copy_volume_to_image(context, volume, image_service, image_meta)

Copy the volume to the specified image.

create_cloned_volume(volume, src_vref)

Creates a clone of the specified volume.

create_export(context, volume, connector, vg=None)
create_snapshot(snapshot)

Creates a snapshot.

create_volume(volume)

Creates a logical volume.

create_volume_from_snapshot(volume, snapshot)

Creates a volume from a snapshot.

delete_snapshot(snapshot)

Deletes a snapshot.

delete_volume(volume)

Deletes a logical volume.

ensure_export(context, volume)
extend_volume(volume, new_size)

Extend an existing volume’s size.

get_manageable_snapshots(cinder_snapshots, marker, limit, offset, sort_keys, sort_dirs)
get_manageable_volumes(cinder_volumes, marker, limit, offset, sort_keys, sort_dirs)
get_pool(volume)
get_volume_stats(refresh=False)

Get volume status.

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

initialize_connection(volume, connector)
local_path(volume, vg=None)
manage_existing(volume, existing_ref)

Manages an existing LV.

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

manage_existing_get_size(volume, existing_ref)
manage_existing_object_get_size(existing_object, existing_ref, object_type)

Return size of an existing LV for manage existing volume/snapshot.

existing_ref is a dictionary of the form: {‘source-name’: <name of LV>}

manage_existing_snapshot(snapshot, existing_ref)
manage_existing_snapshot_get_size(snapshot, existing_ref)
migrate_volume(ctxt, volume, host, thin=False, mirror_count=0)

Optimize the migration if the destination is on the same server.

If the specified host is another back-end on the same server, and the volume is not attached, we can do the migration locally without going through iSCSI.

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

Retypes a volume, allow QoS and extra_specs change.

revert_to_snapshot(context, volume, snapshot)

Revert a volume to a snapshot

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

Return model update from LVM 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

validate_connector(connector)