190130
From 9cbab9110523cfafe23d6c6b3080d0d744062b85 Mon Sep 17 00:00:00 2001
190130
From: Mohammed Rafi KC <rkavunga@redhat.com>
190130
Date: Thu, 21 May 2020 16:04:33 +0530
190130
Subject: [PATCH 440/449] glusterd/snapshot: Improve log message during
190130
 snapshot clone
190130
190130
While taking a snapshot clone, if the snapshot is not activated,
190130
the cli was returning that the bricks are down.
190130
This patch clearly print tha the error is due to the snapshot
190130
state.
190130
190130
>Change-Id: Ia840e6e071342e061ad38bf15e2e2ff2b0dacdfa
190130
>Fixes: #1255
190130
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
190130
Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/24478/
190130
190130
BUG: 1837926
190130
Change-Id: Ia840e6e071342e061ad38bf15e2e2ff2b0dacdfa
190130
Signed-off-by: Srijan Sivakumar <ssivakum@redhat.com>
190130
Reviewed-on: https://code.engineering.redhat.com/gerrit/202707
190130
Tested-by: RHGS Build Bot <nigelb@redhat.com>
190130
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
190130
---
190130
 xlators/mgmt/glusterd/src/glusterd-snapshot.c | 15 ++++++++++++---
190130
 1 file changed, 12 insertions(+), 3 deletions(-)
190130
190130
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
190130
index c56be91..5b8ae97 100644
190130
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
190130
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
190130
@@ -2238,7 +2238,6 @@ glusterd_snapshot_clone_prevalidate(dict_t *dict, char **op_errstr,
190130
     char *clonename = NULL;
190130
     char *snapname = NULL;
190130
     char device_name[64] = "";
190130
-    char key[PATH_MAX] = "";
190130
     glusterd_snap_t *snap = NULL;
190130
     char err_str[PATH_MAX] = "";
190130
     int ret = -1;
190130
@@ -2299,8 +2298,18 @@ glusterd_snapshot_clone_prevalidate(dict_t *dict, char **op_errstr,
190130
         goto out;
190130
     }
190130
 
190130
-    snprintf(key, sizeof(key) - 1, "vol1_volid");
190130
-    ret = dict_get_bin(dict, key, (void **)&snap_volid);
190130
+
190130
+    if (!glusterd_is_volume_started(snap_vol)) {
190130
+        snprintf(err_str, sizeof(err_str),
190130
+                 "Snapshot %s is "
190130
+                 "not activated",
190130
+                 snap->snapname);
190130
+        loglevel = GF_LOG_WARNING;
190130
+        *op_errno = EG_VOLSTP;
190130
+        goto out;
190130
+    }
190130
+
190130
+    ret = dict_get_bin(dict, "vol1_volid", (void **)&snap_volid);
190130
     if (ret) {
190130
         gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED,
190130
                "Unable to fetch snap_volid");
190130
-- 
190130
1.8.3.1
190130