summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src/dht-shared.c')
-rw-r--r--xlators/cluster/dht/src/dht-shared.c53
1 files changed, 35 insertions, 18 deletions
diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c
index f2e7467abe7..3d1d635b4ed 100644
--- a/xlators/cluster/dht/src/dht-shared.c
+++ b/xlators/cluster/dht/src/dht-shared.c
@@ -18,6 +18,8 @@
#include "statedump.h"
#include "dht-common.h"
+#include "dht-messages.h"
+
/* TODO:
- use volumename in xattr instead of "dht"
@@ -357,21 +359,23 @@ dht_reconfigure (xlator_t *this, dict_t *options)
/* If option is not "auto", other options _should_ be boolean*/
if (strcasecmp (temp_str, "auto")) {
if (!gf_string2boolean (temp_str, &search_unhashed)) {
- gf_log(this->name, GF_LOG_DEBUG, "Reconfigure:"
- " lookup-unhashed reconfigured (%s)",
- temp_str);
+ gf_msg_debug(this->name, 0, "Reconfigure: "
+ "lookup-unhashed reconfigured(%s)",
+ temp_str);
conf->search_unhashed = search_unhashed;
} else {
- gf_log(this->name, GF_LOG_ERROR, "Reconfigure:"
- " lookup-unhashed should be boolean,"
+ gf_msg(this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_OPTION,
+ "Invalid option: Reconfigure: "
+ "lookup-unhashed should be boolean,"
" not (%s), defaulting to (%d)",
temp_str, conf->search_unhashed);
ret = -1;
goto out;
}
} else {
- gf_log(this->name, GF_LOG_DEBUG, "Reconfigure:"
- " lookup-unhashed reconfigured auto ");
+ gf_msg_debug(this->name, 0, "Reconfigure:"
+ " lookup-unhashed reconfigured auto ");
conf->search_unhashed = GF_DHT_LOOKUP_UNHASHED_AUTO;
}
}
@@ -453,8 +457,10 @@ gf_defrag_pattern_list_fill (xlator_t *this, gf_defrag_info_t *defrag, char *dat
pattern = "*";
}
} else if (gf_string2bytesize_uint64 (num, &pattern_list->size) != 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "invalid number format \"%s\"", num);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_OPTION,
+ "Invalid option. Defrag pattern:"
+ " Invalid number format \"%s\"", num);
goto out;
}
memcpy (pattern_list->path_pattern, pattern, strlen (dup_str));
@@ -499,13 +505,15 @@ dht_init (xlator_t *this)
GF_VALIDATE_OR_GOTO ("dht", this, err);
if (!this->children) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ DHT_MSG_INVALID_CONFIGURATION,
"Distribute needs more than one subvolume");
return -1;
}
if (!this->parents) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ DHT_MSG_INVALID_CONFIGURATION,
"dangling volume. check volfile");
}
@@ -530,14 +538,17 @@ dht_init (xlator_t *this)
ret = dict_get_str (this->options, "node-uuid", &node_uuid);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "node-uuid not "
- "specified");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_CONFIGURATION,
+ "Invalid volume configuration: "
+ "node-uuid not specified");
goto err;
}
if (uuid_parse (node_uuid, defrag->node_uuid)) {
- gf_log (this->name, GF_LOG_ERROR, "Cannot parse "
- "glusterd node uuid");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_OPTION, "Invalid option:"
+ " Cannot parse glusterd node uuid");
goto err;
}
@@ -581,8 +592,12 @@ dht_init (xlator_t *this)
== 0) {
if (gf_defrag_pattern_list_fill (this, defrag, temp_str)
== -1) {
- gf_log (this->name, GF_LOG_ERROR, "Cannot parse"
- " rebalance-filter (%s)", temp_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INVALID_OPTION,
+ "Invalid option:"
+ " Cannot parse rebalance-filter (%s)",
+ temp_str);
+
goto err;
}
}
@@ -621,7 +636,9 @@ dht_init (xlator_t *this)
this->local_pool = mem_pool_new (dht_local_t, 512);
if (!this->local_pool) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_INIT_FAILED,
+ " DHT initialisation failed. "
"failed to create local_t's memory pool");
goto err;
}