freezer.snapshot.lvm module

Freezer LVM related functions

freezer.snapshot.lvm.get_lvm_info(path)

Take a file system path as argument as backup_opt_dict.path_to_backup and return a list containing lvm_srcvol, lvm_volgroup where the path is mounted on.

Parameters

path – the original file system path where backup needs to be executed

Returns

a dict containing the keys ‘volgroup’, ‘srcvol’ and ‘snap_path’

freezer.snapshot.lvm.get_vol_fs_type(vol_name)

The argument need to be a full path lvm name i.e. /dev/vg0/var or a disk partition like /dev/sda1. The returnet value is the file system type

freezer.snapshot.lvm.log_volume_holding_process(lv)
freezer.snapshot.lvm.lvm_guess(mount_point_path, mount_points, source='/proc/mounts')

Guess lvm vol group and vol name from mount point

Extract the vol group and vol name from given list of mount_points and mount_point_path

Parameters
  • mount_point_path – mount path

  • mount_points – list of currently mounted devices

Returns

a list containing volume group, volume name and full device path

freezer.snapshot.lvm.lvm_snap(backup_opt_dict)

Checks the provided parameters and create the lvm snapshot if requested

The path_to_backup might be adjusted in case the user requested a lvm snapshot without specifying an exact path for the snapshot). The assumption in this case is that the user wants to use the lvm snapshot capability to backup the specified filesystem path, leaving out all the rest of the parameters which will guessed and set by freezer.

Parameters

backup_opt_dict – the configuration dict

Returns

True if the snapshot has been taken, False otherwise

freezer.snapshot.lvm.lvm_snap_remove(backup_opt_dict)

Unmount the snapshot and removes it

Parameters
  • backup_opt_dict.lvm_dirmount – mount point of the snapshot

  • backup_opt_dict.lvm_volgroup – volume group to which the lv belongs

  • backup_opt_dict.lvm_snapname – name of the snapshot lv

Returns

None, raises on error

freezer.snapshot.lvm.validate_lvm_params(backup_opt_dict)

Validates the parameters and raises in case of missing values

Parameters

backup_opt_dict

Returns

False is snapshot is not requested, True snapshot is requested and parameters are valid