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 1 commit
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 @@
end

def create
vgcreate(@resource[:name], *@resource.should(:physical_volumes))
vgcreate(@resource[:name], *@resource.should(:physical_volumes) -s @resource[:extents_size])

Check failure on line 47 in lib/puppet/provider/volume_group/lvm.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Lint/Syntax: unexpected token tIVAR (Using Ruby 2.6 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)

Check failure on line 47 in lib/puppet/provider/volume_group/lvm.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Lint/Syntax: unexpected token tRPAREN (Using Ruby 2.6 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)

Check failure on line 47 in lib/puppet/provider/volume_group/lvm.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Lint/Syntax: unexpected token tIVAR (Using Ruby 2.6 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)

Check failure on line 47 in lib/puppet/provider/volume_group/lvm.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Lint/Syntax: unexpected token tRPAREN (Using Ruby 2.6 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)
end

def destroy
Expand Down Expand Up @@ -98,3 +98,3 @@
raise Puppet::Error, "Could not extend volume group '#{@resource[:name]}' with physical volume #{volume} (#{e.message})"
end
end
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 @@
aliasvalue(:no, :false)
defaultto :false
end

newparam(:extents_size) do
desc "The physical extents size. Defaults to 4(M)"

Check failure on line 69 in lib/puppet/type/volume_group.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://rubystyle.guide#consistent-string-literals)

Check failure on line 69 in lib/puppet/type/volume_group.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://rubystyle.guide#consistent-string-literals)
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