import: add newname
property to rename pool on next import
#16874
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Renaming a pool is possible by providing an additional argument to
zpool import
. This assumes that the operator is able to comfortably export and re-import the pool, which is generally not the case for root/boot pools.Description
This adds a
newname
pseudo-property to the pool. If it exists at import time, it will be used to the name the pool. This allows the operator to set the new name ahead of the next export/import cycle (eg, before rebooting).The old method of renaming the pool is still available, and takes precedence over the property. The property itself is cleared on every successful import, regardless of the name used. This is justified as a policy of "most recent name wins", but really is just to avoid surprising renames when the property is left set and forgotten.
Because the value is needed during import, the property is stored on the label rather than in the props ZAP.
TODO
ZFS_IMPORT_VERBATIM
and make this work with it (this might be the FreeBSD answer to the above two)Demo: https://asciinema.org/a/Bg8SpYXDTSsekTdRB37dX1elO
Call for assistance: I probably won't take this further myself, at least not in the near future - it's just not a thing I need. If you're interested and are willing to do some of work to test and tell me how you think it should work (especially around the boot hookup), let me know!
How Has This Been Tested?
Prototype, so only light manual testing.
Types of changes
Checklist:
Signed-off-by
.