diff --git a/REFERENCE.md b/REFERENCE.md index 7eff1478..546a0c05 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -108,6 +108,7 @@ The following parameters are available in the `lvm::logical_volume` defined type * [`dump`](#-lvm--logical_volume--dump) * [`fs_type`](#-lvm--logical_volume--fs_type) * [`mkfs_options`](#-lvm--logical_volume--mkfs_options) +* [`use_dm_devicepath`](#-lvm--logical_volume--use_dm_devicepath) * [`mountpath`](#-lvm--logical_volume--mountpath) * [`mountpath_require`](#-lvm--logical_volume--mountpath_require) * [`mounted`](#-lvm--logical_volume--mounted) @@ -198,6 +199,14 @@ Data type: `Optional[String[1]]` Default value: `undef` +##### `use_dm_devicepath` + +Data type: `Boolean` + +Whetever to use the default /dev/$vg/$lv as device name or use /dev/mapper/$vg-$lv for mount and filesystem creation. + +Default value: `false` + ##### `mountpath` Data type: `Stdlib::Absolutepath` diff --git a/manifests/logical_volume.pp b/manifests/logical_volume.pp index 0f41081b..2310627e 100644 --- a/manifests/logical_volume.pp +++ b/manifests/logical_volume.pp @@ -21,6 +21,8 @@ # # @param mkfs_options # +# @param use_dm_devicepath Whetever to use the default /dev/$vg/$lv as device name or use /dev/mapper/$vg-$lv for mount and fs creation (Default value: false) +# # @param mountpath # # @param mountpath_require @@ -72,6 +74,7 @@ Variant[String[1], Integer] $dump = '0', String[1] $fs_type = 'ext4', Optional[String[1]] $mkfs_options = undef, + Boolean $use_dm_devicepath = false, Stdlib::Absolutepath $mountpath = "/${name}", Boolean $mountpath_require = false, Boolean $mounted = true, @@ -92,7 +95,12 @@ Optional[Enum['anywhere', 'contiguous', 'cling', 'inherit', 'normal']] $alloc = undef, Boolean $yes_flag = false, ) { - $lvm_device_path = "/dev/${volume_group}/${name}" + # Do not respect for swap, to have a stable mount_title + if $use_dm_devicepath and $fs_type != 'swap' { + $lvm_device_path = "/dev/mapper/${volume_group}-${name}" + } else { + $lvm_device_path = "/dev/${volume_group}/${name}" + } if $mountpath_require and $fs_type != 'swap' { Mount {