Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 672128 - sys-fs/zfs-0.7.9: init script "zfs-import" has weird output for "status"
Summary: sys-fs/zfs-0.7.9: init script "zfs-import" has weird output for "status"
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sam James
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-28 02:50 UTC by David Klaftenegger
Modified: 2024-02-14 10:35 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Klaftenegger 2018-11-28 02:50:54 UTC
Hi,

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
config:

        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

NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
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 https://github.com/ansible/ansible/issues/50822 for the corresponding bug at ansible.