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

(PA-6738) Update zfs with relatime support #84

Merged
merged 1 commit into from
Jul 15, 2024
Merged
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
4 changes: 4 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ The refquota property. Valid values are `<size>`, `none`.

The refreservation property. Valid values are `<size>`, `none`.

##### `relatime`

The relatime property. Valid values are `on`, `off`. Only supported on Linux

##### `reservation`

The reservation property. Valid values are `<size>`, `none`.
Expand Down
3 changes: 2 additions & 1 deletion lib/puppet/provider/zfs/zfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def container_property
# acltype is for ZFS on Linux, and allows disabling or enabling POSIX ACLs
# http://webcache.googleusercontent.com/search?q=cache:-p74K0DVsdwJ:developers.slashdot.org/story/11/11/09/2343258/solaris-11-released+&cd=13
# defaultuserquota is not supported in zfs filesystem versions older than 6 and will error on Solaris 10 machines
[:aclmode, :acltype, :shareiscsi, :overlay, :defaultuserquota].each do |field|
# relatime is only supported on ZFS on Linux
[:aclmode, :acltype, :shareiscsi, :overlay, :defaultuserquota, :relatime].each do |field|
# The zfs commands use the property value '-' to indicate that the
# property is not set. We make use of this value to indicate that the
# property is not set since it is not available. Conversely, if these
Expand Down
8 changes: 8 additions & 0 deletions lib/puppet/type/zfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ module Puppet
desc 'The refreservation property. Valid values are `<size>`, `none`.'
end

newproperty(:relatime) do
desc 'The relatime property. Valid values are `on`, `off`. Only supported on Linux'

validate do |_value|
raise Puppet::Error _('This property is only supported on Linux') unless Facter.value(:kernel) == 'Linux'
end
end

newproperty(:reservation) do
desc 'The reservation property. Valid values are `<size>`, `none`.'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/provider/zfs/zfs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
[:aclinherit, :aclmode, :atime, :canmount, :checksum,
:compression, :copies, :dedup, :defaultuserquota, :devices, :exec, :logbias,
:mountpoint, :nbmand, :overlay, :primarycache, :quota, :readonly,
:recordsize, :refquota, :refreservation, :reservation,
:recordsize, :refquota, :refreservation, :relatime, :reservation,
:secondarycache, :setuid, :shareiscsi, :sharenfs, :sharesmb,
:snapdir, :version, :volsize, :vscan, :xattr].each do |prop|
it "gets #{prop}" do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/type/zfs_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe Puppet::Type.type(:zfs) do
properties = [:ensure, :mountpoint, :compression, :copies, :overlay, :quota, :defaultuserquota, :reservation, :sharenfs, :snapdir, :sync]
properties = [:ensure, :mountpoint, :compression, :copies, :overlay, :quota, :defaultuserquota, :relatime, :reservation, :sharenfs, :snapdir, :sync]

properties.each do |property|
it "has a #{property} property" do
Expand Down