summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijaikumar M <vmallika@redhat.com>2014-07-15 13:49:41 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-07-30 02:39:37 -0700
commit9f41712d060a71259e4970b9c8b32771a6d1f2c7 (patch)
tree1acc688a52c20de33d904c50b650d2e9b426334d
parent8732ee5319bfe4649473c29458a6ab65b73d5516 (diff)
glusterd: Error msg for snapshot status for no existing snaps
should be aligned with error messages of info and list When a snapshot operation like status, info, list performed on a non-existing snapshot. For Status error message is displayed as 'Snap not found' For List and Info error message is displayed as 'Snapshot does not exist' Have the consistant error message all the places Change-Id: I7b241217dba62fda844481731a6858e4ecb12897 BUG: 1119641 Signed-off-by: Vijaikumar M <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/8309 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c77
1 files changed, 42 insertions, 35 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 6fa4506b18a..bde9aeb3fe3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -733,7 +733,7 @@ glusterd_snapshot_restore (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
snap = glusterd_find_snap_by_name (snapname);
if (NULL == snap) {
- ret = gf_asprintf (op_errstr, "Snap (%s) not found",
+ ret = gf_asprintf (op_errstr, "Snapshot (%s) does not exist",
snapname);
if (ret < 0) {
goto out;
@@ -871,7 +871,7 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
snap = glusterd_find_snap_by_name (snapname);
if (NULL == snap) {
- ret = gf_asprintf (op_errstr, "Snap (%s) not found",
+ ret = gf_asprintf (op_errstr, "Snapshot (%s) does not exist",
snapname);
if (ret < 0) {
goto out;
@@ -884,7 +884,7 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
snap_restored = snap->snap_restored;
if (snap_restored) {
- ret = gf_asprintf (op_errstr, "Snap (%s) is already "
+ ret = gf_asprintf (op_errstr, "Snapshot (%s) is already "
"restored", snapname);
if (ret < 0) {
goto out;
@@ -921,8 +921,8 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- ret = gf_asprintf (op_errstr, "Volume (%s) not found",
- volname);
+ ret = gf_asprintf (op_errstr, "Volume (%s) "
+ "does not exist", volname);
if (ret < 0) {
goto out;
}
@@ -1139,7 +1139,7 @@ glusterd_snapshot_config_prevalidate (dict_t *dict, char **op_errstr)
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
snprintf (err_str, sizeof (err_str),
- "Volume %s does not exist.", volname);
+ "Volume (%s) does not exist.", volname);
goto out;
}
}
@@ -1753,8 +1753,8 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
if (glusterd_find_snap_by_name (snapname)) {
ret = -1;
- snprintf (err_str, sizeof (err_str), "Snap %s already exists",
- snapname);
+ snprintf (err_str, sizeof (err_str), "Snapshot %s already "
+ "exists", snapname);
goto out;
}
@@ -2033,7 +2033,7 @@ glusterd_list_add_snapvol (glusterd_volinfo_t *origin_vol,
}
UNLOCK (&origin_vol->lock);
- gf_log (THIS->name, GF_LOG_DEBUG, "Snap %s added to the list",
+ gf_log (THIS->name, GF_LOG_DEBUG, "Snapshot %s added to the list",
snap->snapname);
ret = 0;
out:
@@ -3072,7 +3072,8 @@ glusterd_handle_snapshot_info (rpcsvc_request_t *req, glusterd_op_t op,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
snprintf (err_str, len,
- "Snap (%s) does not exist", snapname);
+ "Snapshot (%s) does not exist",
+ snapname);
gf_log (this->name, GF_LOG_ERROR,
"%s", err_str);
ret = -1;
@@ -3522,7 +3523,8 @@ glusterd_handle_snapshot_restore (rpcsvc_request_t *req, glusterd_op_t op,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- snprintf (err_str, len, "Snap (%s) does not exist", snapname);
+ snprintf (err_str, len, "Snapshot (%s) does not exist",
+ snapname);
gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
ret = -1;
goto out;
@@ -3648,7 +3650,7 @@ glusterd_create_snap_object (dict_t *dict, dict_t *rsp_dict)
snap->description = gf_strdup (description);
if (snap->description == NULL) {
gf_log (this->name, GF_LOG_ERROR,
- "Saving the Snap Description Failed");
+ "Saving the Snapshot Description Failed");
ret = -1;
goto out;
}
@@ -3664,7 +3666,7 @@ glusterd_create_snap_object (dict_t *dict, dict_t *rsp_dict)
list_add_order (&snap->snap_list, &priv->snapshots,
glusterd_compare_snap_time);
- gf_log (this->name, GF_LOG_TRACE, "Snap %s added to the list",
+ gf_log (this->name, GF_LOG_TRACE, "Snapshot %s added to the list",
snap->snapname);
ret = 0;
@@ -4479,8 +4481,8 @@ glusterd_snapshot_activate_deactivate_prevalidate (dict_t *dict,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- snprintf (err_str, sizeof (err_str), "Snap %s does not exist.",
- snapname);
+ snprintf (err_str, sizeof (err_str), "Snapshot (%s) does not "
+ "exist.", snapname);
ret = -1;
goto out;
}
@@ -4523,12 +4525,13 @@ glusterd_snapshot_activate_deactivate_prevalidate (dict_t *dict,
* back the brick processes that are down*/
if (!(flags & GF_CLI_FLAG_OP_FORCE)) {
snprintf (err_str, sizeof (err_str),
- "Snap %s is already activated.", snapname);
+ "Snapshot %s is already activated.",
+ snapname);
ret = -1;
}
} else {
snprintf (err_str, sizeof (err_str),
- "Snap %s is already deactivated.", snapname);
+ "Snapshot %s is already deactivated.", snapname);
ret = -1;
}
goto out;
@@ -4666,7 +4669,8 @@ glusterd_handle_snapshot_delete_type_snap (rpcsvc_request_t *req,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- snprintf (err_str, len, "Snap (%s) does not exist", snapname);
+ snprintf (err_str, len, "Snapshot (%s) does not exist",
+ snapname);
gf_log (this->name, GF_LOG_ERROR,
"%s", err_str);
ret = -1;
@@ -4820,8 +4824,8 @@ glusterd_snapshot_remove_prevalidate (dict_t *dict, char **op_errstr,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- gf_log (this->name, GF_LOG_ERROR, "Snap %s does not exist",
- snapname);
+ gf_log (this->name, GF_LOG_ERROR,
+ "Snapshot (%s) does not exist", snapname);
ret = -1;
goto out;
}
@@ -4885,14 +4889,15 @@ glusterd_snapshot_status_prevalidate (dict_t *dict, char **op_errstr,
}
if (!glusterd_find_snap_by_name (snapname)) {
- ret = gf_asprintf (op_errstr, "Snap (%s) "
- "not found", snapname);
+ ret = gf_asprintf (op_errstr, "Snapshot (%s) "
+ "does not exist", snapname);
if (ret < 0) {
goto out;
}
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Snap (%s) "
- "not found", snapname);
+ gf_log (this->name, GF_LOG_ERROR,
+ "Snapshot (%s) does not exist",
+ snapname);
goto out;
}
break;
@@ -4909,7 +4914,7 @@ glusterd_snapshot_status_prevalidate (dict_t *dict, char **op_errstr,
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
ret = gf_asprintf (op_errstr, "Volume (%s) "
- "not found", volname);
+ "does not exist", volname);
if (ret < 0) {
goto out;
}
@@ -4970,8 +4975,8 @@ glusterd_snapshot_activate_commit (dict_t *dict, char **op_errstr,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- gf_log (this->name, GF_LOG_ERROR, "Snap %s does not exist",
- snapname);
+ gf_log (this->name, GF_LOG_ERROR,
+ "Snapshot (%s) does not exist", snapname);
ret = -1;
goto out;
}
@@ -5041,8 +5046,8 @@ glusterd_snapshot_deactivate_commit (dict_t *dict, char **op_errstr,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- gf_log (this->name, GF_LOG_ERROR, "Snap %s does not exist",
- snapname);
+ gf_log (this->name, GF_LOG_ERROR,
+ "Snapshot (%s) does not exist", snapname);
ret = -1;
goto out;
}
@@ -5115,8 +5120,8 @@ glusterd_snapshot_remove_commit (dict_t *dict, char **op_errstr,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- gf_log (this->name, GF_LOG_ERROR, "Snap %s does not exist",
- snapname);
+ gf_log (this->name, GF_LOG_ERROR,
+ "Snapshot (%s) does not exist", snapname);
ret = -1;
goto out;
}
@@ -5229,7 +5234,8 @@ glusterd_do_snap_cleanup (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
*/
snap = glusterd_find_snap_by_name (name);
if (!snap) {
- gf_log (this->name, GF_LOG_INFO, "snap %s is not found", name);
+ gf_log (this->name, GF_LOG_INFO, "Snapshot (%s) does not exist",
+ name);
ret = 0;
goto out;
}
@@ -6470,8 +6476,8 @@ glusterd_snapshot_status_commit (dict_t *dict, char **op_errstr,
snap = glusterd_find_snap_by_name (snapname);
if (!snap) {
- ret = gf_asprintf (op_errstr, "Snap (%s) "
- "not found", snapname);
+ ret = gf_asprintf (op_errstr, "Snapshot (%s) "
+ "does not exist", snapname);
if (ret < 0) {
goto out;
}
@@ -7271,7 +7277,8 @@ glusterd_snapshot_restore_postop (dict_t *dict, int32_t op_ret,
snap = glusterd_find_snap_by_name (name);
if (!snap) {
- gf_log (this->name, GF_LOG_ERROR, "snap %s is not found", name);
+ gf_log (this->name, GF_LOG_ERROR,
+ "Snapshot (%s) does not exist", name);
ret = -1;
goto out;
}