class LogicalVolume(base.BlockDev):
Logical Volume block device.
Class Method |
|
Create a new logical volume. |
Class Method |
|
Get the free space info for PVs in a volume group. |
Class Method |
|
Get the free space info for specific VGs. |
Class Method |
|
Get the free space info for specific VGs. |
Static Method |
|
Obtain the current state of the existing LV disks. |
Method | __init__ |
Attaches to a LV device. |
Method |
|
Assemble the device. |
Method |
|
Attach to an existing LV. |
Method |
|
Notifies that the device will no longer be used for I/O. |
Method |
|
Return the number of spindles used. |
Method |
|
Returns the sync status of the device. |
Method |
|
Grow the logical volume. |
Method |
|
Make the device ready for I/O. |
Method |
|
Remove this logical volume. |
Method |
|
Rename this logical volume. |
Method |
|
Update metadata with info text. |
Method |
|
Shutdown the device. |
Method |
|
Create a snapshot copy of an lvm block device. |
Instance Variable | attached |
Undocumented |
Instance Variable | dev |
Undocumented |
Instance Variable | major |
Undocumented |
Instance Variable | minor |
Undocumented |
Instance Variable | pe |
Undocumented |
Instance Variable | pv |
Undocumented |
Instance Variable | stripe |
Undocumented |
Class Method | _ |
Return the free disk space in the given VG, in exclusive storage mode. |
Class Method | _ |
Return info (size/free) about PVs. |
Class Method | _ |
Validates that a given name is valid as VG or LV name. |
Static Method | _ |
Compute the number of PVs needed for an LV (with exclusive storage). |
Static Method | _ |
Return a list of empty PVs, by name. |
Static Method | _ |
Return the the standard PV size (used with exclusive storage). |
Static Method | _ |
Returns LVM Volume infos using lvm_cmd |
Static Method | _ |
Parse one line of the lvs output used in GetLvGlobalInfo . |
Method | _ |
Return how much the disk can grow with exclusive storage. |
Method | _ |
Try to remove old tags from the lv. |
Constant | _INVALID |
Undocumented |
Constant | _INVALID |
Undocumented |
Constant | _PARSE |
Undocumented |
Constant | _VALID |
Undocumented |
Instance Variable | _degraded |
Undocumented |
Instance Variable | _lv |
Undocumented |
Instance Variable | _vg |
Undocumented |
Inherited from BlockDev
:
Method | __eq__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method |
|
Calculate the mirror status recursively for our children. |
Method |
|
Builds the shell command for exporting data from device. |
Method |
|
Return the actual disk size and number of spindles used. |
Method |
|
Return the actual disk size. |
Method |
|
Return URIs hypervisors can use to access disks in userspace mode. |
Method |
|
Builds the shell command for importing data to device. |
Method |
|
Pause/Resume the sync of the mirror. |
Method |
|
Adjust the synchronization parameters of the mirror. |
Instance Variable | dyn |
Undocumented |
Instance Variable | params |
Undocumented |
Instance Variable | size |
Undocumented |
Instance Variable | unique |
Undocumented |
Instance Variable | _children |
Undocumented |
def Create(cls, unique_id, children, size, spindles, params, excl_stor, dyn_params, **kwargs): ¶
ganeti.storage.base.BlockDev.Create
Create a new logical volume.
Get the free space info for PVs in a volume group.
Parameters | |
vg | list of volume group names, if empty all will be returned |
filter | whether to skip over unallocatable PVs |
include | whether to include a list of LVs hosted on each PV |
Returns | |
list | list of objects.LvmPvInfo objects |
Get the free space info for specific VGs.
Parameters | |
vg | list of volume group names, if empty all will be returned |
excl | whether exclusive_storage is enabled |
filter | whether to skip over readonly VGs |
Returns | |
list | list of tuples (free_space, total_size, name) with free_space in MiB |
Get the free space info for specific VGs.
Parameters | |
vg | volume group name |
Returns | |
tuple | (free_spindles, total_spindles) |
Obtain the current state of the existing LV disks.
Returns | |
a dict containing the state of each disk with the disk path as key |
ganeti.storage.base.BlockDev.__init__
Attaches to a LV device.
The unique_id is a tuple (vg_name, lv_name)
ganeti.storage.base.BlockDev.Assemble
Assemble the device.
We always run `lvchange -ay` on the LV to ensure it's active before use, as there were cases when xenvg was not active after boot (also possibly after disk issues).
ganeti.storage.base.BlockDev.Attach
Attach to an existing LV.
This method will try to see if an existing and active LV exists which matches our name. If so, its major/minor will be recorded.
ganeti.storage.base.BlockDev.Close
Notifies that the device will no longer be used for I/O.
This is a no-op for the LV device type.
Returns the sync status of the device.
If this device is a mirroring device, this function returns the status of the mirror.
For logical volumes, sync_percent and estimated_time are always None (no recovery in progress, as we don't handle the mirrored LV case). The is_degraded parameter is the inverse of the ldisk parameter.
For the ldisk parameter, we check if the logical volume has the 'virtual' type, which means it's not backed by existing storage anymore (read from it return I/O error). This happens after a physical disk failure and subsequent 'vgreduce --removemissing' on the volume group.
The status was already read in Attach, so we just return it.
Returns | |
objects.BlockDevStatus | Undocumented |
ganeti.storage.base.BlockDev.Open
Make the device ready for I/O.
This is a no-op for the LV device type.
ganeti.storage.base.BlockDev.Shutdown
Shutdown the device.
This is a no-op for the LV device type, as we don't deactivate the volumes on shutdown.
ganeti.storage.base.BlockDev.Snapshot
Create a snapshot copy of an lvm block device.
Returns | |
tuple (vg, lv) |
Return the free disk space in the given VG, in exclusive storage mode.
Parameters | |
vg | VG name |
Returns | |
float | free space in MiB |
Return info (size/free) about PVs.
Parameters | |
vg | VG name |
Returns | |
tuple | (standard_pv_size_in_MiB, number_of_free_pvs, total_number_of_pvs) |
Validates that a given name is valid as VG or LV name.
The list of valid characters and restricted names is taken out of the lvm(8) manpage, with the simplification that we enforce both VG and LV restrictions on the names.
Compute the number of PVs needed for an LV (with exclusive storage).
Parameters | |
size:float | LV size in MiB |
pvs | list of objects.LvmPvInfo, cannot be empty |
Returns | |
integer | number of PVs needed |
Return the the standard PV size (used with exclusive storage).
Parameters | |
pvs | list of objects.LvmPvInfo, cannot be empty |
Returns | |
float | size in MiB |
Returns LVM Volume infos using lvm_cmd
Parameters | |
lvm | Should be one of "pvs", "vgs" or "lvs" |
fields | Fields to return |
Returns | |
A list of dicts each with the parsed fields |