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-5790) Add zfs attribute defaultuserquota #83

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

AriaXLi
Copy link
Contributor

@AriaXLi AriaXLi commented Jul 3, 2024

This commit adds the defaultuserquota attribute. On machines with zfs filesystem version 5 and older, attempting to use this attribute causes an exception/error since defaultuserquota is not a valid attribute on older zfs filesystem versions. This commit adds logic to handle and rescue that exception.

(cherry picked from commit cb3f040)

@AriaXLi AriaXLi added the enhancement New feature or request label Jul 3, 2024
@AriaXLi AriaXLi requested a review from a team as a code owner July 3, 2024 21:08
lib/puppet/type/zfs.rb Outdated Show resolved Hide resolved
This commit adds the defaultuserquota attribute. On machines with zfs
filesystem version 5 and older, attempting to use this attribute causes an
exception/error since defaultuserquota is not a valid attribute on older zfs
filesystem versions. This commit adds logic to handle and rescue that
exception.

(cherry picked from commit cb3f040)

Co-authored-by: Jeffrey Clark <[email protected]>
@AriaXLi
Copy link
Contributor Author

AriaXLi commented Jul 11, 2024

Testing my changes on zfs adhoc:

Passed on zfs 7.x: https://jenkins-platform.delivery.puppetlabs.net/view/modules/view/Core/view/zfs_core/view/adhoc/job/forge-module_puppetlabs-zfs_core_intn-sys_nightly-puppet_agent_7.x-module_adhoc/12/

Passed on zfs main: https://jenkins-platform.delivery.puppetlabs.net/view/modules/view/Core/view/zfs_core/view/adhoc/job/forge-module_puppetlabs-zfs_core_intn-sys_nightly-puppet_agent_main-module_adhoc/15/

Before my changes, an "invalid property" error would pop up on Solaris 10 since it uses zfs filesystem version 5:

cozy-coupler.delivery.puppetlabs.net (solaris10-64-1) 21:19:55$ puppet resource zfs tstpool/tstfs
�[00;00m�[00;33m  Error: Could not run: Execution of '/usr/sbin/zfs get -H -o value defaultuserquota tstpool/tstfs' returned 2: bad property list: invalid property 'defaultuserquota'
  For more info, run: zfs help get
�[00;00m�[00;37m

After my changes, the "invalid property" error went away:

cool-pituitary.delivery.puppetlabs.net (solaris10-64-1) 22:37:43$ puppet resource zfs tstpool/tstfs
�[00;00m�[00;33m  zfs { 'tstpool/tstfs':
    ensure           => 'present',
    aclinherit       => 'restricted',
    aclmode          => 'discard',
    acltype          => '-',
    atime            => 'on',
    canmount         => 'on',
    checksum         => 'on',
    compression      => 'off',
    copies           => '1',
    dedup            => 'off',
    defaultuserquota => '-',
    ...

The property can be used on Solaris 11 though since it uses a newer version of zfs (version 6):

15:29:44 olive-motif.delivery.puppetlabs.net (solaris114-64-1) 22:29:44$ puppet resource zfs tstpool/tstfs
15:29:44   zfs { 'tstpool/tstfs':
15:29:46     ensure           => 'present',
15:29:46     aclinherit       => 'restricted',
15:29:46     aclmode          => 'discard',
15:29:46     acltype          => '-',
15:29:46     atime            => 'on',
15:29:46     canmount         => 'on',
15:29:46     checksum         => 'on',
15:29:46     compression      => 'off',
15:29:46     copies           => '1',
15:29:46     dedup            => 'off',
15:29:46     defaultuserquota => 'none',
...

@joshcooper joshcooper merged commit b31e0ae into puppetlabs:main Jul 12, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants