zpool create: warn on suboptimal pool layout#14754
zpool create: warn on suboptimal pool layout#14754robn wants to merge 1 commit intoopenzfs:masterfrom
Conversation
|
Could I propose you change it from --force-layout to --force=layout, the better to extend it with more fine-grained force parameters later without requiring a sea of --force-a --force-b --force-c? Maybe I'm alone in that preference, though. :( edit: Might also be worth noting that raidz1 is not a mirror in the output, since a lot of people I've encountered who did this seemed to assume "raidz" meant 'ZFS magic raid of any kind". |
This would be nice since it finally provides a consist way to override a warnings by type. For example, creating a pool with different levels of parity among the top-level vdev needs to be forced. We've long wanted to be able to override just this warning and not all warnings. I'm not sure which I prefer, but |
|
Thanks for the feedback. I'm kind of indifferent to That helps with the test case too; I think I'll make it default to the |
35184ba to
f0a8059
Compare
|
Being able to pick and choose what -f overrides has been on my wish list since 2016. I am even kind of partial to the
so something like: and for import even, |
f0a8059 to
8e477cf
Compare
|
Alright, latest push sets up There's a new utility function, Tests will still fail because they try to make "suboptimal" pools in places. Probably I will just add The flag parsing and the suboptimal layout warning are of course unrelated, and I would ordinarily split something like this into two PRs, but just adding the utility function in its own PR without anything using it is kind of equally silly, so it stays here for now. Anyway, all comments welcome! |
8e477cf to
f5ead99
Compare
Its possible to create pools that are perfectly valid but are perhaps not the "best" choice for a given set of devices. An example is a raidz1 of two devices. I have seen inexperienced users create this because it looks on the surface like a traditional RAID-1, that is, a mirror. It even appears to work, but presents problems later when they want to upgrade the drives, and of course does not perform as well as a mirror. This changes `zpool create` to reject such "suboptimal" pool layouts, and suggest a possible better alternative. It checks for raidz and draid where the number of devices are parity+1, and could be extended in the future. It adds a switch, --force=layout, to disable the check and the warning and return the old behaviour, for those who know what they're doing. Included is a utility function to work with option flags. The existing -f switch to `zpool create` is now an alias for `--force=vdevs`. Signed-off-by: Rob Norris <robn@despairlabs.com>
f5ead99 to
82580a8
Compare
|
Rebased to master, no other changes. Note that I still want this. I'm getting around to lifting the "flagopts" code but I want to do something specific that uses it too. I've got an audit of all the |
Motivation and Context
Its possible to create pools that are perfectly valid but are perhaps not the "best" choice for a given set of hardware.
An example is a raidz1 of two devices. I have seen inexperienced users create this because it looks on the surface like a traditional RAID-1, that is, a mirror. It even appears to work, but presents problems later when they want to upgrade the drives, and of course does not perform as well as a mirror.
It seems to me that if we can guide users towards the "right" way to use ZFS without too much effort, we should try, and this is an attempt at that.
Description
This changes
zpool createto reject such "suboptimal" pool layouts, and suggest a possible better alternative. It adds a switch,--force-layout, to disable the check and the warning and return the old behaviour, for those who know what they're doing.Only the above example is checked for, but with the structure in place it'll be easy to add more as we like.
How Has This Been Tested?
New tests added for the new feature.
Many existing tests attempt to create raidz1 vdevs with two devices, and those are now failing. Its not hard to identify and fix them by adding
--force-layout, but that feels brittle. An alternative solution might be an environment variable to disable the checks (or maybe one of the test suite environment variables). Suggestions welcome.Types of changes
Checklist:
Signed-off-by.