Skip to content

Commit

Permalink
Add "compatibility" property for zpool feature sets
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Colm Buckley <[email protected]>
Closes openzfs#11468
  • Loading branch information
colmbuckley authored Feb 18, 2021
1 parent 35ec517 commit 658fb80
Show file tree
Hide file tree
Showing 48 changed files with 5,493 additions and 2,826 deletions.
47 changes: 46 additions & 1 deletion cmd/zpool/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ include $(top_srcdir)/config/CppCheck.am
zpoolconfdir = $(sysconfdir)/zfs/zpool.d
zpoolexecdir = $(zfsexecdir)/zpool.d

EXTRA_DIST = zpool.d/README
EXTRA_DIST = zpool.d/README compatibility.d

dist_zpoolexec_SCRIPTS = \
zpool.d/dm-deps \
Expand Down Expand Up @@ -129,10 +129,55 @@ zpoolconfdefaults = \
test_progress \
test_ended

zpoolcompatdir = $(pkgdatadir)/compatibility.d

dist_zpoolcompat_DATA = \
compatibility.d/compat-2018 \
compatibility.d/compat-2019 \
compatibility.d/compat-2020 \
compatibility.d/compat-2021 \
compatibility.d/freebsd-11.0 \
compatibility.d/freebsd-11.2 \
compatibility.d/freebsd-11.3 \
compatibility.d/freenas-9.10.2 \
compatibility.d/grub2 \
compatibility.d/openzfsonosx-1.7.0 \
compatibility.d/openzfsonosx-1.8.1 \
compatibility.d/openzfsonosx-1.9.3 \
compatibility.d/openzfs-2.0-freebsd \
compatibility.d/openzfs-2.0-linux \
compatibility.d/zol-0.6.5 \
compatibility.d/zol-0.7 \
compatibility.d/zol-0.8

# canonical <- alias symbolic link pairs
# eg: "2018" is a link to "compat-2018"
zpoolcompatlinks = \
"compat-2018 2018" \
"compat-2019 2019" \
"compat-2020 2020" \
"compat-2021 2021" \
"freebsd-11.0 freebsd-11.1" \
"freebsd-11.0 freenas-11.0" \
"freebsd-11.2 freenas-11.2" \
"freebsd-11.3 freebsd-11.4" \
"freebsd-11.3 freebsd-12.0" \
"freebsd-11.3 freebsd-12.1" \
"freebsd-11.3 freebsd-12.2" \
"freebsd-11.3 freenas-11.3" \
"freenas-11.0 freenas-11.1" \
"openzfsonosx-1.9.3 openzfsonosx-1.9.4" \
"openzfs-2.0-freebsd truenas-12.0" \
"zol-0.7 ubuntu-18.04" \
"zol-0.8 ubuntu-20.04"

