diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2019-03-11 13:39:27 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2019-03-11 13:39:27 -0400 |
commit | 20c7b24f8cb947c90a905347c3debcd337a48036 (patch) | |
tree | 8d5609a6a2ebd62505c6fe3a9dbcdd00a838cf25 | |
parent | 2c0bebbfe5d458f5bef25ab28c12227402caa6cb (diff) | |
download | mongo-20c7b24f8cb947c90a905347c3debcd337a48036.tar.gz |
SERVER-39132 Separate out options that are not related to mongocryptd
-rw-r--r-- | src/mongo/db/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/mongod_options.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/server_options_general.idl | 49 | ||||
-rw-r--r-- | src/mongo/db/server_options_nongeneral.idl | 92 | ||||
-rw-r--r-- | src/mongo/db/server_options_test.cpp | 17 | ||||
-rw-r--r-- | src/mongo/s/mongos_options_init.cpp | 8 |
6 files changed, 113 insertions, 56 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index d988cf0d6ee..a9389aaad96 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -407,6 +407,7 @@ env.Library( 'server_options_base.cpp', env.Idlc('server_options_base.idl')[0], env.Idlc('server_options_general.idl')[0], + env.Idlc('server_options_nongeneral.idl')[0], ], LIBDEPS=[ '$BUILD_DIR/mongo/base', diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp index 8a174df4c9b..2312596120a 100644 --- a/src/mongo/db/mongod_options.cpp +++ b/src/mongo/db/mongod_options.cpp @@ -49,6 +49,7 @@ #include "mongo/db/repl/repl_settings.h" #include "mongo/db/server_options.h" #include "mongo/db/server_options_base.h" +#include "mongo/db/server_options_nongeneral_gen.h" #include "mongo/db/server_options_server_helpers.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" @@ -78,6 +79,7 @@ std::string storageDBPathDescription() { Status addMongodOptions(moe::OptionSection* options) try { uassertStatusOK(addGeneralServerOptions(options)); + uassertStatusOK(addNonGeneralServerOptions(options)); uassertStatusOK(addMongodGeneralOptions(options)); uassertStatusOK(addMongodReplicationOptions(options)); uassertStatusOK(addMongodShardingOptions(options)); diff --git a/src/mongo/db/server_options_general.idl b/src/mongo/db/server_options_general.idl index a593fe1d993..e6183be0c5d 100644 --- a/src/mongo/db/server_options_general.idl +++ b/src/mongo/db/server_options_general.idl @@ -69,15 +69,6 @@ configs: hidden: true default: 30 - 'net.bindIp': - description: 'Comma separated list of ip addresses to listen on - localhost by default' - short_name: bind_ip - arg_vartype: String - 'net.bindIpAll': - description: 'Bind to all ip addresses' - short_name: bind_ip_all - arg_vartype: Switch - canonicalize: canonicalizeNetBindIpAll 'net.ipv6': description: 'Enable IPv6 support (disabled by default)' short_name: ipv6 @@ -122,36 +113,6 @@ configs: description: 'Full path to time zone info directory, e.g. /usr/share/zoneinfo' short_name: timeZoneInfo arg_vartype: String - 'security.keyFile': - description: 'Private key for cluster authentication' - short_name: keyFile - arg_vartype: String - conflicts: noauth - noauth: - description: 'Run without security' - arg_vartype: Switch - source: [ cli, ini ] - conflicts: - - auth - - 'security.keyFile' - - 'security.transitionToAuth' - - clusterAuthMode - 'security.transitionToAuth': - description: >- - For rolling access control upgrade. Attempt to authenticate over outgoing - connections and proceed regardless of success. Accept incoming connections - with or without authentication. - short_name: transitionToAuth - arg_vartype: Switch - conflicts: noauth - 'security.clusterAuthMode': - description: >- - Authentication mode used for cluster authentication. Alternatives are - (keyFile|sendKeyFile|sendX509|x509) - short_name: clusterAuthMode - arg_vartype: String - validator: - callback: validateSecurityClusterAuthModeSetting nounixsocket: description: 'Disable listening on unix sockets' @@ -208,14 +169,4 @@ configs: arg_vartype: Switch source: [ cli, ini ] hidden: true - 'operationProfiling.slowOpThresholdMs': - description: 'Value of slow for profile and console log' - short_name: slowms - arg_vartype: Int - default: 100 - 'operationProfiling.slowOpSampleRate': - description: 'Fraction of slow ops to include in the profile and console log' - short_name: slowOpSampleRate - arg_vartype: Double - default: 1.0 diff --git a/src/mongo/db/server_options_nongeneral.idl b/src/mongo/db/server_options_nongeneral.idl new file mode 100644 index 00000000000..b561fb5ce1a --- /dev/null +++ b/src/mongo/db/server_options_nongeneral.idl @@ -0,0 +1,92 @@ +# Copyright (C) 2019-present MongoDB, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the Server Side Public License, version 1, +# as published by MongoDB, Inc. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Server Side Public License for more details. +# +# You should have received a copy of the Server Side Public License +# along with this program. If not, see +# <http://www.mongodb.com/licensing/server-side-public-license>. +# +# As a special exception, the copyright holders give permission to link the +# code of portions of this program with the OpenSSL library under certain +# conditions as described in each individual source file and distribute +# linked combinations including the program with the OpenSSL library. You +# must comply with the Server Side Public License in all respects for +# all of the code used other than as permitted herein. If you modify file(s) +# with this exception, you may extend this exception to your version of the +# file(s), but you are not obligated to do so. If you do not wish to do so, +# delete this exception statement from your version. If you delete this +# exception statement from all source files in the program, then also delete +# it in the license file. +# + +global: + cpp_namespace: "mongo" + cpp_includes: + - "mongo/db/server_options.h" + - "mongo/db/server_options_base.h" + configs: + section: 'General options' + source: [ cli, ini, yaml ] + initializer: + register: addNonGeneralServerOptions + +# These are the general options that are supported by mongod and mongos but not cryptd. +configs: + 'net.bindIp': + description: 'Comma separated list of ip addresses to listen on - localhost by default' + short_name: bind_ip + arg_vartype: String + 'net.bindIpAll': + description: 'Bind to all ip addresses' + short_name: bind_ip_all + arg_vartype: Switch + canonicalize: canonicalizeNetBindIpAll + + 'security.keyFile': + description: 'Private key for cluster authentication' + short_name: keyFile + arg_vartype: String + conflicts: noauth + noauth: + description: 'Run without security' + arg_vartype: Switch + source: [ cli, ini ] + conflicts: + - auth + - 'security.keyFile' + - 'security.transitionToAuth' + - clusterAuthMode + 'security.transitionToAuth': + description: >- + For rolling access control upgrade. Attempt to authenticate over outgoing + connections and proceed regardless of success. Accept incoming connections + with or without authentication. + short_name: transitionToAuth + arg_vartype: Switch + conflicts: noauth + 'security.clusterAuthMode': + description: >- + Authentication mode used for cluster authentication. Alternatives are + (keyFile|sendKeyFile|sendX509|x509) + short_name: clusterAuthMode + arg_vartype: String + validator: + callback: validateSecurityClusterAuthModeSetting + + 'operationProfiling.slowOpThresholdMs': + description: 'Value of slow for profile and console log' + short_name: slowms + arg_vartype: Int + default: 100 + 'operationProfiling.slowOpSampleRate': + description: 'Fraction of slow ops to include in the profile and console log' + short_name: slowOpSampleRate + arg_vartype: Double + default: 1.0 diff --git a/src/mongo/db/server_options_test.cpp b/src/mongo/db/server_options_test.cpp index a03b26ca515..23217b7da78 100644 --- a/src/mongo/db/server_options_test.cpp +++ b/src/mongo/db/server_options_test.cpp @@ -51,6 +51,7 @@ #include "mongo/bson/util/builder.h" #include "mongo/db/server_options.h" #include "mongo/db/server_options_base.h" +#include "mongo/db/server_options_nongeneral_gen.h" #include "mongo/db/server_options_server_helpers.h" #include "mongo/logger/logger.h" #include "mongo/unittest/unittest.h" @@ -570,7 +571,7 @@ TEST(SetupOptions, SlowMsCommandLineParamParsesSuccessfully) { moe::Environment environment; moe::OptionSection options; - ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -594,6 +595,7 @@ TEST(SetupOptions, SlowMsParamInitializedSuccessfullyFromINIConfigFile) { moe::OptionSection options; ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -619,6 +621,7 @@ TEST(SetupOptions, SlowMsParamInitializedSuccessfullyFromYAMLConfigFile) { moe::OptionSection options; ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -645,7 +648,7 @@ TEST(SetupOptions, NonNumericSlowMsCommandLineOptionFailsToParse) { moe::Environment environment; moe::OptionSection options; - ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -661,7 +664,7 @@ TEST(SetupOptions, NonNumericSlowMsYAMLConfigOptionFailsToParse) { moe::Environment environment; moe::OptionSection options; - ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -681,7 +684,7 @@ TEST(SetupOptions, SampleRateCommandLineParamParsesSuccessfully) { moe::Environment environment; moe::OptionSection options; - ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -705,6 +708,7 @@ TEST(SetupOptions, SampleRateParamInitializedSuccessfullyFromINIConfigFile) { moe::OptionSection options; ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -730,6 +734,7 @@ TEST(SetupOptions, SampleRateParamInitializedSuccessfullyFromYAMLConfigFile) { moe::OptionSection options; ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -756,7 +761,7 @@ TEST(SetupOptions, NonNumericSampleRateCommandLineOptionFailsToParse) { moe::Environment environment; moe::OptionSection options; - ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); @@ -773,7 +778,7 @@ TEST(SetupOptions, NonNumericSampleRateYAMLConfigOptionFailsToParse) { moe::OptionSection options; - ASSERT_OK(::mongo::addGeneralServerOptions(&options)); + ASSERT_OK(::mongo::addNonGeneralServerOptions(&options)); std::vector<std::string> argv; argv.push_back("binaryname"); diff --git a/src/mongo/s/mongos_options_init.cpp b/src/mongo/s/mongos_options_init.cpp index 7d68ff01a3e..3b10a7a2ce0 100644 --- a/src/mongo/s/mongos_options_init.cpp +++ b/src/mongo/s/mongos_options_init.cpp @@ -34,6 +34,7 @@ #include <iostream> #include "mongo/db/server_options_base.h" +#include "mongo/db/server_options_nongeneral_gen.h" #include "mongo/util/exit_code.h" #include "mongo/util/options_parser/startup_option_init.h" #include "mongo/util/options_parser/startup_options.h" @@ -41,7 +42,12 @@ namespace mongo { MONGO_GENERAL_STARTUP_OPTIONS_REGISTER(MongosOptions)(InitializerContext* context) { - return addGeneralServerOptions(&moe::startupOptions); + auto status = addGeneralServerOptions(&moe::startupOptions); + if (!status.isOK()) { + return status; + } + + return addNonGeneralServerOptions(&moe::startupOptions); } MONGO_INITIALIZER_GENERAL(MongosOptions, |