On 09/19/2016 07:21 AM, Guilhem Moulin wrote: > On Mon, 19 Sep 2016 at 06:39:35 -0500, Richard Laager wrote: >> On 09/19/2016 04:48 AM, Guilhem Moulin wrote: >>> On Mon, 19 Sep 2016 at 00:51:45 -0500, Richard Laager wrote: >>>> On 09/18/2016 02:13 PM, Guilhem Moulin wrote: >>> Alright, thanks! I think a more robust AWK or sed script is desired to >>> strip out the header, though. Perhaps this AWK script >> >> That awk script doesn't output anything for me. > > Interesting, worksformeâ„¢ both with gawk(1) and mawk(1). Perhaps an > issue with TAB vs spaces? Could you redirect the output of `zfs status > -P $pool` to a file and attach that file instead of copy-paste the > output?
I'm using mawk. File attached. I'm intentionally trying to keep the parser as simple as possible. I don't want to introduce bugs by being "too clever". Upstream changes to the `zpool status` output are likely to be weighed and tested very carefully. >>> Again, I'm not fond of your `zfs list` command because it's an >>> FS-specific alternative for two FS-agnostic and de facto standard >>> solutions, namely fstab(5) and kernel parameters. >> >> I've attached another version of this patch. It first swaps from >> /etc/fstab to /proc/self/mounts. Then adding ZFS support is trivial and >> integrates in the same way as btrfs support. > > Hmm, swapping /etc/fstab for /proc/self/mounts seems like a major > change, with potential undesired consequences. Up to now the device > associated to a given mountpoint was the one found in fstab(5), which is > not necessarily the one currently mounted. That's why I didn't do this originally. Changing to /proc/self/mounts is a simpler/clearer, but more significant/riskier code change. If you want to maintain the semantics of "what is configured" rather than "what is mounted", then the only way to support ZFS is to call `zfs list`. That is how you find out "what is configured" in ZFS. -- Richard
pool: yakkety state: ONLINE status: Some supported features are not enabled on the pool. The pool can still be used, but some features are unavailable. action: Enable all features using 'zpool upgrade'. Once this is done, the pool may no longer be accessible by software that does not support the features. See zpool-features(5) for details. scan: none requested config: NAME STATE READ WRITE CKSUM yakkety ONLINE 0 0 0 /dev/mapper/luks1 ONLINE 0 0 0 errors: No known data errors
signature.asc
Description: OpenPGP digital signature