summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-10-29 17:55:24 +0530
committershishir gowda <sgowda@redhat.com>2013-11-15 14:39:42 +0530
commit02157e7d4f31459f76cfb412099f49e851d76ebc (patch)
tree77176971a3eb32959f10766a95895fc04d34085b
parent096b23f187d0b3ccbed25d8bd02723a61cc4da2d (diff)
mgmt/glusterd: store option to update only snap_list.info
Change-Id: I16b17ca60b5f9b34b7d238d8a3424a3b7a1dc435 Signed-off-by: shishir gowda <sgowda@redhat.com>
-rw-r--r--cli/src/cli-cmd-parser.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c51
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.h2
3 files changed, 53 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index b7078ff..352a2cc 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -3166,7 +3166,6 @@ out:
int32_t
cli_snap_config_parse (const char **words, int wordcount, dict_t *options)
{
- dict_t *dict = NULL;
char *volname = NULL;
int ret = -1;
char *key = NULL;
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index bbff2f4..70c5080 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1385,6 +1385,57 @@ unlock:
}
int32_t
+glusterd_store_perform_snap_list_store (glusterd_volinfo_t *volinfo)
+{
+ int fd = -1;
+ int32_t ret = -1;
+ glusterd_snap_t *entry = NULL;
+ glusterd_snap_t *tmp = NULL;
+ uint64_t count = 0;
+ char buf[PATH_MAX] = {0,};
+
+ GF_ASSERT (volinfo);
+
+ ret = glusterd_store_create_snap_list_sh_on_absence (volinfo);
+ if (ret)
+ goto out;
+ fd = gf_store_mkstemp (volinfo->snap_list_shandle);
+ if (fd <= 0) {
+ ret = -1;
+ goto out;
+ }
+
+ LOCK (&volinfo->lock);
+ {
+ list_for_each_entry_safe (entry, tmp, &volinfo->snaps,
+ snap_list) {
+ ret = glusterd_store_snap_list_write (fd, entry, count);
+ if (ret)
+ goto unlock;
+ count++;
+ }
+ snprintf (buf, sizeof(buf), "%"PRIu64, count);
+ ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_SNAP_COUNT,
+ buf);
+ if (ret)
+ goto unlock;
+ }
+unlock:
+ UNLOCK (&volinfo->lock);
+
+ ret = gf_store_rename_tmppath (volinfo->snap_list_shandle);
+ if (ret)
+ goto out;
+
+out:
+ if (ret && (fd > 0))
+ gf_store_unlink_tmppath (volinfo->snap_list_shandle);
+ if (fd > 0)
+ close (fd);
+ gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+}
+int32_t
glusterd_store_perform_snap_store (glusterd_volinfo_t *volinfo)
{
int fd = -1;
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h
index ece2003..4244d2e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.h
+++ b/xlators/mgmt/glusterd/src/glusterd-store.h
@@ -145,4 +145,6 @@ int32_t
glusterd_store_perform_volume_store (glusterd_volinfo_t *volinfo);
int32_t
glusterd_store_perform_snap_store (glusterd_volinfo_t *volinfo);
+int32_t
+glusterd_store_perform_snap_list_store (glusterd_volinfo_t *volinfo);
#endif