----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/51999/#review150081 -----------------------------------------------------------
include/mesos/resources.hpp (lines 179 - 213) <https://reviews.apache.org/r/51999/#comment217900> I think we do not intend to expose those two APIs, so `private` them? include/mesos/resources.hpp (line 196) <https://reviews.apache.org/r/51999/#comment217902> This was only called by `Try<Resources> parse` and the `Try<Resources> parse` already defined the default value as `defaultRole` as star role, so we do not need to set the parameter `defaultRole` default to star role. But adding a default value may make the code more easy to understand. include/mesos/resources.hpp (line 213) <https://reviews.apache.org/r/51999/#comment217903> ditto src/common/resources.cpp (line 580) <https://reviews.apache.org/r/51999/#comment217904> Why not ``` Resources resources; ``` src/common/resources.cpp (line 670) <https://reviews.apache.org/r/51999/#comment217906> I think that we should still use `internal::validateCommandLineResources` as the command line resources should not have dynamic resevations etc. But there is a bug in `internal::validateCommandLineResources` now, as when I set a resource string as `cpus:45.55;ports:[10000-20000, 30000-50000];disks:{-xx}`, there will be no erros if using `internal::validateCommandLineResources` to validate. So I would suggest the following: 1) Continue use `internal::validateCommandLineResources` to validate resource. 2) Add `role` validation in `internal::validateCommandLineResources`. - Guangya Liu On 九月 21, 2016, 4:14 a.m., Anindya Sinha wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/51999/ > ----------------------------------------------------------- > > (Updated 九月 21, 2016, 4:14 a.m.) > > > Review request for mesos and Jiang Yan Xu. > > > Bugs: MESOS-6062 > https://issues.apache.org/jira/browse/MESOS-6062 > > > Repository: mesos > > > Description > ------- > > Refactored `Resources::parse()` into 2 separate static functions: > 1. Resources::fromJSONString() to parse JSON representation of > resources. > 2. Resources::fromSimpleString() to parse text representation of > resources. > > Since these 2 new functions return a `Try<vector<Resource>>`, the > existing `Resources::parse()` implicitly converts that to a > `Resources` object. This refactor is done to retrieve all resources > (include empty resources) required for auto detection of root > and MOUNT disks. > > > Diffs > ----- > > include/mesos/resources.hpp 3ef8cacee529addc745b4aeb6398d7606c61b749 > include/mesos/v1/resources.hpp ef56b4960b103a3efd916fab64796aa334ba44c6 > src/common/resources.cpp 4602bff22ec7ff77f069056085ad92bfa04595f3 > src/tests/resources_tests.cpp 3e493007d6d1d8194d07035aaa1cde28dedf2b5a > src/v1/resources.cpp 7c4db44d4c31a8295cc16b0ce1ef5adf314e6ac6 > > Diff: https://reviews.apache.org/r/51999/diff/ > > > Testing > ------- > > All tests passed. > > > Thanks, > > Anindya Sinha > >