diff options
author | Kaushal M <kaushal@redhat.com> | 2012-09-03 16:51:06 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-10-31 02:35:37 -0700 |
commit | abc8e5b01bff976e1f6b3c1e2747a2a341bf0f64 (patch) | |
tree | 13bd5813579b4b80a9cd00a2af5fd35f9bc3ef8f /xlators | |
parent | 0608244512f1ab0ba9916ab3da9f0bc57ee234fc (diff) |
glusterd: 'volume set' changes for op-version support
An op-version check is performed for the given keys during stage. The commit
phase moves the cluster op-version to the required version if needed.
Change-Id: Id5c387094dbec723df736b2ecdc49ff93c179e0e
BUG: 814534
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/3780
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 160 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 15 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 320 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.h | 15 |
5 files changed, 348 insertions, 168 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index d117b05af7e..40f38f5bbba 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -293,22 +293,28 @@ out: static int glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) { - int ret = 0; - char *volname = NULL; - int exists = 0; - char *key = NULL; - char *key_fixed = NULL; - char *value = NULL; - char str[100] = {0, }; - int count = 0; - int dict_count = 0; - char errstr[2048] = {0, }; - glusterd_volinfo_t *volinfo = NULL; - dict_t *val_dict = NULL; - gf_boolean_t global_opt = _gf_false; - glusterd_volinfo_t *voliter = NULL; - glusterd_conf_t *priv = NULL; - xlator_t *this = NULL; + int ret = -1; + char *volname = NULL; + int exists = 0; + char *key = NULL; + char *key_fixed = NULL; + char *value = NULL; + char str[100] = {0, }; + int count = 0; + int dict_count = 0; + char errstr[2048] = {0, }; + glusterd_volinfo_t *volinfo = NULL; + dict_t *val_dict = NULL; + gf_boolean_t global_opt = _gf_false; + glusterd_volinfo_t *voliter = NULL; + glusterd_conf_t *priv = NULL; + xlator_t *this = NULL; + uint32_t new_op_version = 0; + uint32_t local_new_op_version = 0; + uint32_t key_op_version = 0; + uint32_t local_key_op_version = 0; + gf_boolean_t origin_glusterd = _gf_true; + gf_boolean_t check_op_version = _gf_true; GF_ASSERT (dict); this = THIS; @@ -320,8 +326,41 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) if (!val_dict) goto out; - ret = dict_get_int32 (dict, "count", &dict_count); + /* Check if we can support the required op-version + * This check is not done on the originator glusterd. The originator + * glusterd sets this value. + */ + origin_glusterd = is_origin_glusterd (); + + if (!origin_glusterd) { + /* Check for v3.3.x origin glusterd */ + check_op_version = dict_get_str_boolean (dict, + "check-op-version", + _gf_false); + + if (check_op_version) { + ret = dict_get_uint32 (dict, "new-op-version", + &new_op_version); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to get new_op_version"); + goto out; + } + + if ((new_op_version > GD_OP_VERSION_MAX) || + (new_op_version < GD_OP_VERSION_MIN)) { + ret = -1; + snprintf (errstr, sizeof (errstr), + "Required op_version (%d) is not " + "supported", new_op_version); + gf_log (this->name, GF_LOG_ERROR, "%s", errstr); + *op_errstr = gf_strdup (errstr); + goto out; + } + } + } + ret = dict_get_int32 (dict, "count", &dict_count); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Count(dict),not set in Volume-Set"); @@ -381,6 +420,8 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) if (ret) goto out; + local_new_op_version = priv->op_version; + for ( count = 1; ret != 1 ; count++ ) { global_opt = _gf_false; sprintf (str, "key%d", count); @@ -450,6 +491,41 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) if (key_fixed) key = key_fixed; + local_key_op_version = glusterd_get_op_version_for_key (key); + if (local_key_op_version > local_new_op_version) + local_new_op_version = local_key_op_version; + + sprintf (str, "op-version%d", count); + if (origin_glusterd) { + ret = dict_set_uint32 (dict, str, local_key_op_version); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to set key-op-version in dict"); + goto out; + } + } else if (check_op_version) { + ret = dict_get_uint32 (dict, str, &key_op_version); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to get key-op-version from" + " dict"); + goto out; + } + if (local_key_op_version != key_op_version) { + ret = -1; + snprintf (errstr, 2048, + "option: %s op-version mismatch", + key); + gf_log (this->name, GF_LOG_ERROR, + "%s, required op-version = %"PRIu32", " + "available op-version = %"PRIu32, + errstr, key_op_version, + local_key_op_version); + *op_errstr = gf_strdup (errstr); + goto out; + } + } + if (glusterd_check_globaloption (key)) global_opt = _gf_true; @@ -487,6 +563,28 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) } } + if (origin_glusterd) { + ret = dict_set_uint32 (dict, "new-op-version", + local_new_op_version); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to set new-op-version in dict"); + goto out; + } + /* Set this value in dict so other peers know to check for + * op-version. This is a hack for 3.3.x compatibility + * + * TODO: Remove this and the other places this is referred once + * 3.3.x compatibility is not required + */ + ret = dict_set_uint32 (dict, "check-op-version", + _gf_true); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to set check-op-version in dict"); + goto out; + } + } ret = 0; @@ -1046,6 +1144,9 @@ glusterd_op_set_volume (dict_t *dict) gf_boolean_t global_opt = _gf_false; glusterd_volinfo_t *voliter = NULL; int32_t dict_count = 0; + gf_boolean_t check_op_version = _gf_false; + uint32_t new_op_version = 0; + this = THIS; GF_ASSERT (this); @@ -1081,6 +1182,18 @@ glusterd_op_set_volume (dict_t *dict) goto out; } + check_op_version = dict_get_str_boolean (dict, "check-op-version", + _gf_false); + + if (check_op_version) { + ret = dict_get_uint32 (dict, "new-op-version", &new_op_version); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Unable to get new op-version from dict"); + goto out; + } + } + for (count = 1; ret != -1 ; count++) { global_opt = _gf_false; @@ -1224,7 +1337,16 @@ glusterd_op_set_volume (dict_t *dict) } } - ret = 0; + if (new_op_version > priv->op_version) { + priv->op_version = new_op_version; + ret = glusterd_store_global_info (this); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to store op-version"); + goto out; + } + } + out: GF_FREE (key_fixed); gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret); @@ -1926,7 +2048,7 @@ glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx) if (ret) goto out; } - dict_copy (dict, req_dict); + req_dict = dict_ref (dict); } break; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 25fb5cba7ea..fab405c7f7d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -6319,3 +6319,18 @@ glusterd_volume_heal_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) out: return ret; } + +/* Should be used only when an operation is in progress, as that is the only + * time a lock_owner is set + */ +gf_boolean_t +is_origin_glusterd () { + int ret = 0; + uuid_t lock_owner = {0,}; + + ret = glusterd_get_lock_owner (&lock_owner); + if (ret) + return _gf_false; + + return (uuid_compare (MY_UUID, lock_owner) == 0); +} diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 1cda32b5719..545fa3385ac 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -457,4 +457,10 @@ int glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); int glusterd_volume_heal_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); + +/* Should be used only when an operation is in progress, as that is the only + * time a lock_owner is set + */ +gf_boolean_t +is_origin_glusterd (); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 2784242feaa..ac9565cf4fb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -60,6 +60,15 @@ * a default. That is, even the volume dict doesn't have a value, * we procced as if the default value were set for it. * + * Fifth field is <doctype>, which decides if the option is public and available + * in "set help" or not. "NODOC" entries are not part of the public interface + * and are subject to change at any time. This also decides if an option is + * global (apllies to all volumes) or normal (applies to only specified volume). + * + * Sixth field is <flags>. + * + * Seventh field is <op-version>. + * * There are two type of entries: basic and special. * * - Basic entries are the ones where the <option> does _not_ start with @@ -78,8 +87,6 @@ * extend them in a trivial way which could be just picked up. Better * not touch them unless you know what you do. * - * "NODOC" entries are not part of the public interface and are subject - * to change at any time. * * Another kind of grouping for options, according to visibility: * @@ -92,154 +99,154 @@ * Adhering to this policy, option name changes shall be one-liners. * */ -typedef enum { DOC, NO_DOC, GLOBAL_DOC, GLOBAL_NO_DOC } option_type_t; - - -struct volopt_map_entry { - char *key; - char *voltype; - char *option; - char *value; - option_type_t type; - uint32_t flags; -}; static struct volopt_map_entry glusterd_volopt_map[] = { - - {"cluster.lookup-unhashed", "cluster/distribute", NULL, NULL, NO_DOC, 0 }, - {"cluster.min-free-disk", "cluster/distribute", NULL, NULL, NO_DOC, 0 }, - {"cluster.min-free-inodes", "cluster/distribute", NULL, NULL, NO_DOC, 0 }, - {"cluster.rebalance-stats", "cluster/distribute", NULL, NULL, NO_DOC, 0 }, - {"cluster.subvols-per-directory", "cluster/distribute", "directory-layout-spread", NULL, NO_DOC, 0 }, - {"cluster.readdir-optimize", "cluster/distribute", NULL, NULL, NO_DOC, 0 }, - - {"cluster.entry-change-log", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.read-subvolume", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.read-subvolume-index", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.read-hash-mode", "cluster/replicate", NULL, NULL, NO_DOC, 0}, - {"cluster.background-self-heal-count", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.metadata-self-heal", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.data-self-heal", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.entry-self-heal", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.self-heal-daemon", "cluster/replicate", "!self-heal-daemon" , NULL, NO_DOC, 0 }, - {"cluster.heal-timeout", "cluster/replicate", "!heal-timeout" , NULL, NO_DOC, 0 }, - {"cluster.strict-readdir", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.self-heal-window-size", "cluster/replicate", "data-self-heal-window-size", NULL, DOC, 0}, - {"cluster.data-change-log", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.metadata-change-log", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.data-self-heal-algorithm", "cluster/replicate", "data-self-heal-algorithm", NULL,DOC, 0}, - {"cluster.eager-lock", "cluster/replicate", NULL, NULL, NO_DOC, 0 }, - {"cluster.quorum-type", "cluster/replicate", "quorum-type", NULL, NO_DOC, 0}, - {"cluster.quorum-count", "cluster/replicate", "quorum-count", NULL, NO_DOC, 0}, - {"cluster.choose-local", "cluster/replicate", NULL, NULL, DOC, 0}, - {"cluster.self-heal-readdir-size", "cluster/replicate", NULL, NULL, NO_DOC, 0}, - - {"cluster.stripe-block-size", "cluster/stripe", "block-size", NULL, DOC, 0}, - {"cluster.stripe-coalesce", "cluster/stripe", "coalesce", NULL, DOC, 0}, - - {VKEY_DIAG_LAT_MEASUREMENT, "debug/io-stats", "latency-measurement", "off", NO_DOC, 0}, - {"diagnostics.dump-fd-stats", "debug/io-stats", NULL, NULL, NO_DOC, 0}, - {VKEY_DIAG_CNT_FOP_HITS, "debug/io-stats", "count-fop-hits", "off", NO_DOC, 0}, - - {"diagnostics.brick-log-level", "debug/io-stats", "!brick-log-level", NULL, DOC, 0}, - {"diagnostics.client-log-level", "debug/io-stats", "!client-log-level", NULL, DOC, 0}, - {"diagnostics.brick-sys-log-level", "debug/io-stats", "!sys-log-level", NULL, DOC, 0}, - {"diagnostics.client-sys-log-level", "debug/io-stats", "!sys-log-level", NULL, DOC, 0}, - - {"performance.cache-max-file-size", "performance/io-cache", "max-file-size", NULL, DOC, 0}, - {"performance.cache-min-file-size", "performance/io-cache", "min-file-size", NULL, DOC, 0}, - {"performance.cache-refresh-timeout", "performance/io-cache", "cache-timeout", NULL, DOC, 0}, - {"performance.cache-priority", "performance/io-cache", "priority", NULL, DOC, 0}, - {"performance.cache-size", "performance/io-cache", NULL, NULL, NO_DOC, 0 }, - {"performance.cache-size", "performance/quick-read", NULL, NULL, NO_DOC, 0 }, - {"performance.flush-behind", "performance/write-behind", "flush-behind", NULL, DOC, 0}, - {"performance.md-cache-timeout", "performance/md-cache", "md-cache-timeout", NULL, DOC, 0}, - - {"performance.io-thread-count", "performance/io-threads", "thread-count", NULL, DOC, 0}, - {"performance.high-prio-threads", "performance/io-threads", NULL, NULL, DOC, 0}, - {"performance.normal-prio-threads", "performance/io-threads", NULL, NULL, DOC, 0}, - {"performance.low-prio-threads", "performance/io-threads", NULL, NULL, DOC, 0}, - {"performance.least-prio-threads", "performance/io-threads", NULL, NULL, DOC, 0}, - {"performance.enable-least-priority", "performance/io-threads", NULL, NULL, DOC, 0}, - {"performance.disk-usage-limit", "performance/quota", NULL, NULL, NO_DOC, 0}, - {"performance.min-free-disk-limit", "performance/quota", NULL, NULL, NO_DOC, 0}, - {"performance.write-behind-window-size", "performance/write-behind", "cache-size", NULL, DOC}, - {"performance.strict-o-direct", "performance/write-behind", "strict-O_DIRECT", NULL, DOC}, - {"performance.strict-write-ordering", "performance/write-behind", "strict-write-ordering", NULL, DOC}, - {"performance.read-ahead-page-count", "performance/read-ahead", "page-count", NULL, DOC}, - - {"network.frame-timeout", "protocol/client", NULL, NULL, NO_DOC, 0}, - {"network.ping-timeout", "protocol/client", NULL, NULL, NO_DOC, 0}, - {"network.tcp-window-size", "protocol/client", NULL, NULL, NO_DOC, 0}, - { "client.ssl", "protocol/client", "transport.socket.ssl-enabled", NULL, NO_DOC, 0}, - - {"network.tcp-window-size", "protocol/server", NULL, NULL, NO_DOC, 0}, - {"network.inode-lru-limit", "protocol/server", NULL, NULL, NO_DOC, 0}, - {AUTH_ALLOW_MAP_KEY, "protocol/server", "!server-auth", "*", DOC, 0}, + /* DHT xlator options */ + {"cluster.lookup-unhashed", "cluster/distribute", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.min-free-disk", "cluster/distribute", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.min-free-inodes", "cluster/distribute", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.rebalance-stats", "cluster/distribute", NULL, NULL, NO_DOC, 0, 2}, + {"cluster.subvols-per-directory", "cluster/distribute", "directory-layout-spread", NULL, NO_DOC, 0, 2}, + {"cluster.readdir-optimize", "cluster/distribute", NULL, NULL, NO_DOC, 0, 2}, + + /* AFR xlator options */ + {"cluster.entry-change-log", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.read-subvolume", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.read-subvolume-index", "cluster/replicate", NULL, NULL, NO_DOC, 0, 2}, + {"cluster.read-hash-mode", "cluster/replicate", NULL, NULL, NO_DOC, 0, 2}, + {"cluster.background-self-heal-count", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.metadata-self-heal", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.data-self-heal", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.entry-self-heal", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.self-heal-daemon", "cluster/replicate", "!self-heal-daemon" , NULL, NO_DOC, 0, 1}, + {"cluster.heal-timeout", "cluster/replicate", "!heal-timeout" , NULL, NO_DOC, 0, 2}, + {"cluster.strict-readdir", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.self-heal-window-size", "cluster/replicate", "data-self-heal-window-size", NULL, DOC, 0, 1}, + {"cluster.data-change-log", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.metadata-change-log", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.data-self-heal-algorithm", "cluster/replicate", "data-self-heal-algorithm", NULL, DOC, 0, 1}, + {"cluster.eager-lock", "cluster/replicate", NULL, NULL, NO_DOC, 0, 1}, + {"cluster.quorum-type", "cluster/replicate", "quorum-type", NULL, NO_DOC, 0, 1}, + {"cluster.quorum-count", "cluster/replicate", "quorum-count", NULL, NO_DOC, 0, 1}, + {"cluster.choose-local", "cluster/replicate", NULL, NULL, DOC, 0, 2}, + + /* Stripe xlator options */ + {"cluster.stripe-block-size", "cluster/stripe", "block-size", NULL, DOC, 0, 1}, + {"cluster.stripe-coalesce", "cluster/stripe", "coalesce", NULL, DOC, 0, 2}, + + /* IO-stats xlator options */ + {VKEY_DIAG_LAT_MEASUREMENT, "debug/io-stats", "latency-measurement", "off", NO_DOC, 0, 1}, + {"diagnostics.dump-fd-stats", "debug/io-stats", NULL, NULL, NO_DOC, 0, 1}, + {VKEY_DIAG_CNT_FOP_HITS, "debug/io-stats", "count-fop-hits", "off", NO_DOC, 0, 1}, + {"diagnostics.brick-log-level", "debug/io-stats", "!brick-log-level", NULL, DOC, 0, 1}, + {"diagnostics.client-log-level", "debug/io-stats", "!client-log-level", NULL, DOC, 0, 1}, + {"diagnostics.brick-sys-log-level", "debug/io-stats", "!sys-log-level", NULL, DOC, 0, 1}, + {"diagnostics.client-sys-log-level", "debug/io-stats", "!sys-log-level", NULL, DOC, 0, 1}, + + /* IO-cache xlator options */ + {"performance.cache-max-file-size", "performance/io-cache", "max-file-size", NULL, DOC, 0, 1}, + {"performance.cache-min-file-size", "performance/io-cache", "min-file-size", NULL, DOC, 0, 1}, + {"performance.cache-refresh-timeout", "performance/io-cache", "cache-timeout", NULL, DOC, 0, 1}, + {"performance.cache-priority", "performance/io-cache", "priority", NULL, DOC, 0, 1}, + {"performance.cache-size", "performance/io-cache", NULL, NULL, NO_DOC, 0, 1}, + + /* IO-threads xlator options */ + {"performance.io-thread-count", "performance/io-threads", "thread-count", NULL, DOC, 0, 1}, + {"performance.high-prio-threads", "performance/io-threads", NULL, NULL, DOC, 0, 1}, + {"performance.normal-prio-threads", "performance/io-threads", NULL, NULL, DOC, 0, 1}, + {"performance.low-prio-threads", "performance/io-threads", NULL, NULL, DOC, 0, 1}, + {"performance.least-prio-threads", "performance/io-threads", NULL, NULL, DOC, 0, 1}, + {"performance.enable-least-priority", "performance/io-threads", NULL, NULL, DOC, 0, 2}, + + /* Other perf xlators' options */ + {"performance.cache-size", "performance/quick-read", NULL, NULL, NO_DOC, 0, 1}, + {"performance.flush-behind", "performance/write-behind", "flush-behind", NULL, DOC, 0, 1}, + {"performance.write-behind-window-size", "performance/write-behind", "cache-size", NULL, DOC, 1}, + + {"performance.read-ahead-page-count", "performance/read-ahead", "page-count", NULL, DOC, 1}, + {"performance.md-cache-timeout", "performance/md-cache", "md-cache-timeout", NULL, DOC, 0, 2}, + + /* Client xlator options */ + {"network.frame-timeout", "protocol/client", NULL, NULL, NO_DOC, 0, 1}, + {"network.ping-timeout", "protocol/client", NULL, NULL, NO_DOC, 0, 1}, + {"network.tcp-window-size", "protocol/client", NULL, NULL, NO_DOC, 0, 1}, + {"features.lock-heal", "protocol/client", "lk-heal", NULL, DOC, 0, 1}, + {"features.grace-timeout", "protocol/client", "grace-timeout", NULL, DOC, 0, 1}, + {"client.ssl", "protocol/client", "transport.socket.ssl-enabled", NULL, NO_DOC, 0, 2}, + + /* Server xlator options */ + {"network.tcp-window-size", "protocol/server", NULL, NULL, NO_DOC, 0, 1}, + {"network.inode-lru-limit", "protocol/server", NULL, NULL, NO_DOC, 0, 1}, + {AUTH_ALLOW_MAP_KEY, "protocol/server", "!server-auth", "*", DOC, 0, 1}, {AUTH_REJECT_MAP_KEY, "protocol/server", "!server-auth", NULL, DOC, 0}, - {"transport.keepalive", "protocol/server", "transport.socket.keepalive", NULL, NO_DOC, 0}, - {"server.allow-insecure", "protocol/server", "rpc-auth-allow-insecure", NULL, NO_DOC, 0}, - { "server.ssl", "protocol/server", "transport.socket.ssl-enabled", NULL, NO_DOC, 0}, - - {"performance.write-behind", "performance/write-behind", "!perf", "on", NO_DOC, 0}, - {"performance.read-ahead", "performance/read-ahead", "!perf", "on", NO_DOC, 0}, - {"performance.io-cache", "performance/io-cache", "!perf", "on", NO_DOC, 0}, - {"performance.quick-read", "performance/quick-read", "!perf", "on", NO_DOC, 0}, - {VKEY_PERF_STAT_PREFETCH, "performance/md-cache", "!perf", "on", NO_DOC, 0}, - {"performance.client-io-threads", "performance/io-threads", "!perf", "off", NO_DOC, 0}, - - {"performance.nfs.write-behind", "performance/write-behind", "!nfsperf", "off", NO_DOC, 0}, - {"performance.nfs.read-ahead", "performance/read-ahead", "!nfsperf", "off", NO_DOC, 0}, - {"performance.nfs.io-cache", "performance/io-cache", "!nfsperf", "off", NO_DOC, 0}, - {"performance.nfs.quick-read", "performance/quick-read", "!nfsperf", "off", NO_DOC, 0}, - {"performance.nfs.stat-prefetch", "performance/md-cache", "!nfsperf", "off", NO_DOC, 0}, - {"performance.nfs.io-threads", "performance/io-threads", "!nfsperf", "off", NO_DOC, 0}, - - {VKEY_MARKER_XTIME, "features/marker", "xtime", "off", NO_DOC, OPT_FLAG_FORCE}, - {VKEY_MARKER_XTIME, "features/marker", "!xtime", "off", NO_DOC, OPT_FLAG_FORCE}, - {"debug.trace", "debug/trace", "!debug","off", NO_DOC, 0}, - {"debug.error-gen", "debug/error-gen", "!debug","off", NO_DOC, 0}, - - {"nfs.enable-ino32", "nfs/server", "nfs.enable-ino32", NULL, GLOBAL_DOC, 0}, - {"nfs.mem-factor", "nfs/server", "nfs.mem-factor", NULL, GLOBAL_DOC, 0}, - {"nfs.export-dirs", "nfs/server", "nfs3.export-dirs", NULL, GLOBAL_DOC, 0}, - {"nfs.export-volumes", "nfs/server", "nfs3.export-volumes", NULL, GLOBAL_DOC, 0}, - {"nfs.addr-namelookup", "nfs/server", "rpc-auth.addr.namelookup", NULL, GLOBAL_DOC, 0}, - {"nfs.dynamic-volumes", "nfs/server", "nfs.dynamic-volumes", NULL, GLOBAL_NO_DOC, 0}, - {"nfs.register-with-portmap", "nfs/server", "rpc.register-with-portmap", NULL, GLOBAL_DOC, 0}, - {"nfs.port", "nfs/server", "nfs.port", NULL, GLOBAL_DOC, 0}, - - {"nfs.rpc-auth-unix", "nfs/server", "!rpc-auth.auth-unix.*", NULL, DOC, 0}, - {"nfs.rpc-auth-null", "nfs/server", "!rpc-auth.auth-null.*", NULL, DOC, 0}, - {"nfs.rpc-auth-allow", "nfs/server", "!rpc-auth.addr.*.allow", NULL, DOC, 0}, - {"nfs.rpc-auth-reject", "nfs/server", "!rpc-auth.addr.*.reject", NULL, DOC, 0}, - {"nfs.ports-insecure", "nfs/server", "!rpc-auth.ports.*.insecure", NULL, DOC, 0}, - {"nfs.transport-type", "nfs/server", "!nfs.transport-type", NULL, DOC, 0}, - - {"nfs.trusted-sync", "nfs/server", "!nfs3.*.trusted-sync", NULL, DOC, 0}, - {"nfs.trusted-write", "nfs/server", "!nfs3.*.trusted-write", NULL, DOC, 0}, - {"nfs.volume-access", "nfs/server", "!nfs3.*.volume-access", NULL, DOC, 0}, - {"nfs.export-dir", "nfs/server", "!nfs3.*.export-dir", NULL, DOC, 0}, - {NFS_DISABLE_MAP_KEY, "nfs/server", "!nfs-disable", NULL, DOC, 0}, - {"nfs.nlm", "nfs/server", "nfs.nlm", NULL, GLOBAL_DOC, 0}, - {"nfs.mount-udp", "nfs/server", "nfs.mount-udp", NULL, GLOBAL_DOC, 0}, - {"nfs.server-aux-gids", "nfs/server", "nfs.server-aux-gids", NULL, NO_DOC, 0}, - - {VKEY_FEATURES_QUOTA, "features/marker", "quota", "off", NO_DOC, OPT_FLAG_FORCE}, - {VKEY_FEATURES_LIMIT_USAGE, "features/quota", "limit-set", NULL, NO_DOC, 0}, - {"features.quota-timeout", "features/quota", "timeout", "0", DOC, 0}, - {"server.statedump-path", "protocol/server", "statedump-path", NULL, DOC, 0}, - {"features.lock-heal", "protocol/client", "lk-heal", NULL, NO_DOC, 0}, - {"features.lock-heal", "protocol/server", "lk-heal", NULL, DOC, 0}, - {"features.grace-timeout", "protocol/client", "grace-timeout", NULL, NO_DOC, 0}, - {"features.grace-timeout", "protocol/server", "grace-timeout", NULL, DOC, 0}, - {"features.read-only", "features/read-only", "!read-only", "off", DOC, 0}, - {"features.worm", "features/worm", "!worm", "off", DOC, 0}, - {"storage.linux-aio", "storage/posix", NULL, NULL, DOC, 0}, - {"storage.owner-uid", "storage/posix", "brick-uid", NULL, DOC, 0}, - {"storage.owner-gid", "storage/posix", "brick-gid", NULL, DOC, 0}, - {"config.memory-accounting", "configuration", "!config", NULL, DOC, 0}, - {"config.transport", "configuration", "!config", NULL, DOC, 0}, + {"transport.keepalive", "protocol/server", "transport.socket.keepalive", NULL, NO_DOC, 0, 1}, + {"server.allow-insecure", "protocol/server", "rpc-auth-allow-insecure", NULL, NO_DOC, 0, 1}, + {"server.statedump-path", "protocol/server", "statedump-path", NULL, DOC, 0, 1}, + {"features.lock-heal", "protocol/server", "lk-heal", NULL, NO_DOC, 0, 1}, + {"features.grace-timeout", "protocol/server", "grace-timeout", NULL, NO_DOC, 0, 1}, + {"server.ssl", "protocol/server", "transport.socket.ssl-enabled", NULL, NO_DOC, 0, 2}, + + /* Performance xlators enable/disbable options */ + {"performance.write-behind", "performance/write-behind", "!perf", "on", NO_DOC, 0, 1}, + {"performance.read-ahead", "performance/read-ahead", "!perf", "on", NO_DOC, 0, 1}, + {"performance.io-cache", "performance/io-cache", "!perf", "on", NO_DOC, 0, 1}, + {"performance.quick-read", "performance/quick-read", "!perf", "on", NO_DOC, 0, 1}, + {"performance.stat-prefetch", "performance/md-cache", "!perf", "on", NO_DOC, 0, 1}, + {"performance.client-io-threads", "performance/io-threads", "!perf", "off", NO_DOC, 0, 1}, + + {"performance.nfs.write-behind", "performance/write-behind", "!nfsperf", "off", NO_DOC, 0, 1}, + {"performance.nfs.read-ahead", "performance/read-ahead", "!nfsperf", "off", NO_DOC, 0, 1}, + {"performance.nfs.io-cache", "performance/io-cache", "!nfsperf", "off", NO_DOC, 0, 1}, + {"performance.nfs.quick-read", "performance/quick-read", "!nfsperf", "off", NO_DOC, 0, 1}, + {"performance.nfs.stat-prefetch", "performance/md-cache", "!nfsperf", "off", NO_DOC, 0, 1}, + {"performance.nfs.io-threads", "performance/io-threads", "!nfsperf", "off", NO_DOC, 0, 1}, + + /* Quota xlator options */ + {VKEY_FEATURES_LIMIT_USAGE, "features/quota", "limit-set", NULL, NO_DOC, 0, 1}, + {"features.quota-timeout", "features/quota", "timeout", "0", DOC, 0, 1}, + + /* Marker xlator options */ + {VKEY_MARKER_XTIME, "features/marker", "xtime", "off", NO_DOC, OPT_FLAG_FORCE, 1}, + {VKEY_MARKER_XTIME, "features/marker", "!xtime", "off", NO_DOC, OPT_FLAG_FORCE, 1}, + {VKEY_FEATURES_QUOTA, "features/marker", "quota", "off", NO_DOC, OPT_FLAG_FORCE, 1}, + + /* Debug xlators options */ + {"debug.trace", "debug/trace", "!debug","off", NO_DOC, 0, 1}, + {"debug.error-gen", "debug/error-gen", "!debug","off", NO_DOC, 0, 1}, + + /* NFS xlator options */ + {"nfs.enable-ino32", "nfs/server", "nfs.enable-ino32", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.mem-factor", "nfs/server", "nfs.mem-factor", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.export-dirs", "nfs/server", "nfs3.export-dirs", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.export-volumes", "nfs/server", "nfs3.export-volumes", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.addr-namelookup", "nfs/server", "rpc-auth.addr.namelookup", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.dynamic-volumes", "nfs/server", "nfs.dynamic-volumes", NULL, GLOBAL_NO_DOC, 0, 1}, + {"nfs.register-with-portmap", "nfs/server", "rpc.register-with-portmap", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.port", "nfs/server", "nfs.port", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.rpc-auth-unix", "nfs/server", "!rpc-auth.auth-unix.*", NULL, DOC, 0, 1}, + {"nfs.rpc-auth-null", "nfs/server", "!rpc-auth.auth-null.*", NULL, DOC, 0, 1}, + {"nfs.rpc-auth-allow", "nfs/server", "!rpc-auth.addr.*.allow", NULL, DOC, 0, 1}, + {"nfs.rpc-auth-reject", "nfs/server", "!rpc-auth.addr.*.reject", NULL, DOC, 0, 1}, + {"nfs.ports-insecure", "nfs/server", "!rpc-auth.ports.*.insecure", NULL, DOC, 0, 1}, + {"nfs.transport-type", "nfs/server", "!nfs.transport-type", NULL, DOC, 0, 1}, + {"nfs.trusted-sync", "nfs/server", "!nfs3.*.trusted-sync", NULL, DOC, 0, 1}, + {"nfs.trusted-write", "nfs/server", "!nfs3.*.trusted-write", NULL, DOC, 0, 1}, + {"nfs.volume-access", "nfs/server", "!nfs3.*.volume-access", NULL, DOC, 0, 1}, + {"nfs.export-dir", "nfs/server", "!nfs3.*.export-dir", NULL, DOC, 0, 1}, + {NFS_DISABLE_MAP_KEY, "nfs/server", "!nfs-disable", NULL, DOC, 0, 1}, + {"nfs.nlm", "nfs/server", "nfs.nlm", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.mount-udp", "nfs/server", "nfs.mount-udp", NULL, GLOBAL_DOC, 0, 1}, + {"nfs.server-aux-gids", "nfs/server", "nfs.server-aux-gids", NULL, NO_DOC, 0, 2}, + + /* Other options which don't fit any place above */ + {"features.read-only", "features/read-only", "!read-only", "off", DOC, 0, 2}, + {"features.worm", "features/worm", "!worm", "off", DOC, 0, 2}, + + {"storage.linux-aio", "storage/posix", NULL, NULL, DOC, 0, 2}, + {"storage.owner-uid", "storage/posix", "brick-uid", NULL, DOC, 0, 2}, + {"storage.owner-gid", "storage/posix", "brick-gid", NULL, DOC, 0, 2}, + {"config.memory-accounting", "configuration", "!config", NULL, DOC, 0, 2}, + {"config.transport", "configuration", "!config", NULL, DOC, 0, 2}, {NULL, } }; @@ -2962,7 +2969,7 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict) else get_transport_type (voliter, voliter->dict, nfs_xprt, _gf_true); - ret = dict_set_str (set_dict, VKEY_PERF_STAT_PREFETCH, "off"); + ret = dict_set_str (set_dict, "performance.stat-prefetch", "off"); if (ret) goto out; @@ -3765,3 +3772,20 @@ out: gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; } + +uint32_t +glusterd_get_op_version_for_key (char *key) +{ + char *completion = NULL; + struct volopt_map_entry *vmep = NULL; + int ret = 0; + + COMPLETE_OPTION(key, completion, ret); + for (vmep = glusterd_volopt_map; vmep->key; vmep++) { + if (strcmp (vmep->key, key) == 0) { + return vmep->op_version; + } + } + + return 0; +} diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h index f8279f6c9d3..39e19e5a883 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.h +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h @@ -24,7 +24,6 @@ #define VKEY_FEATURES_LIMIT_USAGE "features.limit-usage" #define VKEY_MARKER_XTIME GEOREP".indexing" #define VKEY_FEATURES_QUOTA "features.quota" -#define VKEY_PERF_STAT_PREFETCH "performance.stat-prefetch" typedef enum { GF_CLIENT_TRUSTED, @@ -56,6 +55,17 @@ typedef enum gd_volopt_flags_ { OPT_FLAG_FORCE = 1, } gd_volopt_flags_t; +typedef enum { DOC, NO_DOC, GLOBAL_DOC, GLOBAL_NO_DOC } option_type_t; + +struct volopt_map_entry { + char *key; + char *voltype; + char *option; + char *value; + option_type_t type; + uint32_t flags; + uint32_t op_version; +}; int glusterd_create_rb_volfiles (glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo); @@ -88,4 +98,7 @@ char* glusterd_get_trans_type_rb (gf_transport_type ttype); int glusterd_check_nfs_volfile_identical (gf_boolean_t *identical); + +uint32_t +glusterd_get_op_version_for_key (char *key); #endif |