----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/52642/#review154888 -----------------------------------------------------------
Let's split the fix and the test into separate patches. src/master/master.cpp (line 3855) <https://reviews.apache.org/r/52642/#comment224676> `FrameworkInfo.role` is optional, though with a default value. First, do we want to rely on the default in the proto or make it explicit here? Second, if a framework is registered for the `*` role, is it allowed to reserve `*` resources? Afaik, we don't. Hence I wonder whether the check you've added into `validate()` is enough. src/master/validation.hpp (line 188) <https://reviews.apache.org/r/52642/#comment224679> Will `allowedRole` or `frameworkRole` be more descriptive? src/master/validation.cpp (lines 1452 - 1457) <https://reviews.apache.org/r/52642/#comment224675> IIUC, `role` here is the framework's role while `resource.role()` is the one for which resources are reserved. To me, the error message says quite the opposite. How about this: "A reserve operation was attempted for role '`resource.role()`', but allowed only for role '`role.get()`'. src/master/validation.cpp (lines 1452 - 1453) <https://reviews.apache.org/r/52642/#comment224677> Again, we rely on the default value for `Resource.role`, which is probably fine? src/tests/master_validation_tests.cpp (lines 221 - 250) <https://reviews.apache.org/r/52642/#comment224678> These tests were identical before your changes. Looks like we should audit all tests in this file, there may be more bugs lurking around. - Alexander Rukletsov On Oct. 24, 2016, 3:25 p.m., Gastón Kleiman wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/52642/ > ----------------------------------------------------------- > > (Updated Oct. 24, 2016, 3:25 p.m.) > > > Review request for mesos, Alexander Rukletsov and Michael Park. > > > Bugs: MESOS-6142 > https://issues.apache.org/jira/browse/MESOS-6142 > > > Repository: mesos > > > Description > ------- > > Don't allow a reservation if the framework role doesn't match the role > of all the resources. > > > Diffs > ----- > > src/master/http.cpp 05d29906a73fb049c085abca05b75ec68c259d26 > src/master/master.cpp 23ddb995b4ad0fcdb589974308a2e81ececdad31 > src/master/validation.hpp 035f721c610ae566c89a1cf0e65ff0df11679f15 > src/master/validation.cpp f690a9eacd278b51a52f5588dbeea377df074435 > src/tests/master_validation_tests.cpp > a5d8610bd61822cdf55cbc8d7056e5cf8fecfa54 > src/tests/reservation_tests.cpp 6c28ab4557f342134efce0ad7cb174a5adb4dc10 > > Diff: https://reviews.apache.org/r/52642/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Gastón Kleiman > >
