Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 672128

Summary: sys-fs/zfs-0.7.9: init script "zfs-import" has weird output for "status"
Product: Gentoo Linux Reporter: David Klaftenegger <davidweb>
Component: Current packagesAssignee: Georgy Yakovlev <gyakovlev>
Status: CONFIRMED ---    
Severity: normal CC: gyakovlev, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

Description David Klaftenegger 2018-11-28 02:50:54 UTC

when scripting around in my system I discovered ansible's openrc module is not correctly discovering the status of zfs-import.
To check the current status of the service, ansible is looking for the string "started" in the output of

rc-service zfs-import status

The currently observed output is:

# rc-service zfs-import status
  pool: data
 state: ONLINE
  scan: none requested

        NAME        STATE     READ WRITE CKSUM
        data        ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            vda4    ONLINE       0     0     0
            vdb4    ONLINE       0     0     0

errors: No known data errors

data   286G   128K   286G         -     0%     0%  1.00x  ONLINE  -

The expected output is:

# rc-service zfs-import status
 * status: started

Note that I could cause weird interactions between what tools expect and the output by giving strange names to my zpools or block devices.

If this is not considered a bug, could you please explain how a tool should correctly check for service status with openrc, so I can file an appropriate bug with ansible?
Comment 1 Georgy Yakovlev archtester gentoo-dev 2019-01-09 06:51:14 UTC
generally you are right, expected output is just a status of the service.

zfs ebuild uses upstream provided zfs initscript (which I personally don't like) and it redefines status() function to return status of the zpools.

I'm not quite sure it's wise to check it that way, but if service if started there will be a symlink in /run/openrc/started

ls -la /run/openrc/started/zfs-import
lrwxrwxrwx 1 root root 22 Jan  8 22:17 /run/openrc/started/zfs-import -> /etc/init.d/zfs-import

but it's openrc-only and probably not portable.
Comment 2 David Klaftenegger 2019-01-16 17:33:41 UTC
see for the corresponding bug at ansible.