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