Add --no-preserve-encryption flag

* Add an option to send datasets with params or replicate
without preserving encryption
* Add a test case for the new functionality

Reviewed-by: Paul Dagnelie <paul.dagnelie@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Chris Jacobs <idefix2020dev@gmail.com>
Closes #18240
This commit is contained in:
Idefix2020
2026-03-06 00:08:17 +01:00
committed by GitHub
parent c329530e6b
commit 5dad9459d5
5 changed files with 62 additions and 22 deletions
+7 -3
View File
@@ -344,10 +344,10 @@ get_usage(zfs_help_t idx)
case HELP_ROLLBACK:
return (gettext("\trollback [-rRf] <snapshot>\n"));
case HELP_SEND:
return (gettext("\tsend [-DLPbcehnpsVvw] "
return (gettext("\tsend [-DLPbcehnpsUVvw] "
"[-i|-I snapshot]\n"
"\t [-R [-X dataset[,dataset]...]] <snapshot>\n"
"\tsend [-DnVvPLecw] [-i snapshot|bookmark] "
"\tsend [-DnVvPLecwU] [-i snapshot|bookmark] "
"<filesystem|volume|snapshot>\n"
"\tsend [-DnPpVvLec] [-i bookmark|snapshot] "
"--redact <bookmark> <snapshot>\n"
@@ -4753,11 +4753,12 @@ zfs_do_send(int argc, char **argv)
{"holds", no_argument, NULL, 'h'},
{"saved", no_argument, NULL, 'S'},
{"exclude", required_argument, NULL, 'X'},
{"no-preserve-encryption", no_argument, NULL, 'U'},
{0, 0, 0, 0}
};
/* check options */
while ((c = getopt_long(argc, argv, ":i:I:RsDpVvnPLeht:cwbd:SX:",
while ((c = getopt_long(argc, argv, ":i:I:RsDpVvnPLeht:cwbd:SX:U",
long_options, NULL)) != -1) {
switch (c) {
case 'X':
@@ -4843,6 +4844,9 @@ zfs_do_send(int argc, char **argv)
case 'S':
flags.saved = B_TRUE;
break;
case 'U':
flags.no_preserve_encryption = B_TRUE;
break;
case ':':
/*
* If a parameter was not passed, optopt contains the