From 79b0dd6dcdd8172867178cf13c45b2469c812495 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Thu, 7 Mar 2024 15:32:31 +0100 Subject: [PATCH 1/3] Allow setting the physical extent size for volume groups --- lib/puppet/provider/volume_group/lvm.rb | 2 +- lib/puppet/type/volume_group.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/volume_group/lvm.rb b/lib/puppet/provider/volume_group/lvm.rb index 44ac190f..e0ebfb35 100644 --- a/lib/puppet/provider/volume_group/lvm.rb +++ b/lib/puppet/provider/volume_group/lvm.rb @@ -44,7 +44,7 @@ def self.get_logical_volume_properties(volume_groups_line) end def create - vgcreate(@resource[:name], *@resource.should(:physical_volumes)) + vgcreate(@resource[:name], *@resource.should(:physical_volumes) -s @resource[:extents_size]) end def destroy diff --git a/lib/puppet/type/volume_group.rb b/lib/puppet/type/volume_group.rb index b98de0f1..c5caaabb 100644 --- a/lib/puppet/type/volume_group.rb +++ b/lib/puppet/type/volume_group.rb @@ -64,4 +64,12 @@ def insync?(is) aliasvalue(:no, :false) defaultto :false end + + newparam(:extents_size) do + desc "The physical extents size. Defaults to 4(M)" + validate do |value| + raise ArgumentError, "#{value} is not a valid extents size" unless %r{^[0-9]+(\.[0-9]+)?}i.match?(value) + end + defaultto 4 + end end From 54b6434d5519a11bce1c5e335ea2239340baaaca Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Thu, 7 Mar 2024 15:49:46 +0100 Subject: [PATCH 2/3] No whitespace between -s and the extent size --- lib/puppet/provider/volume_group/lvm.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/volume_group/lvm.rb b/lib/puppet/provider/volume_group/lvm.rb index e0ebfb35..6643c940 100644 --- a/lib/puppet/provider/volume_group/lvm.rb +++ b/lib/puppet/provider/volume_group/lvm.rb @@ -44,7 +44,7 @@ def self.get_logical_volume_properties(volume_groups_line) end def create - vgcreate(@resource[:name], *@resource.should(:physical_volumes) -s @resource[:extents_size]) + vgcreate(@resource[:name], *@resource.should(:physical_volumes) -s@resource[:extents_size]) end def destroy From 668e2da445541b86a085709241cf28c7d0e543fe Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 11 Mar 2024 17:14:04 +0100 Subject: [PATCH 3/3] Fix rubocop --- lib/puppet/provider/volume_group/lvm.rb | 2 +- lib/puppet/type/volume_group.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/volume_group/lvm.rb b/lib/puppet/provider/volume_group/lvm.rb index 6643c940..e51d3792 100644 --- a/lib/puppet/provider/volume_group/lvm.rb +++ b/lib/puppet/provider/volume_group/lvm.rb @@ -44,7 +44,7 @@ def self.get_logical_volume_properties(volume_groups_line) end def create - vgcreate(@resource[:name], *@resource.should(:physical_volumes) -s@resource[:extents_size]) + vgcreate(@resource[:name], *@resource.should(:physical_volumes), '-s', @resource[:extents_size]) end def destroy diff --git a/lib/puppet/type/volume_group.rb b/lib/puppet/type/volume_group.rb index c5caaabb..bd25405a 100644 --- a/lib/puppet/type/volume_group.rb +++ b/lib/puppet/type/volume_group.rb @@ -66,7 +66,7 @@ def insync?(is) end newparam(:extents_size) do - desc "The physical extents size. Defaults to 4(M)" + desc 'The physical extents size. Defaults to 4(M).' validate do |value| raise ArgumentError, "#{value} is not a valid extents size" unless %r{^[0-9]+(\.[0-9]+)?}i.match?(value) end