summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-store.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 1a00aac..d6e071b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1222,6 +1222,16 @@ glusterd_store_snap_list_write (int fd, glusterd_snap_t *snap, uint64_t count)
if (ret)
goto out;
+ if ( strlen(snap->cg_name) > 0 ) {
+ snprintf (key, sizeof (key), "%s-%"PRIu64,
+ GLUSTERD_STORE_KEY_SNAP_CG_NAME, count);
+ ret = gf_store_save_value (fd, key, snap->cg_name);
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Failed to store cg_name");
+ goto out;
+ }
+ }
+
snprintf (key, sizeof (key), "%s-%"PRIu64, GLUSTERD_STORE_KEY_SNAP_ID,
count);
ret = gf_store_save_value (fd, key, uuid_utoa(snap->snap_id));
@@ -1242,7 +1252,7 @@ glusterd_store_snap_list_write (int fd, glusterd_snap_t *snap, uint64_t count)
goto out;
if (snap->description) {
- snprintf (buf, sizeof (buf), "%s\n", snap->description);
+ snprintf (buf, sizeof (buf), "%s", snap->description);
snprintf (key, sizeof (key), "%s-%"PRIu64,
GLUSTERD_STORE_KEY_SNAP_DESC, count);
ret = gf_store_save_value (fd, key, buf);
@@ -1287,7 +1297,7 @@ glusterd_store_snap_cg_write (int fd, glusterd_snap_cg_t *cg)
goto out;
if (cg->description) {
- snprintf (buf, sizeof (buf), "%s\n", cg->description);
+ snprintf (buf, sizeof (buf), "%s", cg->description);
ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_SNAP_DESC,
buf);
if (ret)
@@ -3070,7 +3080,7 @@ glusterd_store_retrieve_snap_cg (char *cg_store_name, glusterd_conf_t *priv)
if (!strncmp(key, GLUSTERD_STORE_KEY_SNAP_NAME,
sizeof (*key))) {
- strncpy (cg->cg_name, value, sizeof (value));
+ strcpy (cg->cg_name, value);
} else if (!strncmp(key, GLUSTERD_STORE_KEY_SNAP_STATUS,
sizeof (*key))) {
cg->cg_status = atoi (value);
@@ -3215,11 +3225,26 @@ glusterd_store_retrieve_snap_list (char *volname)
GF_FREE (value);
value = NULL;
+ if (!uuid_is_null(snap -> cg_id)) {
+ snprintf (key, sizeof (key), "%s-%"PRIu64,
+ GLUSTERD_STORE_KEY_SNAP_CG_NAME, count);
+ ret = gf_store_retrieve_value (shandle, key, &value);
+ if (ret){
+ gf_log ("", GF_LOG_ERROR,"Failed to retreive "
+ "CG name");
+ goto out;
+ }
+ strcpy (snap->cg_name, value);
+ GF_FREE (value);
+ value = NULL;
+ }
+
snprintf (key, sizeof (key), "%s-%"PRIu64,
GLUSTERD_STORE_KEY_SNAP_DESC, count);
ret = gf_store_retrieve_value (shandle, key, &value);
if (!ret) {
- snap->description = value;
+ if (uuid_is_null (snap -> cg_id))
+ snap->description = value;
value = NULL;
} else {
ret = 0;