> On 九月 22, 2016, 10:14 p.m., Guangya Liu wrote:
> > src/common/resources.cpp, line 677
> > <https://reviews.apache.org/r/51999/diff/3/?file=1506811#file1506811line677>
> >
> > 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`.
>
> Anindya Sinha wrote:
> I am not sure I understand your concern. In `fromJsonString()` [actually
> `convertJson()`] and `fromSimpleString()`, we call `Resources::validate()` to
> validate each of the `Resource` objects (which captures negative valued
> resource, etc. as an Error). In addition, we call
> `internal::validateCommandLineResources` from `Resources::parse()` after
> getting the `vector<Resource>` from `fromJsonString()` and
> `fromSimpleString()` to validate again the resource containing persistent
> volume, dynamic reservation, etc. So, I think we are covered on your case.
>
> Secondly, can you please explain what you mean by 'role' validation from
> point # 2 above.
1) I think we cannot call `Resources::validate()` in `fromSimpleString()`, as
the input is from flags text and we cannot specify reservation etc, so we need
to make sure there is no reservation etc after `fromSimpleString()`. But in
`fromSimpleString()`, you are actually calling `Resources::validate()` which
will think that having reservation etc is also valid, that's why I propose call
`internal::validateCommandLineResources` instead.
2) Another point I want to mention is when calling `fromSimpleString()` and
using `internal::validateCommandLineResources`, we should also validate `roles`
as here we are also setting roles for the resource object, so we also need to
add role validation logic, otherwise, there will be no error when parsing
`cpus:45.55;disks:{-xx}`, (NOTE: `disks:{-xx}` is not valid)
- Guangya
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51999/#review150081
-----------------------------------------------------------
On 九月 26, 2016, 8:58 p.m., Anindya Sinha wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51999/
> -----------------------------------------------------------
>
> (Updated 九月 26, 2016, 8:58 p.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 0774ff0669e831494d5b12b88e19dfa0a4a3f757
> src/tests/resources_tests.cpp 3e493007d6d1d8194d07035aaa1cde28dedf2b5a
> src/v1/resources.cpp 62a644ebbd13cfc0862bd118ba16c43e0f6aaf90
>
> Diff: https://reviews.apache.org/r/51999/diff/
>
>
> Testing
> -------
>
> All tests passed.
>
>
> Thanks,
>
> Anindya Sinha
>
>