The freezer.snapshot.lvm Module

  1. Copyright 2014-2016 Hewlett-Packard Development Company, L.P.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Freezer LVM related functions

freezer.snapshot.lvm.get_lvm_info(path)[source]

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)[source]

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)[source]
freezer.snapshot.lvm.lvm_guess(mount_point_path, mount_points, source='/proc/mounts')[source]

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)[source]

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)[source]

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)[source]

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