Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import: add newname property to rename pool on next import #16874

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robn
Copy link
Member

@robn robn commented Dec 15, 2024

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

  • Consider where this is applied; might be better done entirely inside the module rather than in zpool/libzfs, because it changes the call sequence required a little.
  • To that end, need to find what alternate pool-importing code does and expects (bootloaders etc)
  • Understand ZFS_IMPORT_VERBATIM and make this work with it (this might be the FreeBSD answer to the above two)
  • General concept and design review.

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

  • Bug fix (non-breaking change which fixes an issue)
  • 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:

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.

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:

- Consider where this is applied; might be better done entrely inside
  the module rather than in zpool/libzfs, because it changes the call
  sequence required a little.

- To that end, need to find what alternate pool-importing code does and
  expects (bootloaders etc)

- Understand ZFS_IMPORT_VERBATIM and make this work with it (which is
  possible the FreeBSD answer to the above two)

- General concept and design review.

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <[email protected]>
@robn robn marked this pull request as draft December 15, 2024 21:19
@github-actions github-actions bot added the Status: Work in Progress Not yet ready for general review label Dec 15, 2024
@amotin
Copy link
Member

amotin commented Dec 16, 2024

Sounds like an interesting functionality, but I worry what side effects it might have. For example, what can be its inter-operation with bootfs property, since boot pool is likely is the most difficult case to rename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Work in Progress Not yet ready for general review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants