mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Improve error message of zfs redact
We improve the error message of zfs redact by checking if the target snapshot exists, and if all the redaction snapshots exist. As a future improvement we could iterate over every snapshot provided and use that to determine which one specifically doesn't exist. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Paul Dagnelie <pcd@delphix.com> Closes #11426 Closes #14496
This commit is contained in:
parent
28251d81d7
commit
d9e64a4030
@ -3882,10 +3882,25 @@ zfs_do_redact(int argc, char **argv)
|
||||
switch (err) {
|
||||
case 0:
|
||||
break;
|
||||
case ENOENT:
|
||||
(void) fprintf(stderr,
|
||||
gettext("provided snapshot %s does not exist\n"), snap);
|
||||
case ENOENT: {
|
||||
zfs_handle_t *zhp = zfs_open(g_zfs, snap, ZFS_TYPE_SNAPSHOT);
|
||||
if (zhp == NULL) {
|
||||
(void) fprintf(stderr, gettext("provided snapshot %s "
|
||||
"does not exist\n"), snap);
|
||||
} else {
|
||||
zfs_close(zhp);
|
||||
}
|
||||
for (int i = 0; i < numrsnaps; i++) {
|
||||
zhp = zfs_open(g_zfs, rsnaps[i], ZFS_TYPE_SNAPSHOT);
|
||||
if (zhp == NULL) {
|
||||
(void) fprintf(stderr, gettext("provided "
|
||||
"snapshot %s does not exist\n"), rsnaps[i]);
|
||||
} else {
|
||||
zfs_close(zhp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EEXIST:
|
||||
(void) fprintf(stderr, gettext("specified redaction bookmark "
|
||||
"(%s) provided already exists\n"), bookname);
|
||||
|
Loading…
Reference in New Issue
Block a user