From 9b226cc588eafd4932f2ade1c4e9280f4eca39bf Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Wed, 8 Sep 2010 13:37:52 +0000 Subject: mgmt/glusterd: Send volume-id during volume exchange Signed-off-by: Vijay Bellur Signed-off-by: Vijay Bellur BUG: 1480 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1480 --- xlators/mgmt/glusterd/src/glusterd-utils.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index cfa4a7dc4d7..d078b00c98e 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); -- cgit