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>
This commit is contained in:
parent
c9eb8d1a3f
commit
114c02e54a
@ -254,13 +254,14 @@ glusterd_add_peer_detail_to_dict (glusterd_peerinfo_t *peerinfo,
|
||||
|
||||
int ret = -1;
|
||||
char key[256] = {0, };
|
||||
char *peer_uuid_str = NULL;
|
||||
|
||||
GF_ASSERT (peerinfo);
|
||||
GF_ASSERT (friends);
|
||||
|
||||
snprintf (key, 256, "friend%d.uuid", count);
|
||||
uuid_utoa_r (peerinfo->uuid, peerinfo->uuid_str);
|
||||
ret = dict_set_str (friends, key, peerinfo->uuid_str);
|
||||
peer_uuid_str = gd_peer_uuid_str (peerinfo);
|
||||
ret = dict_set_str (friends, key, peer_uuid_str);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
@ -93,7 +93,9 @@ typedef struct glusterd_sm_tr_log_ {
|
||||
|
||||
struct glusterd_peerinfo_ {
|
||||
uuid_t uuid;
|
||||
char uuid_str[50];
|
||||
char uuid_str[50]; /* Retrieve this using
|
||||
* gd_peer_uuid_str ()
|
||||
*/
|
||||
glusterd_peer_state_info_t state;
|
||||
char *hostname;
|
||||
int port;
|
||||
|
@ -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++;
|
||||
}
|
||||
|
||||
|
@ -525,4 +525,6 @@ glusterd_is_same_address (char *name1, char *name2);
|
||||
|
||||
void
|
||||
gd_update_volume_op_versions (glusterd_volinfo_t *volinfo);
|
||||
char*
|
||||
gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user