avocado_i2n.states.lvm module¶
Module for the LVM state management backend.
SUMMARY¶
Copyright: Intra2net AG
- ..warning:: This state backend is mostly legacy and is not fully
maintained (only tested in isolation) but kept here for backwards portability as well as completeness in case there is interest to revive it by contributors that actually need it.
INTERFACE¶
- class avocado_i2n.states.lvm.LVMBackend[source]¶
Bases:
StateBackendBackend manipulating states as logical volume snapshots.
- classmethod show(params: Params, object: Any = None) list[str][source]¶
Return a list of available states of a specific type.
All arguments match the base class.
- classmethod get(params: Params, object: Any = None) None[source]¶
Retrieve a state disregarding the current changes.
All arguments match the base class.
- classmethod set(params: Params, object: Any = None) None[source]¶
Store a state saving the current changes.
All arguments match the base class.
- classmethod unset(params: Params, object: Any = None) None[source]¶
Remove a state with previous changes.
All arguments match the base class and in addition:
- Raises:
ValueErrorif LV pointer state was used
- classmethod check_root(params: Params, object: Any = None) bool[source]¶
Check whether a root state or essentially the object exists.
All arguments match the base class.
- classmethod unset_root(params: Params, object: Any = None) None[source]¶
Unset a root state to prevent object existence.
All arguments match the base class and in addition:
- Raises:
exceptions.TestWarnif permanent vm was detected
Remove the disk, virtual group, thin pool and logical volume of each object.
- avocado_i2n.states.lvm.vg_setup(vg_name: str, disk_vg_size: str, disk_basedir: str, disk_sparse_filename: str, use_tmpfs: bool = True) tuple[str, str, str, str][source]¶
Create volume group on top of ram memory to speed up LV performance.
When disk is specified the size of the physical volume is taken from existing disk space.
- Parameters:
vg_name – name of the volume group
disk_vg_size – size of the disk virtual group (MB)
disk_basedir – base directory for the disk sparse file
disk_sparse_filename – name of the disk sparse file
use_tmpfs – whether to use RAM or slower storage
- Returns:
disk_filename, vg_disk_dir, vg_name, loop_device
- Raises:
lv_utils.LVExceptionon failure at any stage
Sample disk params: - disk_vg_size = “40000” - disk_basedir = “/tmp” - disk_sparse_filename = “virtual_hdd”
Sample general params: - vg_name=’autotest_vg’, - lv_name=’autotest_lv’, - lv_size=’1G’, - lv_snapshot_name=’autotest_sn’, - lv_snapshot_size=’1G’
The disk volume group size is in MB.
- avocado_i2n.states.lvm.vg_cleanup(disk_filename: str = None, vg_disk_dir: str = None, vg_name: str = None, loop_device: str = None, use_tmpfs: bool = True) None[source]¶
Clean up any stage of the VG disk setup in case of test error.
This detects whether the components were initialized and if so tries to remove them. In case of failure it raises summary exception.
- Parameters:
disk_filename – name of the disk sparse file
vg_disk_dir – location of the disk file
vg_name – name of the volume group
loop_device – name of the disk or loop device
use_tmpfs – whether to use RAM or slower storage
- Raises:
lv_utils.LVExceptionon intolerable failure at any stage