zfs
zfs copied to clipboard
Add support for zpool user properties
zpool set org.freebsd:comment="this is my pool" poolname
Signed-off-by: Allan Jude [email protected]
Motivation and Context
Allow users to create and set arbitrary pool properties, with the same syntax as dataset user properties (a user property is identified by the colon separator, and by convention is formatted org.name:propername)
Description
Allows to set and get user properties on the pool (district from dataset properties on the root dataset)
How Has This Been Tested?
Not very much
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:
- [ ] My code follows the OpenZFS code style requirements.
- [ ] I have updated the documentation accordingly.
- [x] I have read the contributing document.
- [ ] I have added tests to cover my changes.
- [ ] I have run the ZFS Test Suite with this change applied.
- [x] All commit messages are properly formatted and contain
Signed-off-by.
Error:
free(): invalid pointer Aborted
# zpool set org.linux:comment="test pool" test2
# zpool get all test2
--- skip
test2 compatibility off default
test2 org.linux:comment test pool local
test2 feature@async_destroy enabled local
--- skip
test2 feature@draid enabled local
test2 feature@compress_adaptive enabled local
free(): invalid pointer
Aborted
Error:
free(): invalid pointer Aborted
in zpool_expand_proplist() I had:
entry->pl_user_prop = propname;
But later in zprop_free_list() it would free pl_user_prop, which was the middle of the nvlist allocation. Solved by using zfs_strdup() to keep a separate copy of the property name.
Fixed style
Mateusz has written the first few tests for this, and cleaned things up.
The new tests are working correctly now
Hmm, I pushed the fixes to the https://github.com/allanjude/zfs/tree/zpool_user_props branch but GitHub does not seem to have propagated the changes to this PR... It should be pointing to https://github.com/allanjude/zfs/commit/cf2005833b3b377602dfbe91947cf257cd0627e7 now.
@0mp we're resolved the FreeBSD build failure. Can you rebase on the latest commits to master so we can verify this builds cleanly on FreeBSD.
@0mp we're resolved the FreeBSD build failure. Can you rebase on the latest commits to master so we can verify this builds cleanly on FreeBSD.
Rebased!
Sorry, it looks like this has some minor conflicts with the recently merged 3e4ed4213d7b4e8892e9def8b06363391d8dbd60. One last rebase is needed, then I'll get it merged.
Sorry, it looks like this has some minor conflicts with the recently merged 3e4ed42. One last rebase is needed, then I'll get it merged.
Hey Brian, I've resolved the conflict, rebased, and pushed the latest version. :)