Improve snapshot listing error message

Provide a hint in the error message if listing snapshots for a
single dataset fails.

Using -r is not needed to list all snapshots so requiring it when
listing snapshots for a single dataset makes it confusing. This
change will make the error message more clear.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Md Islam <mdnahian@outlook.com>
Closes #8047
This commit is contained in:
Md Islam 2018-10-30 12:47:50 -04:00 committed by Brian Behlendorf
parent 0a544c174d
commit 9042f6033a
1 changed files with 4 additions and 2 deletions

View File

@ -178,7 +178,8 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
if (type == ZFS_TYPE_SNAPSHOT && strchr(path, '@') == NULL) {
if (hdl != NULL)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"missing '@' delimiter in snapshot name"));
"missing '@' delimiter in snapshot name, "
"did you mean to use -r?"));
return (0);
}
@ -192,7 +193,8 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
if (type == ZFS_TYPE_BOOKMARK && strchr(path, '#') == NULL) {
if (hdl != NULL)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"missing '#' delimiter in bookmark name"));
"missing '#' delimiter in bookmark name, "
"did you mean to use -r?"));
return (0);
}