diff options
author | Amar Tumballi <amarts@redhat.com> | 2018-09-10 19:28:12 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-09-27 03:03:23 +0000 |
commit | 406aa9809cf7e841f3f5e32fbab0097d4779dca3 (patch) | |
tree | 6d87c728b433bd328dc00a305233f23a11becd9d | |
parent | f1e9b878ce2067db83a0baa5f384eda87287719d (diff) |
monitoring: create dump dir if it doesn't exist
Fixes: bz#1624006
Change-Id: Ie78be72e2492cd02c1376852bb90f1e6661d9bea
Signed-off-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r-- | libglusterfs/src/monitoring.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libglusterfs/src/monitoring.c b/libglusterfs/src/monitoring.c index 041b70acf7a..316875257cc 100644 --- a/libglusterfs/src/monitoring.c +++ b/libglusterfs/src/monitoring.c @@ -234,6 +234,14 @@ gf_monitor_metrics(glusterfs_ctx_t *ctx) if (dumppath == NULL) { dumppath = GLUSTER_METRICS_DIR; } + ret = mkdir_p(dumppath, 0755, true); + if (ret) { + /* EEXIST is handled in mkdir_p() itself */ + gf_msg("monitoring", GF_LOG_ERROR, 0, LG_MSG_STRDUP_ERROR, + "failed to create metrics dir %s (%s)", filepath, + strerror(errno)); + return NULL; + } ret = gf_asprintf(&filepath, "%s/gmetrics.XXXXXX", dumppath); if (ret < 0) { |