The cinder.brick.local_dev.lvm Module

LVM class for performing LVM operations.

class LVM(vg_name, root_helper, create_vg=False, physical_volumes=None, lvm_type='default', executor=<function execute at 0x7f5a4ca88140>)

Bases: cinder.brick.executor.Executor

LVM object to enable various LVM related operations.

create_lv_snapshot(name, source_lv_name, lv_type='default')

Creates a snapshot of a logical volume.

Parameters:
  • name – Name to assign to new snapshot
  • source_lv_name – Name of Logical Volume to snapshot
  • lv_type – Type of LV (default or thin)
create_thin_pool(name=None, size_str=0)

Creates a thin provisioning pool for this VG.

The syntax here is slightly different than the default lvcreate -T, so we’ll just write a custom cmd here and do it.

Parameters:
  • name – Name to use for pool, default is “<vg-name>-pool”
  • size_str – Size to allocate for pool, default is entire VG
create_volume(name, size_str, lv_type='default', mirror_count=0)

Creates a logical volume on the object’s VG.

Parameters:
  • name – Name to use when creating Logical Volume
  • size_str – Size to use when creating Logical Volume
  • lv_type – Type of Volume (default or thin)
  • mirror_count – Use LVM mirroring with specified count
delete(name)

Delete logical volume or snapshot.

Parameters:name – Name of LV to delete
extend_volume(lv_name, new_size)

Extend the size of an existing volume.

static get_all_physical_volumes(root_helper, vg_name=None, no_suffix=True)

Static method to get all PVs on a system.

Parameters:
  • root_helper – root_helper to use for execute
  • vg_name – optional, gathers info for only the specified VG
  • no_suffix – optional, reports sizes in g with no suffix
Returns:

List of Dictionaries with PV info

static get_all_volume_groups(root_helper, vg_name=None, no_suffix=True)

Static method to get all VGs on a system.

Parameters:
  • root_helper – root_helper to use for execute
  • vg_name – optional, gathers info for only the specified VG
  • no_suffix – optional, reports sizes in g with no suffix
Returns:

List of Dictionaries with VG info

static get_all_volumes(root_helper, vg_name=None, no_suffix=True)

Static method to get all LV’s on a system.

Parameters:
  • root_helper – root_helper to use for execute
  • vg_name – optional, gathers info for only the specified VG
  • no_suffix – optional, reports sizes in g with no suffix
Returns:

List of Dictionaries with LV info

get_physical_volumes()

Get all PVs associated with this instantiation (VG).

Returns:List of Dictionaries with PV info
get_volume(name)

Get reference object of volume specified by name.

Returns:dict representation of Logical Volume if exists
get_volumes()

Get all LV’s associated with this instantiation (VG).

Returns:List of Dictionaries with LV info
lv_has_snapshot(name)
revert(snapshot_name)

Revert an LV from snapshot.

Parameters:snapshot_name – Name of snapshot to revert
static supports_thin_provisioning(root_helper)

Static method to check for thin LVM support on a system.

Parameters:root_helper – root_helper to use for execute
Returns:True if supported, False otherwise
update_volume_group_info()

Update VG info for this instantiation.

Used to update member fields of object and provide a dict of info for caller.

Returns:Dictionaries of VG info

Previous topic

The cinder.brick.iser.iser Module

Next topic

The cinder.brick.remotefs.remotefs Module

This Page