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

[BUG] zpool.present state tries to set "active" zpool properties to "enabled" #62390

Closed
1 of 6 tasks
asomers opened this issue Jul 27, 2022 · 0 comments · Fixed by #62448
Closed
1 of 6 tasks

[BUG] zpool.present state tries to set "active" zpool properties to "enabled" #62390

asomers opened this issue Jul 27, 2022 · 0 comments · Fixed by #62448
Labels
Bug broken, incorrect, or confusing behavior needs-triage State-Module

Comments

@asomers
Copy link
Contributor

asomers commented Jul 27, 2022

Description
Optional ZFS pool features can have three states: disabled, enabled, and active.  Enabled means that ZFS will use them if it needs them, but they haven't changed the on-disk format yet, so they can still be switched off.  But active features have already changed the on-disk format, so they can't be switched off.  Disabled features may not be used.

We have a Salt state in salt/freebsd/zpool.sls that sets some features to "enabled".  However, if the feature is already active, then Salt will wrongly try to set it back to "enabled".  For example:

Setup

Set livelist on mypool:
  zpool.present:
    - name: mypool
    - properties:
        - feature@livelist: enabled

This state will work correctly if the feature is currently disabled or enabled. However, if the feature is active, then it will wrongly try to set it back to "enabled", without effect.

$ zpool get feature@livelist mypool
NAME    PROPERTY          VALUE             SOURCE
mypool  feature@livelist  active            local
$ sudo salt-call --state-verbose=False state.apply
...
          ID: Set livelist on mypool
    Function: zpool.present
        Name: mypool
      Result: True
     Comment: properties updated
     Started: 16:33:44.967972
    Duration: 755.072 ms
     Changes:   
              ----------
              mypool:
                  ----------
                  feature@livelist:
                      enabled
...

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD

Steps to Reproduce the behavior
Create a zpool and ensure that some zpool feature is active. An easy one to test with is empty_bpobj. Activate it like this:

truncate -s 1g /tmp/zfs.img
zpool create testpool /tmp/zfs.img
zpool set feature@empty_bpobj=enabled testpool
zpool create testpool/foo
zpool get feature@empty_bpobj testpool
NAME      PROPERTY             VALUE                SOURCE
testpool  feature@empty_bpobj  active               local

Then simply apply a zpool.present state that tries to set that feature to enabled.

Expected behavior
The command should complete with no output. It should not try to change the state.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3004.2
 
Dependency Versions:
          cffi: 1.15.0
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.0.1
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.4
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.12.0
        pygit2: Not Installed
        Python: 3.9.13 (main, Jun 30 2022, 19:10:41)
  python-gnupg: Not Installed
        PyYAML: 5.4.1
         PyZMQ: 22.3.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: freebsd 13.0 
        locale: utf-8
       machine: amd64
       release: 13.0-AXCIENT3-p12
        system: FreeBSD
       version: FreeBSD 13.0 
@asomers asomers added Bug broken, incorrect, or confusing behavior needs-triage labels Jul 27, 2022
twangboy pushed a commit to asomers/salt that referenced this issue Oct 11, 2022
Optional ZFS pool features can have three states: disabled, enabled, and
active.  Enabled means that ZFS will use them if it needs them, but they
haven't changed the on-disk format yet, so they can still be switched
off.  But active features have already changed the on-disk format, so
they can't be switched off.  Disabled features may not be used.

When enabling such a feature via the zpool.present state, treat "active"
as identical to "enabled".

Fixes saltstack#62390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage State-Module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants