summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2013-05-15 18:18:24 +0530
committerVijay Bellur <vbellur@redhat.com>2013-05-31 11:20:31 -0700
commit114c02e54abae9b3cbf0f84bc48132bf1535118e (patch)
tree318e0ec832fcecc4274d604a07ffff0b7a7ada1e /xlators/mgmt/glusterd/src/glusterd-utils.c
parentc9eb8d1a3fa02a7542b1efe1ab9878abec46afa8 (diff)
mgmt/glusterd: Make sure peerinfo->uuid_str is assigned
Change-Id: I9e2743ab61c8baee92a1dfd376ec4bb145776176 BUG: 963524 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/5016 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index c5df7b4b..ea5799ae 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -74,6 +74,18 @@
static glusterd_lock_t lock;
+char*
+gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo)
+{
+ if ((peerinfo == NULL) || uuid_is_null (peerinfo->uuid))
+ return NULL;
+
+ if (peerinfo->uuid_str[0] == '\0')
+ uuid_utoa_r (peerinfo->uuid, peerinfo->uuid_str);
+
+ return peerinfo->uuid_str;
+}
+
static void
md5_wrapper(const unsigned char *data, size_t len, char *md5)
{
@@ -6840,6 +6852,7 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
int32_t current_index = 2;
int32_t value32 = 0;
uint64_t value = 0;
+ char *peer_uuid_str = NULL;
GF_ASSERT (rsp_dict);
conf = THIS->private;
@@ -6882,9 +6895,10 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
/* Finding the index of the node-uuid in the peer-list */
list_for_each_entry (peerinfo, &conf->peers, uuid_list) {
- if (!strcmp(peerinfo->uuid_str, node_uuid_str)){
+ peer_uuid_str = gd_peer_uuid_str (peerinfo);
+ if (strcmp (peer_uuid_str, node_uuid_str) == 0)
break;
- }
+
current_index++;
}