Don't complain about recv -x mountpoint on volumes

When a recursive send is performed that contains volumes (to backup a system that has VMs run from the main zpool, for example), the destination receive run with '-x mountpoint' will complain with "Warning: backup/path/to/volume: property 'mountpoint' does not apply to datasets of this type".

While this is of course true, the intent of '-x mountpoint' is still being met -- the received volume will not have its mountpoint property modified by the received stream. (The fact that it cannot be set on the volume is likely not of interest to the user running 'zfs send -R zroot@... | zfs recv -x mountpoint ...', and the noise of these warning messages distracts from any actual issues that may be reported.).

As the requested behavior isn't actually being overridden here (we're still not modifying 'mountpoint' based on the stream data), and the fact that this use case (backing up a system pool) was the original impetus for -o/-x in openzfs/zfs@a3eeab2 and therefore not unlikely to be encountered, I propose silencing these particular warnings.

Signed-off-by: Eric A. Borisch <eborisch@gmail.com>
This commit is contained in:
Eric A. Borisch 2022-08-15 17:04:54 -05:00
parent ca960ce56c
commit ba92d00cc7
1 changed files with 6 additions and 0 deletions

View File

@ -4218,6 +4218,12 @@ zfs_setup_cmdline_props(libzfs_handle_t *hdl, zfs_type_t type,
*/
if (!zfs_prop_valid_for_type(prop, type, B_FALSE) &&
!zfs_prop_user(name)) {
if (type == ZFS_TYPE_VOLUME &&
strncmp("mountpoint", name, 10) == 0) {
// Don't complain about '-x mountpoint'
// applied to a volume.
continue;
}
(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
"Warning: %s: property '%s' does not "
"apply to datasets of this type\n"),