summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2012-06-27 11:04:48 +0530
committerAnand Avati <avati@redhat.com>2012-07-02 12:04:41 -0700
commitb583363dcc0cf87b4ca27b99bca532da764e3a07 (patch)
tree09b890b5d0bbcf2314f75bd625458af11acf25e1 /xlators/mgmt/glusterd/src/glusterd-utils.c
parent4df765df74b4406c7cce90e66c4256e3850a8c5f (diff)
glusterd: Fix peer probe when username/password is missing
Prevent failure of building volumes dictionary during peer probe, when username/password for a volume is missing. This situation can be caused by migration of gluster from pre-3.3 to 3.3 and above. Change-Id: Ib924ecd3d941ddaa5c7773e4d45b076c488b6421 BUG: 834229 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.com/3619 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 6650043c175..ab1156178b6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1730,24 +1730,20 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "volume%d.username", count);
str = glusterd_auth_get_username (volinfo);
- if (!str) {
- ret = -1;
- goto out;
+ if (str) {
+ ret = dict_set_dynstr (dict, key, gf_strdup (str));
+ if (ret)
+ goto out;
}
- ret = dict_set_dynstr (dict, key, gf_strdup (str));
- if (ret)
- goto out;
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "volume%d.password", count);
str = glusterd_auth_get_password (volinfo);
- if (!str) {
- ret = -1;
- goto out;
+ if (str) {
+ ret = dict_set_dynstr (dict, key, gf_strdup (str));
+ if (ret)
+ goto out;
}
- ret = dict_set_dynstr (dict, key, gf_strdup (str));
- if (ret)
- goto out;
memset (key, 0, sizeof (key));
snprintf (key, 256, "volume%d."GLUSTERD_STORE_KEY_RB_STATUS, count);