diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-hooks.h | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-nfs-svc.c | 11 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-pmap.c | 7 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quotad-svc.c | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 9 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapd-svc.c | 50 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.h | 8 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 28 |
9 files changed, 77 insertions, 44 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.h b/xlators/mgmt/glusterd/src/glusterd-hooks.h index cf215716aee..7bab6adb626 100644 --- a/xlators/mgmt/glusterd/src/glusterd-hooks.h +++ b/xlators/mgmt/glusterd/src/glusterd-hooks.h @@ -51,7 +51,7 @@ is_key_glusterd_hooks_friendly (char *key) /* This is very specific to hooks friendly behavior */ if (fnmatch (GD_HOOKS_SPECIFIC_KEY, key, FNM_NOESCAPE) == 0) { - gf_log (THIS->name, GF_LOG_DEBUG, "user namespace key %s", key); + gf_msg_debug (THIS->name, 0, "user namespace key %s", key); is_friendly = _gf_true; } diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c index cb08a208101..0c4d3c1e903 100644 --- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c @@ -14,6 +14,7 @@ #include "glusterd-utils.h" #include "glusterd-volgen.h" #include "glusterd-nfs-svc.h" +#include "glusterd-messages.h" char *nfs_svc_name = "nfs"; @@ -84,7 +85,8 @@ glusterd_nfssvc_check_volfile_identical (gf_boolean_t *identical) tmp_fd = mkstemp (tmpnfsvol); if (tmp_fd < 0) { - gf_log (this->name, GF_LOG_WARNING, "Unable to create temp file" + gf_msg (this->name, GF_LOG_WARNING, errno, + GD_MSG_FILE_OP_FAILED, "Unable to create temp file" " %s:(%s)", tmpnfsvol, strerror (errno)); goto out; } @@ -136,7 +138,8 @@ glusterd_nfssvc_check_topology_identical (gf_boolean_t *identical) snprintf (tmpnfsvol, sizeof (tmpnfsvol), "/tmp/gnfs-XXXXXX"); tmpfd = mkstemp (tmpnfsvol); if (tmpfd < 0) { - gf_log (this->name, GF_LOG_WARNING, "Unable to create temp file" + gf_msg (this->name, GF_LOG_WARNING, errno, + GD_MSG_FILE_OP_FAILED, "Unable to create temp file" " %s: (%s)", tmpnfsvol, strerror (errno)); goto out; } @@ -182,7 +185,7 @@ glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags) goto out; } out: - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } @@ -211,7 +214,7 @@ glusterd_nfssvc_stop (glusterd_svc_t *svc, int sig) glusterd_nfs_pmap_deregister (); out: - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index d739d8918cc..b95f73ea5a6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -18,6 +18,7 @@ #include "portmap-xdr.h" #include "xdr-generic.h" #include "protocol-common.h" +#include "glusterd-messages.h" #include "rpcsvc.h" #include <sys/socket.h> @@ -218,7 +219,8 @@ pmap_registry_bind (xlator_t *this, int port, const char *brickname, pmap->ports[p].type = type; pmap->ports[p].xprt = xprt; - gf_log ("pmap", GF_LOG_INFO, "adding brick %s on port %d", + gf_msg ("pmap", GF_LOG_INFO, 0, + GD_MSG_BRICK_ADD, "adding brick %s on port %d", brickname, port); if (pmap->last_alloc < p) @@ -262,7 +264,8 @@ pmap_registry_remove (xlator_t *this, int port, const char *brickname, goto out; remove: - gf_log ("pmap", GF_LOG_INFO, "removing brick %s on port %d", + gf_msg ("pmap", GF_LOG_INFO, 0, + GD_MSG_BRICK_REMOVE, "removing brick %s on port %d", pmap->ports[p].brickname, p); free (pmap->ports[p].brickname); diff --git a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c index bd77a72c5ab..37824f6904f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c @@ -14,6 +14,7 @@ #include "glusterd-utils.h" #include "glusterd-volgen.h" #include "glusterd-quotad-svc.h" +#include "glusterd-messages.h" char *quotad_svc_name = "quotad"; @@ -94,7 +95,7 @@ glusterd_quotadsvc_manager (glusterd_svc_t *svc, void *data, int flags) } } out: - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } @@ -134,7 +135,7 @@ out: if (cmdline) dict_unref (cmdline); - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c index dd85d1e3638..49454cc5875 100644 --- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c @@ -61,14 +61,15 @@ glusterd_shdsvc_create_volfile () ret = glusterd_create_global_volfile (build_shd_graph, filepath, mod_dict); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Failed to create volfile"); + gf_msg (THIS->name, GF_LOG_ERROR, 0, + GD_MSG_VOLFILE_CREATE_FAIL, "Failed to create volfile"); goto out; } out: if (mod_dict) dict_unref (mod_dict); - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } @@ -116,7 +117,7 @@ glusterd_shdsvc_manager (glusterd_svc_t *svc, void *data, int flags) } } out: - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } @@ -154,7 +155,7 @@ out: if (cmdline) dict_unref (cmdline); - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c index 7e63929f28e..757c7f6d81c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c @@ -92,7 +92,8 @@ glusterd_snapdsvc_init (void *data) sizeof (logdir)); ret = mkdir_p (logdir, 0755, _gf_true); if ((ret == -1) && (EEXIST != errno)) { - gf_log (this->name, GF_LOG_ERROR, "Unable to create logdir %s", + gf_msg (this->name, GF_LOG_ERROR, errno, + GD_MSG_CREATE_DIR_FAILED, "Unable to create logdir %s", logdir); goto out; } @@ -109,7 +110,7 @@ glusterd_snapdsvc_init (void *data) goto out; out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -124,7 +125,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags) ret = glusterd_is_snapd_enabled (volinfo); if (ret == -1) { - gf_log (this->name, GF_LOG_ERROR, "Failed to read volume " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_GET_FAIL, "Failed to read volume " "options"); goto out; } @@ -134,7 +136,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags) if (glusterd_proc_is_running (&svc->proc)) { ret = svc->stop (svc, SIGTERM); if (ret) - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SNAPD_STOP_FAIL, "Couldn't stop snapd for " "volume: %s", volinfo->volname); @@ -147,7 +150,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags) ret = glusterd_snapdsvc_create_volfile (volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Couldn't create " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SNAPD_CREATE_FAIL, "Couldn't create " "snapd volfile for volume: %s", volinfo->volname); goto out; @@ -155,7 +159,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags) ret = svc->start (svc, flags); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Couldn't start " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SNAPD_START_FAIL, "Couldn't start " "snapd for volume: %s", volinfo->volname); goto out; } @@ -170,7 +175,8 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags) } else if (glusterd_proc_is_running (&svc->proc)) { ret = svc->stop (svc, SIGTERM); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SNAPD_STOP_FAIL, "Couldn't stop snapd for volume: %s", volinfo->volname); goto out; @@ -179,7 +185,7 @@ glusterd_snapdsvc_manager (glusterd_svc_t *svc, void *data, int flags) } out: - gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (THIS->name, 0, "Returning %d", ret); return ret; } @@ -212,7 +218,8 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags) /* Get volinfo->snapd from svc object */ snapd = cds_list_entry (svc, glusterd_snapdsvc_t, svc); if (!snapd) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get snapd object " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SNAPD_OBJ_GET_FAIL, "Failed to get snapd object " "from snapd service"); goto out; } @@ -220,14 +227,16 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags) /* Get volinfo from snapd */ volinfo = cds_list_entry (snapd, glusterd_volinfo_t, snapd); if (!volinfo) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get volinfo from " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_GET_FAIL, "Failed to get volinfo from " "from snapd"); goto out; } ret = access (svc->proc.volfile, F_OK); if (ret) { - gf_log (this->name, GF_LOG_DEBUG, + gf_msg (this->name, GF_LOG_DEBUG, 0, + GD_MSG_VOLINFO_GET_FAIL, "snapd Volfile %s is not present", svc->proc.volfile); /* If glusterd is down on one of the nodes and during * that time "USS is enabled" for the first time. After some @@ -239,7 +248,8 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags) */ ret = glusterd_snapdsvc_create_volfile (volinfo); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Couldn't create " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLFILE_CREATE_FAIL, "Couldn't create " "snapd volfile for volume: %s", volinfo->volname); goto out; @@ -325,7 +335,8 @@ glusterd_snapdsvc_restart () svc = &(volinfo->snapd.svc); ret = svc->start (svc, PROC_START_NO_WAIT); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SNAPD_START_FAIL, "Couldn't start snapd for " "vol: %s", volinfo->volname); goto out; @@ -350,13 +361,14 @@ glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event) svc = cds_list_entry (conn, glusterd_svc_t, conn); if (!svc) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get the service"); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SVC_GET_FAIL, "Failed to get the service"); return -1; } switch (event) { case RPC_CLNT_CONNECT: - gf_log (this->name, GF_LOG_DEBUG, "%s has connected with " + gf_msg_debug (this->name, 0, "%s has connected with " "glusterd.", svc->name); svc->online = _gf_true; break; @@ -373,21 +385,23 @@ glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event) case RPC_CLNT_DESTROY: snapd = cds_list_entry (svc, glusterd_snapdsvc_t, svc); if (!snapd) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get the " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SNAPD_OBJ_GET_FAIL, "Failed to get the " "snapd object"); return -1; } volinfo = cds_list_entry (snapd, glusterd_volinfo_t, snapd); if (!volinfo) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get the " + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_VOLINFO_GET_FAIL, "Failed to get the " "volinfo object"); return -1; } glusterd_volinfo_unref (volinfo); default: - gf_log (this->name, GF_LOG_TRACE, + gf_msg_trace (this->name, 0, "got some other RPC event %d", event); break; } diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 57c043704c3..8fe1be16fad 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -27,6 +27,7 @@ #include "glusterd-volgen.h" #include "glusterd-geo-rep.h" #include "glusterd-utils.h" +#include "glusterd-messages.h" #include "run.h" #include "options.h" #include "glusterd-snapshot-utils.h" diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h index e0ecaaa8ebf..9a0c9798a9e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.h +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h @@ -16,6 +16,7 @@ #endif #include "glusterd.h" +#include "glusterd-messages.h" /* volopt map key name definitions */ @@ -59,12 +60,15 @@ typedef struct volgen_graph volgen_graph_t; if (!strchr (key, '.')) { \ ret = option_complete (key, &completion); \ if (ret) { \ - gf_log ("", GF_LOG_ERROR, "Out of memory"); \ + gf_msg ("", GF_LOG_ERROR, ENOMEM, \ + GD_MSG_NO_MEMORY, "Out of memory"); \ return _gf_false; \ } \ \ if (!completion) { \ - gf_log ("", GF_LOG_ERROR, "option %s does not" \ + gf_msg ("", GF_LOG_ERROR, 0, \ + GD_MSG_INVALID_ENTRY, \ + "option %s does not" \ "exist", key); \ return _gf_false; \ } \ diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index ae829ad8434..2ea2ae2eadc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -126,14 +126,15 @@ validate_cache_max_min_size (glusterd_volinfo_t *volinfo, dict_t *dict, "cache-min-file-size (%s) is greater than " "cache-max-file-size (%s)", current_min_value, current_max_value); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_CACHE_MINMAX_SIZE_INVALID, "%s", errstr); *op_errstr = gf_strdup (errstr); ret = -1; goto out; } out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -183,7 +184,8 @@ validate_quota (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, ret = glusterd_volinfo_get_boolean (volinfo, VKEY_FEATURES_QUOTA); if (ret == -1) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_QUOTA_GET_STAT_FAIL, "failed to get the quota status"); goto out; } @@ -191,7 +193,8 @@ validate_quota (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, if (ret == _gf_false) { snprintf (errstr, sizeof (errstr), "Cannot set %s. Enable quota first.", key); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_QUOTA_DISABLED, "%s", errstr); *op_errstr = gf_strdup (errstr); ret = -1; goto out; @@ -199,7 +202,7 @@ validate_quota (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, ret = 0; out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -221,12 +224,13 @@ validate_uss (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, snprintf (errstr, sizeof (errstr), "%s is not a valid boolean " "value. %s expects a valid boolean value.", value, key); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_INVALID_ENTRY, "%s", errstr); *op_errstr = gf_strdup (errstr); goto out; } out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -248,14 +252,15 @@ validate_stripe (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, if (volinfo->stripe_count == 1) { snprintf (errstr, sizeof (errstr), "Cannot set %s for a non-stripe volume.", key); - gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_NON_STRIPE_VOL, "%s", errstr); *op_errstr = gf_strdup (errstr); ret = -1; goto out; } out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } @@ -284,7 +289,8 @@ validate_subvols_per_directory (glusterd_volinfo_t *volinfo, dict_t *dict, "subvols-per-directory(%d) is greater " "than the number of subvolumes(%d).", subvols, volinfo->subvol_count); - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_SUBVOLUMES_EXCEED, "%s.", errstr); *op_errstr = gf_strdup (errstr); ret = -1; @@ -292,7 +298,7 @@ validate_subvols_per_directory (glusterd_volinfo_t *volinfo, dict_t *dict, } out: - gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret); + gf_msg_debug (this->name, 0, "Returning %d", ret); return ret; } |