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