saltstack / saltstack/salt

[BUG] - zfs.volume_present state does not create a zvol

Open
#64,483 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
The zfs.volume_present state is broken since https://github.com/saltstack/salt/commit/25178edfc6d9076cebe18aee173d3431e5662bab#diff-6461d8b67a98ca859ce46566225a95aaf5f09c1fd878fa2e182e8e42319f299eR417 was added.
In effect, line 417 instructs the zfs.create module to be called specifying both the volume size and passing the 'volsize' property.

Setup

  • FreeBSD VM running on AWS EC2

Steps to Reproduce the behavior

this simple test:

'add swap file':
  zfs.volume_present:
    - name: zroot/swap
    - volume_size: '1G'

results in:

----------
          ID: add swap file
    Function: zfs.volume_present
        Name: zroot/swap
      Result: False
     Comment: property 'volsize' specified multiple times
     Started: 19:15:08.295446
    Duration: 36.803 ms
     Changes: 

It is as if you're calling the zfs.create module directly like that:

root@freebsd:~ # salt-call zfs.create zroot/test1 volume_size=1G properties="{'volsize': '1073741824'}"
[ERROR   ] Command '/sbin/zfs' failed with return code: 1
[ERROR   ] stderr: property 'volsize' specified multiple times
[ERROR   ] retcode: 1
local:
    ----------
    created:
        False
    error:
        property 'volsize' specified multiple times

Expected behavior

The volume should be created if it doesn't exist already

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3005.1
 
Dependency Versions:
          cffi: 1.15.1
      cherrypy: Not Installed
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: 1.5.2
      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.16.0
        pygit2: 1.11.1
        Python: 3.9.16 (main, May  4 2023, 01:22:04)
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 25.0.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: freebsd 13.2 
        locale: utf-8
       machine: amd64
       release: 13.2-RELEASE
        system: FreeBSD
       version: FreeBSD 13.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at zfs.volume_present and the line 417 change referenced in the issue, then trace how it calls zfs.create with volume_size and the volsize property. Reproduce the FreeBSD example and verify that a missing zroot/swap zvol is created without the duplicate-property error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.