-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add "compatibility" property for zpool feature sets [2021 version] #11468
Conversation
It's possible that the BSD build failure is caused by fcntl macros being exposed by __BSD_VISIBLE and that |
For the moment, don't worry about the FreeBSD HEAD build failure. PR #11458 has been opened to address it. We're just waiting on an additional needed follow up fix before merging it. Sorry about the inconvenience. |
What's the preferred workflow for handling the CheckABI checks? Should this PR directly include a new |
We've only recently introduced the automatic ABI checks so we haven't really settled in to a usual workflow just yet. However, what we had in mind was that the author of the PR should:
Which aside from 3) it looks like you've already done, which is great. Then before we make a new release we can review all the ABI changes made to the master branch and bump the library versions numbers accordingly. |
Hah, embarrassingly I did take a stab at (3) already; but accidentally squashed the commit during a rebase. Will update the commit. |
I'll continue to rebase against upstream/master from time to time, but will only push to here if there's a conflict. When we come closer to a merge, I'll push a clean rebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! A few additional comments.
Since there were only changes to the libzfs
ABI there's no needed to update the other .abi
files. Let's drop the others from the PR. For future reference, you can run make storeabi
in each library directory to generate just that libraries .abi
file.
As part of this PR I think we should to provide a default feature file for each of last major OpenZFS releases (openzfs-0.7, openzfs-0.8, openzfs-2.0, openzfs-2.1). This would provide an easy way for many people to silence the zpool upgrade
notice by just setting the new features
property. For example, if you originally created your pool on v0.8 and never enabled any additional features (which is pretty common), you'd just need to run:
zpool set features=openzfs-0.8 tank
For reference, here are the features enabled for each version. Adding files for freebsd and grub would be handy as well and straight forward given the features table.
For consistency I'd suggest we create a cmd/zpool/features.d
directory in the source tree to add the files too. Then simply add and install them form the cmd/zpool/Makefile.am
. We already do something very similar for the zpool.d
directory. You'll also need to add the new files to the rpm packaging, see around line 473 in the rpm/generic/zfs.spec.in
file.
Lastly we're also going to need to add a few functional test cases for this to the ZFS test suite in the tests
directory. Here's what immediately comes to mind and where I'd suggest adding them. But feel free to add more.
- tests/zfs-tests/tests/functional/cli_root/zpool_create/ : Create a pool with a feature set and verify only those features are enabled
- tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/ : A new upgrade test which verifies that only the requested features in the feature set are enabled when upgrading.
- tests/zfs-tests/tests/functional/cli_user/zpool_status : Verify it only warns when features which should be enabled aren't, and probably when additional unexpected features are enabled.
Sorry in advance it's all written in ksh
but it's what was originally chosen way back when. But adding a new test case is easy and there are a lot of examples you can use as a template. Just add the new test file to the directory, and to that directory's Makefile.am
, and lastly to the tests/runfiles/common
file.
You can run a group out tests from the source tree with the zfs-tests.sh
script. For example, to run all the zpool_create
tests:
./scripts/zfs-tests.sh -T zpool_create
If you run in to any problems let me know, I'm happy to help point you in the right direction. Thanks again for working on this.
If this PR is going to include tables, most of the work figuring them out for popular distros and by year for the compat-20xx ones was done during the summit (see https://docs.google.com/spreadsheets/d/1MR0KGi1oGsvnHc63JoYoJlcJ5RczD5IRYi5y924nRig/edit#gid=1754896756 ). |
Good suggestion; I will get this done later this week.
Thank you; those seem like sensible tests to have. That might take a little longer, but should be able to get to it at the weekend.
My pleasure! It's been good exercise for me! |
Thanks Eric; I can work with that sheet. |
The overall design seems good, my only concern with the user interface so far is when compositing features. If you didn't read the manpage carefully and saw something like But really it means (and should mean) “I want my pool to be compatible with 2019 AND freebsd 8”. So I wonder if a different name for the property like Assuming we change the property name to |
man/man8/zpoolprops.8
Outdated
@@ -323,6 +324,53 @@ to the enabled state. | |||
See | |||
.Xr zpool-features 5 | |||
for details on feature states. | |||
.It Sy features Ns = Ns Ar none | all | file Bq , Ns Ar file Ns ... | |||
Specifies a set of requested features for this pool. When set to | |||
.Sy all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we have some feature-files in the PR, we should probably talk about what they are here, and our philosophy around what the different feature sets (compatibility sets) are. Unless we want to do that in zpool-features.5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the most recent commit for an attempt at an initial set of feature/compatiblity files (nb: they are not yet installed by the Makefiles). Broadly, I've tried to include a minimal set of "base" feature sets, with sensible aliases handled by symlinks (eg: freenas-11.3 -> freebsd-11.3, compat-2018 -> zol-0.6.5). This is based from the spreadsheet provided above by @ericloewe - Eric, do you have an opinion on what the explanatory text might look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good practice to mention that compatibility files exist, but leave the long-form details to zpool-features.5, where the details of how feature flags operate are already described.
I'm thinking we can keep most of this change, but move the example file off to zpool-features.5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that having a "Compatibility feature sets" subsection in zpool-features is the best way to handle this. I've started this but am stumbling on mdoc syntax. Will hammer some more on it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL; moved the bulk of the discussion from zpoolprops(8)
to zpool-features(5)
- and reformatted from mdoc to groffman. Updated zpool-create(8)
and zpoolprops(8)
to reference the new section.
I like this suggestion; would anyone else like to weigh in? It seems to be a clearer name for what the feature actually does. |
Thinking about how configuration files tend to be managed on modern Linux distributions, I see a pattern of putting distribution-managed files under Any thoughts on adopting a similar pattern here - ie: looking first for Related; are these configuration root directories managed anywhere in our Makefile system? I wouldn't like to hardcode them. |
That seems good to me, except that it should be the same subdir in both places, so /usr/lib/zfs not /usr/lib/zfs-linux.
The standard autoconf names for /etc and /usr/lib are sysconfdir and libdir. |
There's a subtle difference between
My suggestion - change |
Hmm. On Debian, seems that we set zfsexecdir to |
Having two locations makes sense to me, and I agree with @rlaager that we want the subdir name to the be same if possible. But I'm not sure https://www.gnu.org/prep/standards/html_node/Directory-Variables.html The easiest route would be to put them under |
What's the use case for having a feature-flag enabled pool but
This would also be the default, right? Any thoughts on |
I agree that |
I like As for |
Solaris compatibility would also require version=28. I suppose there is an upgrade nag in that case, too? I’m not sure if we should try to support that with |
There's virtually no code-complexity cost to having the "none" option (it's four lines of code); and I can see some value in having a simple option to inhibit upgrades and silence nagging from Maybe |
Yes, it's just the name. I'm fine with the described behavior and your originally suggested name, @rlaager good point, it's probably best to not conflate this with pool version numbers. |
I agree we need to have a value of If we want a value of |
Rather than conditionally compiling out the edonr code for FreeBSD update zfs_mod_supported_feature() to indicate this feature is unsupported. This ensures that all spa features are defined on every platform, even if they are not supported. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue openzfs#11468
It might take a little bit to iterate on those changes. The initial version of this PR I pushed was a little too ambitious, I've cut it down to just what we need for this change and so far it's looking much better. Since it's a standalone change I think once it passes the CI and the FreeBSD guys are okay with it we can merge it, then rebase this PR on top if to resolve that test failure. If you want to pull in to this PR sooner to verify that it does fix the test that'd fine with me. As a slight aside, since all enforcement of which features can be enabled is happening at the kernel level I don't think it's absolutely critical that we do these checks for valid feature names in the
Agreed! |
Rather than conditionally compiling out the edonr code for FreeBSD update zfs_mod_supported_feature() to indicate this feature is unsupported. This ensures that all spa features are defined on every platform, even if they are not supported. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue openzfs#11468
@colmbuckley can you also |
Done. Let's see how the tests go now. |
Thinking about something like the following functionality:
In all cases, print a warning but allow the user to proceed. I think this can be achieved in a relatively straightforward fashion without getting in to complicated propagation of errors up and down, and without any ABI changes apart from a new status enum. Due to timing and my availability to work on it, I still think we should decouple this from the current PR. |
The test failures don't seem relevant to the changes in this PR, with the possible exception of FreeBSD's I'll revert the edonr changes here, assuming you're going to merge them upstream at some point, then I'll rebase. At that point, I think/hope we're good. |
... I think that this one should maybe be an error as opposed to a warning, as it would be an irreversible change which is contrary to the intention of the |
Failing tests from earlier: |
Agreed, the error can tell the user to combine compat files and achieve the desired effect without negating some of the administrative benefits of having the compat option. |
I think it's entirely reasonable for distros (especially LTS ones) to not update ZFS with support for new feature flags, but still provide updated compat files. (e.g. Ubuntu 22.04 is going to see support until 2027+). It's not unreasonable to end up with files that have unsupported features, let's imagine that in compat-2023 adds support for feature@compress-zstd, which the system supports, and feature@bpr, which the system does not yet support. There are two aspects to this:
My suggestion is to either warn the user that feature@bpr is unknown and was not enabled or error out and allow the user to force the known features to be enabled (e.g. --ignore-unknown-features). |
Ok, I think the best compromise here would be to weaken the "badword" detection in
Something like
Fair point.
The problem with a flag is that this logic would invoked in several different places; Do you want this PR to be held until this is resolved, or are you ok to proceed and fix afterwards? I think it won't be an issue until we get new features post-2.1. |
I double checked all the failures and they're ones we've seen sporadically before and are unrelated From my perspective this is ready to be merged. As for relaxing the badword detection, I think converting those errors in to warnings sounds like a reasonable solution to me. I agree that adding a flag might get a bit awkward in the existing code. I don't have any objection to making the change to a warning after this is merged. |
Rather than conditionally compiling out the edonr code for FreeBSD update zfs_mod_supported_feature() to indicate this feature is unsupported. This ensures that all spa features are defined on every platform, even if they are not supported. Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #11605 Issue #11468
I'll rebase on master now and clean up the commit message.
I'll work on this and the enhancement you suggested about warnings/errors when features are enabled outside the current compatibility set, when I next get a block of time (most likely in a few weeks). In the event that new features are added between now and then, I hope we can be sensibly reactive... |
Property to allow sets of features to be specified; for compatibility with specific versions / releases / external systems. Influences the behavior of 'zpool upgrade' and 'zpool create'. Initial man page changes and test cases included. Brief synopsis: zpool create -o compatibility=off|legacy|file[,file...] pool vdev... compatibility = off : disable compatibility mode (enable all features) compatibility = legacy : request that no features be enabled compatibility = file[,file...] : read features from specified files. Only features present in *all* files will be enabled on the resulting pool. Filenames may be absolute, or relative to /etc/zfs/compatibility.d or /usr/share/zfs/compatibility.d (/etc checked first). Only affects zpool create, zpool upgrade and zpool status. ABI changes in libzfs: * New function "zpool_load_compat" to load and parse compat sets. * Add "zpool_compat_status_t" typedef for compatibility parse status. * Add ZPOOL_PROP_COMPATIBILITY to the pool properties enum * Add ZPOOL_STATUS_COMPATIBILITY_ERR to the pool status enum An initial set of base compatibility sets are included in cmd/zpool/compatibility.d, and the Makefile for cmd/zpool is modified to install these in $pkgdatadir/compatibility.d and to create symbolic links to a reasonable set of aliases. Thanks: behlendorf Thanks: ericloewe Thanks: rlaager Thanks: ahrens Signed-off-by: Colm Buckley <colm@tuatha.org>
Rather than conditionally compiling out the edonr code for FreeBSD update zfs_mod_supported_feature() to indicate this feature is unsupported. This ensures that all spa features are defined on every platform, even if they are not supported. Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#11605 Issue openzfs#11468
Property to allow sets of features to be specified; for compatibility with specific versions / releases / external systems. Influences the behavior of 'zpool upgrade' and 'zpool create'. Initial man page changes and test cases included. Brief synopsis: zpool create -o compatibility=off|legacy|file[,file...] pool vdev... compatibility = off : disable compatibility mode (enable all features) compatibility = legacy : request that no features be enabled compatibility = file[,file...] : read features from specified files. Only features present in *all* files will be enabled on the resulting pool. Filenames may be absolute, or relative to /etc/zfs/compatibility.d or /usr/share/zfs/compatibility.d (/etc checked first). Only affects zpool create, zpool upgrade and zpool status. ABI changes in libzfs: * New function "zpool_load_compat" to load and parse compat sets. * Add "zpool_compat_status_t" typedef for compatibility parse status. * Add ZPOOL_PROP_COMPATIBILITY to the pool properties enum * Add ZPOOL_STATUS_COMPATIBILITY_ERR to the pool status enum An initial set of base compatibility sets are included in cmd/zpool/compatibility.d, and the Makefile for cmd/zpool is modified to install these in $pkgdatadir/compatibility.d and to create symbolic links to a reasonable set of aliases. Reviewed-by: ericloewe Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Colm Buckley <colm@tuatha.org> Closes openzfs#11468
Rather than conditionally compiling out the edonr code for FreeBSD update zfs_mod_supported_feature() to indicate this feature is unsupported. This ensures that all spa features are defined on every platform, even if they are not supported. Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#11605 Issue openzfs#11468
Property to allow sets of features to be specified; for compatibility with specific versions / releases / external systems. Influences the behavior of 'zpool upgrade' and 'zpool create'. Initial man page changes and test cases included. Brief synopsis: zpool create -o compatibility=off|legacy|file[,file...] pool vdev... compatibility = off : disable compatibility mode (enable all features) compatibility = legacy : request that no features be enabled compatibility = file[,file...] : read features from specified files. Only features present in *all* files will be enabled on the resulting pool. Filenames may be absolute, or relative to /etc/zfs/compatibility.d or /usr/share/zfs/compatibility.d (/etc checked first). Only affects zpool create, zpool upgrade and zpool status. ABI changes in libzfs: * New function "zpool_load_compat" to load and parse compat sets. * Add "zpool_compat_status_t" typedef for compatibility parse status. * Add ZPOOL_PROP_COMPATIBILITY to the pool properties enum * Add ZPOOL_STATUS_COMPATIBILITY_ERR to the pool status enum An initial set of base compatibility sets are included in cmd/zpool/compatibility.d, and the Makefile for cmd/zpool is modified to install these in $pkgdatadir/compatibility.d and to create symbolic links to a reasonable set of aliases. Reviewed-by: ericloewe Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Colm Buckley <colm@tuatha.org> Closes openzfs#11468
remove old migration code, it was needed for migration from 0.6x versions. make grub section conditional and mention new compat filag zpool create -o compatibility=grub2 ... openzfs/zfs#11468 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Dear everyone who's reading this from the 2.1.0 announcement mail - please see also #11861 which improves the behavior of this property in some (hopefully) useful ways, resolving the open questions from above. Enjoy! |
Thanks for pointing that out! I went ahead and added a link to #11861 in the GitHub release notes. |
These have been added in 2.1.0 in openzfs/zfs#11468 and refined in openzfs/zfs#11861.
remove old migration code, it was needed for migration from 0.6x versions. make grub section conditional and mention new compat filag zpool create -o compatibility=grub2 ... openzfs/zfs#11468 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Property to allow sets of features to be specified; for compatibility with specific versions / releases / external systems.
Influences the behavior of 'zpool upgrade' and 'zpool create'.
Initial man page changes included.
Brief synopsis:
zpool create -o compatibility=off|legacy|file[,file...] pool vdev...
compatibility = off
: disable compatibility mode (enable all features)compatibility = legacy
: request that no features be enabledcompatibility = file[,file...]
: read features from the specified files.Only features present in all files will be enabled on the resulting pool. Filenames may be absolute, or relative to
/etc/zfs/compatibility.d
or/usr/share/zfs/compatibility.d
(/etc
checked first).Only affects
zpool create
,zpool upgrade
andzpool status
.ABI changes in libzfs:
zpool_load_compat
to load and parse compatibility sets.zpool_compat_status_t
typedef for compatibility parse status.ZPOOL_PROP_COMPATIBILITY
to the pool properties enumZPOOL_STATUS_COMPATIBILITY_ERR
to the pool status enumAn initial set of base compatibility sets are included in
cmd/zpool/compatibility.d
; theMakefile.am
forcmd/zpool
is modified to install these in$pkgdatadir/compatibility.d
and to create symbolic links to a reasonable set of aliases.Signed-off-by: Colm Buckley colm@tuatha.org
Motivation and Context
(See previous PR for discussion and further context. I needed to recreate the git branch from scratch; this branch is a clean patch against head as of 2021-02-08.)
With the advent of zpool features, it is sometimes desirable to specify 'sets' of features to be applied to a zpool - for example, "all features supported by the current version of grub" and to limit the features applied by (eg)
zpool create
orzpool upgrade
to not inadvertently enable unwanted features (in the case of grub incompatibility, this might result in an unbootable system).Ubuntu have addressed this by hard-coding the pool name
bpool
to be immune tozpool upgrade
and suppressing the warning about disabled features inzpool status
when this pool name is encountered. Obviously, this is a very limited way of solving the problem.After a discussion with @rlaager on the Debian ZFS package maintainers mailing list, I became aware of the "default features" proposal discussed at the OpenZFS leadership team meeting of 2019-03-26. This PR is an attempt to implement the necessary functionality.
Description
An on-disk zpool property "compatibility" is added, with the enum value
ZPOOL_PROP_COMPATIBILITY
.This property may be unset, take one of the special values
off
orlegacy
, or be set to a comma-separated list of "feature set" names.Feature set names refer to files in the current filesystem, either absolute pathnames, or relative to
/etc/zfs/compatibility.d
or/usr/share/zfs/compatibility.d
If the referenced file exists, desired features are loaded from it; it is expected to contain the user-facing feature names, whitespace or comma-separated. Comments are allowed. If multiple set names are supplied, only features present in all sets are included in the final set.
If a valid feature set is read,
zpool create
modifies its behavior to only apply features present in the set. (the-d
flag inhibits automatic feature creation as usual), andzpool upgrade
modifies its behavior likewise.zpool status
will not print warnings about disabled features unless they are present in the set. The intention is that, when a feature set is specified, only those features are considered to be "all features" for thezpool
command.Example:
How Has This Been Tested?
This only affects the operation of the command-line
zpool create
,zpool upgrade
andzpool status
commands (with a smaller influence onzpool import
). I created various pools with suitable combinations of the-d
flag, the-o compatibility
property, features files containing valid and invalid feature names, and verified that correct behavior resulted in all cases. Similarly, the behavior ofzpool upgrade
was observed to work as designed.Tests in the zfs-test suite are work in progress.
Types of changes
Checklist:
Signed-off-by
.