Skip to content

Commit b31e0ae

Browse files
authored
Merge pull request #83 from AriaXLi/PA-5790
(PA-5790) Add zfs attribute defaultuserquota
2 parents b8e4d77 + 7710da2 commit b31e0ae

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

REFERENCE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ The copies property. Valid values are `1`, `2`, `3`.
6767

6868
The dedup property. Valid values are `on`, `off`.
6969

70+
##### `defaultuserquota`
71+
72+
The defaultuserquota property. Valid values are `<size>`, `none`.
73+
7074
##### `devices`
7175

7276
The devices property. Valid values are `on`, `off`.

lib/puppet/provider/zfs/zfs.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def container_property
5757
# aclmode was removed from S11 in build 139 but it may have been added back
5858
# acltype is for ZFS on Linux, and allows disabling or enabling POSIX ACLs
5959
# http://webcache.googleusercontent.com/search?q=cache:-p74K0DVsdwJ:developers.slashdot.org/story/11/11/09/2343258/solaris-11-released+&cd=13
60-
[:aclmode, :acltype, :shareiscsi, :overlay].each do |field|
60+
# defaultuserquota is not supported in zfs filesystem versions older than 6 and will error on Solaris 10 machines
61+
[:aclmode, :acltype, :shareiscsi, :overlay, :defaultuserquota].each do |field|
6162
# The zfs commands use the property value '-' to indicate that the
6263
# property is not set. We make use of this value to indicate that the
6364
# property is not set since it is not available. Conversely, if these

lib/puppet/type/zfs.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ module Puppet
5656
desc 'The dedup property. Valid values are `on`, `off`.'
5757
end
5858

59+
newproperty(:defaultuserquota) do
60+
desc 'The defaultuserquota property. Valid values are `<size>`, `none`.'
61+
62+
# Solaris 10 uses zfs filesystem version 5 which doesn't support defaultuserquota
63+
validate do |_value|
64+
raise Puppet::Error _('This property is only supported on zfs filestystem version >= 6') if Facter.value(:kernel) == 'SunOS' && Puppet::Util::Package.versioncmp(Facter.value(:kernelrelease),
65+
'11') < 0
66+
end
67+
end
68+
5969
newproperty(:devices) do
6070
desc 'The devices property. Valid values are `on`, `off`.'
6171
end

spec/unit/provider/zfs/zfs_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
describe 'zfs properties' do
9393
[:aclinherit, :aclmode, :atime, :canmount, :checksum,
94-
:compression, :copies, :dedup, :devices, :exec, :logbias,
94+
:compression, :copies, :dedup, :defaultuserquota, :devices, :exec, :logbias,
9595
:mountpoint, :nbmand, :overlay, :primarycache, :quota, :readonly,
9696
:recordsize, :refquota, :refreservation, :reservation,
9797
:secondarycache, :setuid, :shareiscsi, :sharenfs, :sharesmb,

spec/unit/type/zfs_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

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

66
properties.each do |property|
77
it "has a #{property} property" do

0 commit comments

Comments
 (0)