install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)"
for f in $(zpoolconfdefaults); do \
test -f "$(DESTDIR)$(zpoolconfdir)/$${f}" -o \
-L "$(DESTDIR)$(zpoolconfdir)/$${f}" || \
ln -s "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \
done
for l in $(zpoolcompatlinks); do \
(cd "$(DESTDIR)$(zpoolcompatdir)"; ln -s $${l} ); \
done
12 changes: 12 additions & 0 deletions cmd/zpool/compatibility.d/compat-2018
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Features supported by all Tier 1 platforms as of 2018
async_destroy
bookmarks
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
spacemap_histogram
15 changes: 15 additions & 0 deletions cmd/zpool/compatibility.d/compat-2019
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Features supported by all Tier 1 platforms as of 2019
async_destroy
bookmarks
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
sha512
skein
spacemap_histogram
15 changes: 15 additions & 0 deletions cmd/zpool/compatibility.d/compat-2020
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Features supported by all Tier 1 platforms as of 2020
async_destroy
bookmarks
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
sha512
skein
spacemap_histogram
19 changes: 19 additions & 0 deletions cmd/zpool/compatibility.d/compat-2021
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Features supported by all Tier 1 platforms as of 2021
async_destroy
bookmarks
device_removal
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
obsolete_counts
sha512
skein
spacemap_histogram
spacemap_v2
zpool_checkpoint
15 changes: 15 additions & 0 deletions cmd/zpool/compatibility.d/freebsd-11.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Features supported by FreeBSD 11.0
async_destroy
bookmarks
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
sha512
skein
spacemap_histogram
18 changes: 18 additions & 0 deletions cmd/zpool/compatibility.d/freebsd-11.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Features supported by FreeBSD 11.2
async_destroy
bookmarks
device_removal
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
obsolete_counts
sha512
skein
spacemap_histogram
zpool_checkpoint
19 changes: 19 additions & 0 deletions cmd/zpool/compatibility.d/freebsd-11.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Features supported by FreeBSD 11.3
async_destroy
bookmarks
device_removal
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
obsolete_counts
sha512
skein
spacemap_histogram
spacemap_v2
zpool_checkpoint
13 changes: 13 additions & 0 deletions cmd/zpool/compatibility.d/freenas-9.10.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Features supported by FreeNAS 9.10.2
async_destroy
bookmarks
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
spacemap_histogram
12 changes: 12 additions & 0 deletions cmd/zpool/compatibility.d/grub2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Features which are supported by GRUB2
async_destroy
bookmarks
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
spacemap_histogram
33 changes: 33 additions & 0 deletions cmd/zpool/compatibility.d/openzfs-2.0-freebsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Features supported by OpenZFS 2.0 on FreeBSD
allocation_classes
async_destroy
bookmark_v2
bookmark_written
bookmarks
device_rebuild
device_removal
embedded_data
empty_bpobj
enabled_txg
encryption
extensible_dataset
filesystem_limits
hole_birth
large_blocks
large_dnode
livelist
log_spacemap
lz4_compress
multi_vdev_crash_dump
obsolete_counts
project_quota
redacted_datasets
redaction_bookmarks
resilver_defer
sha512
skein
spacemap_histogram
spacemap_v2
userobj_accounting
zpool_checkpoint
zstd_compress
34 changes: 34 additions & 0 deletions cmd/zpool/compatibility.d/openzfs-2.0-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Features supported by OpenZFS 2.0 on Linux
allocation_classes
async_destroy
bookmark_v2
bookmark_written
bookmarks
device_rebuild
device_removal
edonr
embedded_data
empty_bpobj
enabled_txg
encryption
extensible_dataset
filesystem_limits
hole_birth
large_blocks
large_dnode
livelist
log_spacemap
lz4_compress
multi_vdev_crash_dump
obsolete_counts
project_quota
redacted_datasets
redaction_bookmarks
resilver_defer
sha512
skein
spacemap_histogram
spacemap_v2
userobj_accounting
zpool_checkpoint
zstd_compress
16 changes: 16 additions & 0 deletions cmd/zpool/compatibility.d/openzfsonosx-1.7.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Features supported by OpenZFSonOSX 1.7.0
async_destroy
bookmarks
edonr
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
sha512
skein
spacemap_histogram
21 changes: 21 additions & 0 deletions cmd/zpool/compatibility.d/openzfsonosx-1.8.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Features supported by OpenZFSonOSX 1.8.1
async_destroy
bookmarks
device_removal
edonr
embedded_data
empty_bpobj
enabled_txg
encryption
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
multi_vdev_crash_dump
obsolete_counts
sha512
skein
spacemap_histogram
spacemap_v2
zpool_checkpoint
27 changes: 27 additions & 0 deletions cmd/zpool/compatibility.d/openzfsonosx-1.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Features supported by OpenZFSonOSX 1.9.3
allocation_classes
async_destroy
bookmark_v2
bookmarks
device_removal
edonr
embedded_data
empty_bpobj
enabled_txg
encryption
extensible_dataset
filesystem_limits
hole_birth
large_blocks
large_dnode
lz4_compress
multi_vdev_crash_dump
obsolete_counts
project_quota
resilver_defer
sha512
skein
spacemap_histogram
spacemap_v2
userobj_accounting
zpool_checkpoint
12 changes: 12 additions & 0 deletions cmd/zpool/compatibility.d/zol-0.6.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Features supported by ZFSonLinux v0.6.5
async_destroy
bookmarks
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
lz4_compress
spacemap_histogram
18 changes: 18 additions & 0 deletions cmd/zpool/compatibility.d/zol-0.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Features supported by ZFSonLinux v0.7
async_destroy
bookmarks
edonr
embedded_data
empty_bpobj
enabled_txg
extensible_dataset
filesystem_limits
hole_birth
large_blocks
large_dnode
lz4_compress
multi_vdev_crash_dump
sha512
skein
spacemap_histogram
userobj_accounting
Loading

0 comments on commit 658fb80

Please sign in to comment.