--- /dev/null
+# put a lvm.conf file on the host,
+# optionally with the global_filter attribute set,
+# with issue_discards set as configured.
+class lvm(
+ Optional[String] $global_filter = undef,
+ Boolean $issue_discards = false,
+) {
+ if (versioncmp($::lsbmajdistrelease, '10') >= 0) {
+ $template = 'lvm/lvm.conf-buster.erb'
+ } else {
+ $template = 'lvm/lvm.conf-stretch.erb'
+ }
+
+ file { '/etc/lvm/lvm.conf':
+ ensure => file,
+ content => template($template),
+ notify => [ Exec['update-initramfs -u'], Exec['vgscan'] ];
+ }
+
+ exec { 'vgscan':
+ path => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
+ refreshonly => true;
+ }
+}
# global_filter are not opened by LVM.
# This configuration option has an automatic default value.
# global_filter = [ "a|.*/|" ]
+<% if @global_filter -%>
+ global_filter = <%= @global_filter -%>
+
+<% end -%>
# Configuration option devices/types.
# List of additional acceptable block device types.
# benefit from discards, but SSDs and thinly provisioned LUNs
# generally do. If enabled, discards will only be issued if both the
# storage and kernel provide support.
+<% if @issue_discards -%>
+ issue_discards = 1
+
+<% else -%>
issue_discards = 0
+<% end -%>
# Configuration option devices/allow_changes_with_duplicate_pvs.
# Allow VG modification while a PV appears on multiple devices.
# When a PV appears on multiple devices, LVM attempts to choose the
# global_filter are not opened by LVM.
# This configuration option has an automatic default value.
# global_filter = [ "a|.*/|" ]
+<% if @global_filter -%>
+ global_filter = <%= @global_filter -%>
+
+<% end -%>
# Configuration option devices/cache_dir.
# Directory in which to store the device cache file.
# benefit from discards, but SSDs and thinly provisioned LUNs
# generally do. If enabled, discards will only be issued if both the
# storage and kernel provide support.
+<% if @issue_discards -%>
+ issue_discards = 1
+
+<% else -%>
issue_discards = 0
+<% end -%>
+
# Configuration option devices/allow_changes_with_duplicate_pvs.
# Allow VG modification while a PV appears on multiple devices.
# When a PV appears on multiple devices, LVM attempts to choose the