Skip to content

Commit 561b58c

Browse files
Andreas Unterkircherunki
authored andcommitted
manifests/logical_volume.pp, add support for filesystem-labels
1 parent cada6d4 commit 561b58c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

manifests/logical_volume.pp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Boolean $mountpath_require = false,
1515
Boolean $mounted = true,
1616
Boolean $createfs = true,
17+
Boolean $use_fs_label = false,
1718
$extents = undef,
1819
$stripes = undef,
1920
$stripesize = undef,
@@ -32,6 +33,17 @@
3233

3334
$lvm_device_path = "/dev/${volume_group}/${name}"
3435

36+
$mount_device = $use_fs_label ? {
37+
false => $lvm_device_path,
38+
true => "LABEL=${name}",
39+
}
40+
41+
$mkfs_label = $use_fs_label ? {
42+
false => '',
43+
# the ending whitespace is required
44+
true => "-L ${name} ",
45+
}
46+
3547
if $mountpath_require and $fs_type != 'swap' {
3648
Mount {
3749
require => File[$mountpath],
@@ -40,7 +52,7 @@
4052

4153
if $fs_type == 'swap' {
4254
$mount_title = $lvm_device_path
43-
$fixed_mountpath = "swap_${lvm_device_path}"
55+
$fixed_mountpath = "swap_${mount_device}"
4456
$fixed_pass = 0
4557
$fixed_dump = 0
4658
$mount_ensure = $ensure ? {
@@ -96,7 +108,7 @@
96108
filesystem { $lvm_device_path:
97109
ensure => $ensure,
98110
fs_type => $fs_type,
99-
options => $mkfs_options,
111+
options => "${mkfs_label}${mkfs_options}",
100112
}
101113
}
102114

@@ -113,7 +125,7 @@
113125
mount { $mount_title:
114126
ensure => $mount_ensure,
115127
name => $fixed_mountpath,
116-
device => $lvm_device_path,
128+
device => $mount_device,
117129
fstype => $fs_type,
118130
options => $options,
119131
pass => $fixed_pass,

0 commit comments

Comments
 (0)