summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index cfa4a7dc4..d078b00c9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1096,6 +1096,8 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
char key[512] = {0,};
glusterd_brickinfo_t *brickinfo = NULL;
int32_t i = 1;
+ char uuid_str[50] = {0,};
+ char *volume_id_str = NULL;
GF_ASSERT (dict);
GF_ASSERT (volinfo);
@@ -1141,6 +1143,17 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
if (ret)
goto out;
+ uuid_unparse (volinfo->volume_id, uuid_str);
+ volume_id_str = gf_strdup (uuid_str);
+ if (!volume_id_str)
+ goto out;
+
+ memset (&key, 0, sizeof (key));
+ snprintf (key, 256, "volume%d.volume_id", count);
+ ret = dict_set_dynstr (dict, key, volume_id_str);
+ if (ret)
+ goto out;
+
list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
memset (&key, 0, sizeof (key));
snprintf (key, sizeof (key), "volume%d.brick%d.hostname",
@@ -1289,6 +1302,7 @@ glusterd_import_friend_volume (dict_t *vols, int count)
glusterd_brickinfo_t *tmp = NULL;
int new_volinfo = 0;
int i = 1;
+ char *volume_id_str = NULL;
GF_ASSERT (vols);
@@ -1346,6 +1360,13 @@ glusterd_import_friend_volume (dict_t *vols, int count)
if (ret)
goto out;
+ memset (&key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "volume%d.volume_id", count);
+ ret = dict_get_str (vols, key, &volume_id_str);
+ if (ret)
+ goto out;
+ uuid_parse (volume_id_str, volinfo->volume_id);
+
list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
brick_list) {
ret = glusterd_brickinfo_delete (brickinfo);