Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting the physical extent size for volume groups #332

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet/provider/volume_group/lvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions lib/puppet/type/volume_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that the actual default in vgcreate? I couldn't find it in the manpage.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://linux.die.net/man/8/vgcreate

The default is 4 MiB and it must be at least 1 KiB and a power of 2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just omit the -s flag entirely if the parameter isn't specified to truly maintain backwards compatibility?

btw I'm also interested in these updates

end
end
Loading