| 131 | |
| 132 | |
| 133 | int main(int argc, char** argv) |
| 134 | { |
| 135 | // The order of initialization of various master components is as follows: |
| 136 | // * Validate flags. |
| 137 | // * Logging. |
| 138 | // * Log build information. |
| 139 | // * Libprocess. |
| 140 | // * Version process. |
| 141 | // * Firewall rules: should be initialized before initializing HTTP endpoints. |
| 142 | // * Modules: Load module libraries and manifests before they |
| 143 | // can be instantiated. |
| 144 | // * Anonymous modules: Later components such as Allocators, and master |
| 145 | // contender/detector might depend upon anonymous modules. |
| 146 | // * Hooks. |
| 147 | // * Allocator. |
| 148 | // * Registry storage. |
| 149 | // * State. |
| 150 | // * Master contender. |
| 151 | // * Master detector. |
| 152 | // * Authorizer. |
| 153 | // * Slave removal rate limiter. |
| 154 | // * `Master` process. |
| 155 | // |
| 156 | // TODO(avinash): Add more comments discussing the rationale behind for this |
| 157 | // particular component ordering. |
| 158 | |
| 159 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
| 160 | |
| 161 | master::Flags flags; |
| 162 | |
| 163 | Try<flags::Warnings> load = flags.load("MESOS_", argc, argv); |
| 164 | |
| 165 | if (flags.help) { |
| 166 | cout << flags.usage() << endl; |
| 167 | return EXIT_SUCCESS; |
| 168 | } |
| 169 | |
| 170 | if (flags.version) { |
| 171 | cout << "mesos" << " " << MESOS_VERSION << endl; |
| 172 | return EXIT_SUCCESS; |
| 173 | } |
| 174 | |
| 175 | if (load.isError()) { |
| 176 | cerr << load.error() << "\n\n" |
| 177 | << "See `mesos-master --help` for a list of supported flags." << endl; |
| 178 | return EXIT_FAILURE; |
| 179 | } |
| 180 | |
| 181 | logging::initialize(argv[0], true, flags); // Catch signals. |
| 182 | |
| 183 | // Log any flag warnings (after logging is initialized). |
| 184 | foreach (const flags::Warning& warning, load->warnings) { |
| 185 | LOG(WARNING) << warning.message; |
| 186 | } |
| 187 | |
| 188 | // Check that master's version has the expected format (SemVer). |
| 189 | { |
| 190 | Try<Version> version = Version::parse(MESOS_VERSION); |
nothing calls this directly
no test coverage detected