zfs
zfs copied to clipboard
Add a diagnostic kstat for obtaining pool status
Motivation and Context
This PR is an updated version of previous https://github.com/openzfs/zfs/pull/16026
In the original PR, JSON was written into the buffer directly and nvlists were also converted to JSON, which was redundant.
Description
This PR creates an output nvlist and later nvlist is printed in JSON format to provided buffer. Spares and l2cache devices were also not showing up with previous https://github.com/openzfs/zfs/pull/16026. This is also fixed now.
How Has This Been Tested?
Manually tested in different pool configurations.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Performance enhancement (non-breaking change which improves efficiency)
- [ ] Code cleanup (non-breaking change which makes code smaller or more readable)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
- [ ] Documentation (a change to man pages or other documentation)
Checklist:
- [x] My code follows the OpenZFS code style requirements.
- [x] I have updated the documentation accordingly.
- [x] I have read the contributing document.
- [x] I have added tests to cover my changes.
- [x] I have run the ZFS Test Suite with this change applied.
- [x] All commit messages are properly formatted and contain
Signed-off-by.