diff options
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 18 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 25 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 15 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 14 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 4 |
5 files changed, 76 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 86681146b..6dca708f7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -942,6 +942,7 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr) gf_boolean_t exists = _gf_false; glusterd_volinfo_t *volinfo = NULL; char errmsg[PATH_MAX] = {0,}; + dict_t *ctx = NULL; ret = dict_get_int32 (dict, "type", &type); @@ -981,7 +982,24 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr) case GF_GSYNC_OPTION_TYPE_START: ret = glusterd_op_verify_gsync_start_options (volinfo, slave, op_errstr); + if (ret) + goto out; + ctx = glusterd_op_get_ctx(); + if (ctx) { + /*gsyncd does a fuse mount to start the geo-rep session*/ + if (!glusterd_is_fuse_available ()) { + gf_log ("glusterd", GF_LOG_ERROR, "Unable to open" + " /dev/fuse (%s), geo-replication start" + " failed", strerror (errno)); + snprintf (errmsg, sizeof(errmsg), + "fuse unvailable"); + *op_errstr = gf_strdup (errmsg); + ret = -1; + goto out; + } + } break; + case GF_GSYNC_OPTION_TYPE_STOP: ret = glusterd_op_verify_gsync_running (volinfo, slave, op_errstr); diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index c81a94501..709f8533b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -785,6 +785,8 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr) int ret = 0; char *volname = NULL; gf_boolean_t exists = _gf_false; + int type = 0; + dict_t *ctx = NULL; GF_ASSERT (dict); GF_ASSERT (op_errstr); @@ -805,6 +807,29 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr) goto out; } + ret = dict_get_int32 (dict, "type", &type); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get 'type' for quota op"); + *op_errstr = gf_strdup ("Volume quota failed, internal error " + ", unable to get type of operation"); + goto out; + } + + + ctx = glusterd_op_get_ctx(); + if (ctx && (type == GF_QUOTA_OPTION_TYPE_ENABLE + || type == GF_QUOTA_OPTION_TYPE_LIST)) { + /* Fuse mount req. only for enable & list-usage options*/ + if (!glusterd_is_fuse_available ()) { + gf_log ("glusterd", GF_LOG_ERROR, "Unable to open /dev/" + "fuse (%s), quota command failed", + strerror (errno)); + *op_errstr = gf_strdup ("Fuse unavailable"); + ret = -1; + goto out; + } + } + out: gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index f84dae174..060d40bed 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -237,6 +237,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, glusterd_peerinfo_t *peerinfo = NULL; glusterd_brickinfo_t *dst_brickinfo = NULL; gf_boolean_t is_run = _gf_false; + dict_t *ctx = NULL; ret = dict_get_str (dict, "src-brick", &src_brick); @@ -382,6 +383,20 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, goto out; } + ctx = glusterd_op_get_ctx(); + if (ctx) { + if (!glusterd_is_fuse_available ()) { + gf_log ("glusterd", GF_LOG_ERROR, "Unable to open /dev/" + "fuse (%s), replace-brick command failed", + strerror (errno)); + snprintf (msg, sizeof(msg), "Fuse unavailable\n " + "Replace-brick failed"); + *op_errstr = gf_strdup (msg); + ret = -1; + goto out; + } + } + if (!glusterd_is_local_addr (src_brickinfo->hostname)) { gf_log ("", GF_LOG_DEBUG, "I AM THE SOURCE HOST"); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 3aafd6e9a..8694f7536 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -94,6 +94,20 @@ glusterd_unset_lock_owner (uuid_t owner) } gf_boolean_t +glusterd_is_fuse_available () +{ + + int fd = 0; + + fd = open ("/dev/fuse", O_RDWR); + + if (fd > -1 && !close (fd)) + return _gf_true; + else + return _gf_false; +} + +gf_boolean_t glusterd_is_loopback_localhost (const struct sockaddr *sa, char *hostname) { GF_ASSERT (sa); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 57e5c82f4..2ee36936a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -286,4 +286,8 @@ int32_t glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo, dict_t *dict, int32_t count); + +gf_boolean_t +glusterd_is_fuse_available (); + #endif |