monitoring: create dump dir if it doesn't exist

Fixes: bz#1624006

Change-Id: Ie78be72e2492cd02c1376852bb90f1e6661d9bea
Signed-off-by: Amar Tumballi <amarts@redhat.com>
This commit is contained in:
Amar Tumballi 2018-09-10 19:28:12 +05:30
parent f1e9b878ce
commit 406aa9809c

View File

@ -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) {