MCPcopy Create free account
hub / github.com/apache/mesos / create

Method create

src/slave/containerizer/mesos/containerizer.cpp:177–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175namespace slave {
176
177Try<MesosContainerizer*> MesosContainerizer::create(
178 const Flags& flags,
179 bool local,
180 Fetcher* fetcher,
181 GarbageCollector* gc,
182 SecretResolver* secretResolver,
183 const Option<NvidiaComponents>& nvidia,
184 VolumeGidManager* volumeGidManager,
185 PendingFutureTracker* futureTracker,
186 CSIServer* csiServer)
187{
188 Try<hashset<string>> isolations = [&flags]() -> Try<hashset<string>> {
189 const vector<string> tokens(strings::tokenize(flags.isolation, ","));
190 hashset<string> isolations(set<string>(tokens.begin(), tokens.end()));
191
192 if (tokens.size() != isolations.size()) {
193 return Error("Duplicate entries found in --isolation flag '" +
194 stringify(tokens) + "'");
195 }
196
197 return isolations;
198 }();
199
200 if (isolations.isError()) {
201 return Error(isolations.error());
202 }
203
204 const hashmap<string, vector<string>> deprecations = {
205#ifdef __WINDOWS__
206 {"process", {"windows/cpu", "windows/mem"}},
207#else
208 {"process", {"posix/cpu", "posix/mem"}},
209#endif // __WINDOWS__
210
211#ifdef __linux__
212 {"cgroups", {"cgroups/cpu", "cgroups/mem"}},
213#endif // __linux__
214
215 {"posix/disk", {"disk/du"}}
216 };
217
218 // Replace any deprecated isolator names with their current equivalents.
219 foreachpair (const string& name,
220 const vector<string>& replacements,
221 deprecations) {
222 if (isolations->contains(name)) {
223 LOG(WARNING)
224 << "The '" << name << "' isolation flag is deprecated, "
225 << "please update your flags to"
226 << " '--isolation=" << strings::join(",", replacements) << "'.";
227
228 isolations->erase(name);
229
230 foreach (const string& isolator, replacements) {
231 isolations->insert(isolator);
232 }
233 }
234 }

Callers

nothing calls this directly

Calls 15

tokenizeFunction · 0.85
startsWithFunction · 0.85
isAvailableFunction · 0.85
cloneSealedFileFunction · 0.85
insertMethod · 0.80
shareMethod · 0.80
errorMethod · 0.65
ErrorFunction · 0.50
stringifyFunction · 0.50
createFunction · 0.50
joinFunction · 0.50
beginMethod · 0.45

Tested by

no test coverage detected