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

zpool.get error #38671

Closed
MikeSpaceG opened this Issue Jan 10, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@MikeSpaceG

MikeSpaceG commented Jan 10, 2017

Description of Issue/Question

zpool.get fails as '-o' is not a valid option with ZFS on Linux.

Setup

zfs: 0.6.5.8-1.el7_3.centos

Steps to Reproduce Issue

# salt nas zpool.get pool/users
nas:
    ----------
    error:
        invalid option 'o'
        usage:
        	get [-pH] <"all" | property[,...]> <pool> ...
        
        the following properties are supported:
        
        	PROPERTY         EDIT   VALUES
        
        	allocated          NO   <size>
        	capacity           NO   <size>
        	dedupratio         NO   <1.00x or higher if deduped>
        	expandsize         NO   <size>
        	fragmentation      NO   <percent>
        	free               NO   <size>
        	freeing            NO   <size>
        	guid               NO   <guid>
        	health             NO   <state>
        	leaked             NO   <size>
        	size               NO   <size>
        	altroot           YES   <path>
        	ashift            YES   <ashift, 9-13, or 0=default>
        	autoexpand        YES   on | off
        	autoreplace       YES   on | off
        	bootfs            YES   <filesystem>
        	cachefile         YES   <file> | none
        	comment           YES   <comment-string>
        	dedupditto        YES   <threshold (min 100)>
        	delegation        YES   on | off
        	failmode          YES   wait | continue | panic
        	listsnapshots     YES   on | off
        	readonly          YES   on | off
        	version           YES   <version>
        	feature@...       YES   disabled | enabled | active
        
        The feature@ properties must be appended with a feature name.
        See zpool-features(5).
    pool/users:
        ----------
ERROR: Minions returned with non-zero exit code

Versions Report

Master:

Salt Version:
           Salt: 2016.3.4
 
Dependency Versions:
           cffi: 1.5.2
       cherrypy: Not Installed
       dateutil: 2.4.2
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: 0.24.0
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: 0.24.0
         Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: Ubuntu 16.04 xenial
        machine: x86_64
        release: 4.4.0-57-generic
         system: Linux
        version: Ubuntu 16.04 xenial

Minion:

    Salt Version:
               Salt: 2016.11.1
     
    Dependency Versions:
               cffi: Not Installed
           cherrypy: Not Installed
           dateutil: Not Installed
              gitdb: Not Installed
          gitpython: Not Installed
              ioflo: Not Installed
             Jinja2: 2.7.2
            libgit2: Not Installed
            libnacl: Not Installed
           M2Crypto: Not Installed
               Mako: Not Installed
       msgpack-pure: Not Installed
     msgpack-python: 0.4.6
       mysql-python: Not Installed
          pycparser: Not Installed
           pycrypto: 2.6.1
             pygit2: Not Installed
             Python: 2.7.5 (default, Nov  6 2016, 00:28:07)
       python-gnupg: Not Installed
             PyYAML: 3.11
              PyZMQ: 15.3.0
               RAET: Not Installed
              smmap: Not Installed
            timelib: Not Installed
            Tornado: 4.2.1
                ZMQ: 4.1.4
     
    System Versions:
               dist: centos 7.3.1611 Core
            machine: x86_64
            release: 3.10.0-514.2.2.el7.x86_64
             system: Linux
            version: CentOS Linux 7.3.1611 Core
@Ch3LL

This comment has been minimized.

Contributor

Ch3LL commented Jan 11, 2017

@MikeSpaceG seems there is a difference between say freebsd and linux usage of zpool.

From freebsd man page here : zpool get [-Hp] [-o field[,...]] all | property[,...] pool ... vs the usage output: get [-pH] <"all" | property[,...]> <pool> ...

Looks like we need to edit the command if on linux.

@darkpixel

This comment has been minimized.

Contributor

darkpixel commented Dec 12, 2017

If you export the pool and then re-run it, this error is not thrown.
This occurs the second time salt is run with zpool.present.

i.e.

import_pool:
  zpool.present:
    - name: tank
    - layout:
      - /dev/disk/by-id/dm-name-zfs1
      - /dev/disk/by-id/dm-name-zfs2
      - /dev/disk/by-id/dm-name-zfs3
    - require:
      - load_zfs_module
      - load_spl_module

Running twice:

[root@salt /srv/salt]# salt 'zfstest1' state.sls_id import_pool luks
zfstest1:
  Name: zfs_packages - Function: pkg.installed - Result: Clean Started: - 17:10:17.460617 Duration: 331.228 ms
  Name: zfs - Function: kmod.present - Result: Clean Started: - 17:10:17.792130 Duration: 8.72 ms
  Name: spl - Function: kmod.present - Result: Clean Started: - 17:10:17.801178 Duration: 8.243 ms
----------
          ID: import_pool
    Function: zpool.present
        Name: tank
      Result: True
     Comment: storage pool tank was imported
     Started: 17:10:17.809804
    Duration: 552.349 ms
     Changes:   
              ----------
              tank:
                  imported

Summary for zfstest1
------------
Succeeded: 4 (changed=1)
Failed:    0
------------
Total states run:     4
Total run time: 900.540 ms


-------------------------------------------
Summary
-------------------------------------------
# of minions targeted: 1
# of minions returned: 1
# of minions that did not return: 0
# of minions with errors: 0
-------------------------------------------
[root@salt /srv/salt]# salt 'zfstest1' state.sls_id import_pool luks
zfstest1:
  Name: zfs_packages - Function: pkg.installed - Result: Clean Started: - 17:10:25.151145 Duration: 360.86 ms
  Name: zfs - Function: kmod.present - Result: Clean Started: - 17:10:25.512308 Duration: 8.541 ms
  Name: spl - Function: kmod.present - Result: Clean Started: - 17:10:25.521207 Duration: 8.581 ms
----------
          ID: import_pool
    Function: zpool.present
        Name: tank
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1843, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1795, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/dist-packages/salt/states/zpool.py", line 199, in present
                  for prop in properties:
              TypeError: 'NoneType' object is not iterable
     Started: 17:10:25.530183
    Duration: 17.927 ms
     Changes:   

Summary for zfstest1
------------
Succeeded: 3
Failed:    1
------------
Total states run:     4
Total run time: 395.909 ms


-------------------------------------------
Summary
-------------------------------------------
# of minions targeted: 1
# of minions returned: 1
# of minions that did not return: 0
# of minions with errors: 1
-------------------------------------------
ERROR: Minions returned with non-zero exit code
[root@salt /srv/salt]# 
@sjorge

This comment has been minimized.

Contributor

sjorge commented Apr 21, 2018

I can replicate this on ubuntu 16.04... give me a few to fix.
While double checking all of the zpool module I found 2 other small changes

sjorge added a commit to sjorge/salt that referenced this issue Apr 21, 2018

@rallytime rallytime closed this in 675c646 May 9, 2018

rallytime added a commit to rallytime/salt that referenced this issue May 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment