summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/basic/uss.t1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/basic/uss.t b/tests/basic/uss.t
index 6cfc0303895..40e556e372e 100644
--- a/tests/basic/uss.t
+++ b/tests/basic/uss.t
@@ -52,6 +52,7 @@ TEST ln $M0/f1 $M0/dir/f3
TEST $CLI snapshot config activate-on-create enable
TEST $CLI volume set $V0 features.uss enable;
+TEST ! $CLI snapshot create snap1 $V0 no-timestamp description "";
TEST $CLI snapshot create snap1 $V0 no-timestamp;
for i in {11..20} ; do echo "file" > $M0/file$i ; done
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 99ec7d3afef..7adc3c87f77 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -2472,6 +2472,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
int64_t effective_max_limit = 0;
int flags = 0;
uint64_t opt_hard_max = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
+ char *description = NULL;
this = THIS;
GF_ASSERT (op_errstr);
@@ -2498,6 +2499,15 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
+ ret = dict_get_str (dict, "description", &description);
+ if (description && !(*description)) {
+ /* description should have a non-null value */
+ ret = -1;
+ snprintf (err_str, sizeof (err_str), "Snapshot cannot be "
+ "created with empty description");
+ goto out;
+ }
+
ret = dict_get_int32 (dict, "flags", &flags);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,