summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-09-10 17:04:30 +0300
committerAtin Mukherjee <amukherj@redhat.com>2018-09-11 07:10:48 +0000
commit8ac8f359b24c8583eb1a15b9926929770b869db8 (patch)
treebc903225e4d77c9501f001f6f8be5181eb1cd30f
parent170e848b940615eb9f366211d7a79cc3033902cb (diff)
mgmt xlators: store boolean fields using integer
Surprisingly, there is not set_boolean() as there is a get_boolean() In fact, it is stored as an INT dictionary type. In some occasions it was stored using a string, and this caused errors such as: key gfproxy-server, integer type asked, has string type [Invalid argument] I've fixed what I saw in some logs, I'm sure there are more. The CORRECT fix is to create a boolean set and use it, but this requires a bit more work. I'll see if I can do it later on. Only compile-tested! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I45fd0c7a0824b2f42b8ce510296c9dfa4f32ad66
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c15
2 files changed, 11 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index f8e30d060a4..d7b1446204d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1555,8 +1555,8 @@ cont:
* TODO: Remove this and the other places this is referred once
* 3.3.x compatibility is not required
*/
- ret = dict_set_uint32 (dict, "check-op-version",
- _gf_true);
+ ret = dict_set_int32n (dict, "check-op-version",
+ SLEN ("check-op-version"), 1);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 3e56eb36508..166d52394f1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1553,7 +1553,8 @@ gfproxy_server_graph_builder (volgen_graph_t *graph,
if (ret != 0)
goto out;
- ret = dict_set_str (set_dict, "gfproxy-server", "on");
+ ret = dict_set_int32n (set_dict, "gfproxy-server",
+ SLEN ("gfproxy-server"), 1);
if (ret != 0)
goto out;
@@ -1562,8 +1563,8 @@ gfproxy_server_graph_builder (volgen_graph_t *graph,
/* Clear this setting so that future users of set_dict do not end up
* thinking they are a gfproxy server */
- dict_del (set_dict, "gfproxy-server");
- dict_del (set_dict, "trusted-client");
+ dict_deln (set_dict, "gfproxy-server", SLEN ("gfproxy-server"));
+ dict_deln (set_dict, "trusted-client", SLEN ("trusted-client"));
/* Then add the server to it */
get_vol_transport_type (volinfo, transt);
@@ -6218,7 +6219,8 @@ generate_client_volfiles (glusterd_volinfo_t *volinfo,
glusterd_get_gfproxy_client_volfile (volinfo,
filepath,
PATH_MAX);
- ret = dict_set_str (dict, "gfproxy-client", "on");
+ ret = dict_set_int32n (dict, "gfproxy-client",
+ SLEN ("gfproxy-client"), 1);
} else {
ret = glusterd_get_client_filepath (filepath,
volinfo,
@@ -6851,7 +6853,8 @@ validate_shdopts (glusterd_volinfo_t *volinfo,
ret = 0;
goto out;
}
- ret = dict_set_str (val_dict, "graph-check", "on");
+ ret = dict_set_int32n (val_dict, "graph-check",
+ SLEN ("graph-check"), 1);
if (ret)
goto out;
ret = build_shd_graph (&graph, val_dict);
@@ -6862,7 +6865,7 @@ validate_shdopts (glusterd_volinfo_t *volinfo,
gf_msg_debug ("glusterd", 0, "Returning %d", ret);
out:
- dict_del (val_dict, "graph-check");
+ dict_deln (val_dict, "graph-check", SLEN ("graph-check"));
return ret;
}