diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-08-01 11:15:14 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-03 22:48:56 -0700 |
commit | 967199adb1d73138158b5ed0a3b818b3adf66cac (patch) | |
tree | 7a2acf5bbb463b1b8314cac7ccbfbd251a9d359d | |
parent | 893f52ec6318ba3083a6bf5c86bb495dc786ee5b (diff) |
nfs: fix default values of volume options for a much saner output in volume set help/help-xmlv3.1.6qa3
Change-Id: I083f760b63fc96f938d64a61f193f7426640966b
BUG: 2041
Reviewed-on: http://review.gluster.com/132
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
-rw-r--r-- | xlators/nfs/server/src/nfs.c | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index bdb8a1c9a..ebc6911b9 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -474,6 +474,7 @@ nfs_init_state (xlator_t *this) unsigned int fopspoolsize = 0; char *optstr = NULL; gf_boolean_t boolt = _gf_false; + char *def_val = NULL; if (!this) return NULL; @@ -498,7 +499,21 @@ nfs_init_state (xlator_t *this) goto free_nfs; } - nfs->memfactor = GF_NFS_DEFAULT_MEMFACTOR; + if (xlator_get_volopt_info (&this->volume_options, "nfs.mem-factor", + &def_val, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "nfs.mem-factor not found"); + ret = -1; + goto free_rpcsvc; + } else { + if (gf_string2uint (def_val, &nfs->memfactor)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "nfs.mem-factor corrupt"); + ret = -1; + goto free_rpcsvc; + } + } + if (dict_get (this->options, "nfs.mem-factor")) { ret = dict_get_str (this->options, "nfs.mem-factor", &optstr); @@ -544,7 +559,21 @@ nfs_init_state (xlator_t *this) nfs->dynamicvolumes = GF_NFS_DVM_ON; } - nfs->enable_ino32 = 0; + if (xlator_get_volopt_info (&this->volume_options, "nfs.enable-ino32", + &def_val, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "nfs.enable-ino32 not found"); + ret = -1; + goto free_foppool; + } else { + if (gf_string2boolean (def_val,(gf_boolean_t *) &nfs->enable_ino32 )) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "nfs.enable-ino32 corrupt"); + ret = -1; + goto free_foppool; + } + } + if (dict_get (this->options, "nfs.enable-ino32")) { ret = dict_get_str (this->options, "nfs.enable-ino32", &optstr); @@ -773,11 +802,13 @@ struct volume_options options[] = { { .key = {"nfs3.*.volume-access"}, .type = GF_OPTION_TYPE_STR, .value = {"read-only", "read-write"}, + .default_value = "read-write", .description = "Type of access desired for this subvolume: " " read-only, read-write(default)" }, { .key = {"nfs3.*.trusted-write"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", .description = "On an UNSTABLE write from client, return STABLE flag" " to force client to not send a COMMIT request. In " "some environments, combined with a replicated " @@ -792,6 +823,7 @@ struct volume_options options[] = { }, { .key = {"nfs3.*.trusted-sync"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", .description = "All writes and COMMIT requests are treated as async." " This implies that no write requests are guaranteed" " to be on server disks when the write reply is " @@ -801,6 +833,7 @@ struct volume_options options[] = { }, { .key = {"nfs3.*.export-dir"}, .type = GF_OPTION_TYPE_STR, + .default_value = "", .description = "By default, all subvolumes of nfs are exported as " "individual exports. There are cases where a " "subdirectory or subdirectories in the volume need to " @@ -811,6 +844,7 @@ struct volume_options options[] = { }, { .key = {"nfs3.export-dirs"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "on", .description = "By default, all subvolumes of nfs are exported as " "individual exports. There are cases where a " "subdirectory or subdirectories in the volume need to " @@ -820,6 +854,7 @@ struct volume_options options[] = { }, { .key = {"nfs3.export-volumes"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "on", .description = "Enable or disable exporting whole volumes, instead " "if used in conjunction with nfs3.export-dir, can " "allow setting up only subdirectories as exports. On " @@ -827,6 +862,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.auth-unix"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "", .description = "Disable or enable the AUTH_UNIX authentication type." "Must always be enabled for better interoperability." "However, can be disabled if needed. Enabled by" @@ -834,12 +870,14 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.auth-null"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "", .description = "Disable or enable the AUTH_NULL authentication type." "Must always be enabled. This option is here only to" " avoid unrecognized option warnings" }, { .key = {"rpc-auth.auth-unix.*"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "on", .description = "Disable or enable the AUTH_UNIX authentication type " "for a particular exported volume over-riding defaults" " and general setting for AUTH_UNIX scheme. Must " @@ -857,6 +895,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.addr.allow"}, .type = GF_OPTION_TYPE_STR, + .default_value = "", .description = "Allow a comma separated list of addresses and/or" " hostnames to connect to the server. By default, all" " connections are disallowed. This allows users to " @@ -864,6 +903,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.addr.reject"}, .type = GF_OPTION_TYPE_STR, + .default_value = "", .description = "Reject a comma separated list of addresses and/or" " hostnames from connecting to the server. By default," " all connections are disallowed. This allows users to" @@ -871,6 +911,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.addr.*.allow"}, .type = GF_OPTION_TYPE_STR, + .default_value = "", .description = "Allow a comma separated list of addresses and/or" " hostnames to connect to the server. By default, all" " connections are disallowed. This allows users to " @@ -878,6 +919,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.addr.*.reject"}, .type = GF_OPTION_TYPE_STR, + .default_value = "", .description = "Reject a comma separated list of addresses and/or" " hostnames from connecting to the server. By default," " all connections are disallowed. This allows users to" @@ -885,6 +927,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.ports.insecure"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", .description = "Allow client connections from unprivileged ports. By " "default only privileged ports are allowed. This is a" "global setting in case insecure ports are to be " @@ -892,6 +935,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.ports.*.insecure"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "", .description = "Allow client connections from unprivileged ports. By " "default only privileged ports are allowed. Use this" " option to set enable or disable insecure ports for " @@ -900,6 +944,7 @@ struct volume_options options[] = { }, { .key = {"rpc-auth.addr.namelookup"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "on", .description = "Users have the option of turning off name lookup for" " incoming client connections using this option. In some " "setups, the name server can take too long to reply to DNS " @@ -925,6 +970,7 @@ struct volume_options options[] = { }, { .key = {"nfs.enable-ino32"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", .description = "For nfs clients or apps that do not support 64-bit " "inode numbers, use this option to make NFS return " "32-bit inode numbers instead. Disabled by default so " @@ -932,6 +978,7 @@ struct volume_options options[] = { }, { .key = {"rpc.register-with-portmap"}, .type = GF_OPTION_TYPE_BOOL, + .default_value = "on", .description = "For systems that need to run multiple nfs servers, we" "need to prevent more than one from registering with " "portmap service. Use this option to turn off portmap " @@ -939,11 +986,13 @@ struct volume_options options[] = { }, { .key = {"nfs.port"}, .type = GF_OPTION_TYPE_INT, + .default_value = "", .description = "Use this option on systems that need Gluster NFS to " "be associated with a non-default port number." }, { .key = {"nfs.mem-factor"}, .type = GF_OPTION_TYPE_INT, + .default_value = "15", .description = "Use this option to make NFS be faster on systems by " "using more memory. This option specifies a multiple " "that determines the total amount of memory used. " @@ -952,9 +1001,10 @@ struct volume_options options[] = { "Please consult gluster-users list before using this " "option." }, - { .key = {"nfs3.*.disable"}, + { .key = {"nfs-disable"}, .type = GF_OPTION_TYPE_BOOL, - .description = "This option is used to start or stop NFS server" + .default_value = "off", + .description = "This option is used to enable/disable NFS server" "for individual volume." }, { .key = {NULL} }, |