From 17e57f27c714c94dd5d9fa91650f83d069f2f4e4 Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Mon, 12 Sep 2011 15:51:42 +0530 Subject: mgmt/glusterd: check the availability of fuse for few glusterd operations Change-Id: I410cc6a86c32637566e5498f69f46cb40322e7fb BUG: 2715 Reviewed-on: http://review.gluster.com/364 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-quota.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-quota.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index c81a9450..709f8533 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); -- cgit