----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/65590/#review197397 -----------------------------------------------------------
src/common/resources_utils.cpp Lines 290-311 (patched) <https://reviews.apache.org/r/65590/#comment277523> This can be simplified to ``` Option<ResourceProviderID> providerId = conversion.consumed.front().has_provider_id() ? resource.provider_id() : Option<ResourceProviderID>::none(); foreach (const Resource& resource, conversion.consumed) { Option<ResourceProviderId> _providerId = resource.has_provider_id() ? resource.provider_id() : Option<ResourceProviderID>::none(); if (providerId != _providerId) { return Error("Conversion works on multiple resource providers"); } } ``` or something else, as long as we can fail early when iterating over resources. src/common/resources_utils.cpp Lines 299-301 (patched) <https://reviews.apache.org/r/65590/#comment277522> Remove this. src/common/resources_utils.cpp Lines 313-327 (patched) <https://reviews.apache.org/r/65590/#comment277530> Do we need this here? This should be part of a validation that should have happened before calling this function. OTOH we can't be sure that this has been validated and we should document our assumptions made in this function. - Jan Schlicht On Feb. 9, 2018, 6:27 p.m., Benjamin Bannier wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/65590/ > ----------------------------------------------------------- > > (Updated Feb. 9, 2018, 6:27 p.m.) > > > Review request for mesos, Jie Yu and Jan Schlicht. > > > Bugs: MESOS-8382 > https://issues.apache.org/jira/browse/MESOS-8382 > > > Repository: mesos > > > Description > ------- > > Added helper function to determine provider ID of a conversion. > > > Diffs > ----- > > src/common/resources_utils.hpp 73d070d48eedf30468305e96fc4ad0005584fc79 > src/common/resources_utils.cpp 99b16e0d17b224eefa1e28f5f66c4284069c0e57 > > > Diff: https://reviews.apache.org/r/65590/diff/1/ > > > Testing > ------- > > `make check` > > > Thanks, > > Benjamin Bannier > >