summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2013-12-24 09:24:42 +0530
committerSachin Pandit <spandit@redhat.com>2014-01-15 08:40:50 +0530
commit9e3459ccf35ac62004e4d8e15e25d1ed264f8904 (patch)
treebf834bd5b8f5f2109a9e2a8fa638ca3c03dbfc9f /xlators/mgmt/glusterd/src/glusterd-utils.c
parentc7cab23472b1d59958a0f39bdaf7776e09f039e4 (diff)
mgmt/glusterd : Having a separate list for snapshots.
Creating a separate list for snaps taken, as cluttering snaps in the volume list does not look neat. Change-Id: Ida4a183e95e8694b85ebb5a680d06b7d29a460a0 BUG: 1040947 Signed-off-by: Sachin Pandit <spandit@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index dedfd890f..d223fabb3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1155,7 +1155,6 @@ glusterd_volinfo_find (char *volname, glusterd_volinfo_t **volinfo)
glusterd_conf_t *priv = NULL;
GF_ASSERT (volname);
-
this = THIS;
GF_ASSERT (this);
@@ -1164,7 +1163,38 @@ glusterd_volinfo_find (char *volname, glusterd_volinfo_t **volinfo)
list_for_each_entry (tmp_volinfo, &priv->volumes, vol_list) {
if (!strcmp (tmp_volinfo->volname, volname)) {
- gf_log (this->name, GF_LOG_DEBUG, "Volume %s found", volname);
+ gf_log (this->name, GF_LOG_DEBUG, "Volume %s found",
+ volname);
+ ret = 0;
+ *volinfo = tmp_volinfo;
+ break;
+ }
+ }
+
+ gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+}
+
+int32_t
+glusterd_snap_volinfo_find (char *volname, glusterd_volinfo_t **volinfo)
+{
+ glusterd_volinfo_t *tmp_volinfo = NULL;
+ int32_t ret = -1;
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+
+ GF_ASSERT (volname);
+ gf_log ("", GF_LOG_DEBUG, "Snap Volname = %s", volname);
+ this = THIS;
+ GF_ASSERT (this);
+
+ priv = this->private;
+ GF_ASSERT (priv);
+
+ list_for_each_entry (tmp_volinfo, &priv->snap_list, vol_list) {
+ if (!strcmp (tmp_volinfo->volname, volname)) {
+ gf_log (this->name, GF_LOG_DEBUG, "Snap Volume %s found",
+ volname);
ret = 0;
*volinfo = tmp_volinfo;
break;