> On Nov. 18, 2015, 8:05 a.m., Qian Zhang wrote: > > src/master/http.cpp, line 2097 > > <https://reviews.apache.org/r/40244/diff/2/?file=1125056#file1125056line2097> > > > > This comment may not be related to this patch. I am just curious, for > > ```required```, we have called ```flatten()``` to remove role from it when > > passing it into ```Master::Http::_operation()```. But here for > > ```offer->resources()```, we do not call ```flatten()``` to remove its > > role, so is it subtractable between ```required``` and > > ```offer->resources()```?
We `flatten` the resources for `/reserve` because the `required` represents the resources that we need in order to perform the reservation. Suppose we want to end up with 2 reserved cpus. We `flatten` it, and search for 2 unreserved cpus in the received offers. If we were to `flatten` the `offer.resources()` also, then an offer with 1 reserved cpu and 1 unreserved cpu would incorrectly satisfy our condition. In terms of subtractibility, that is determined on a per-resource basis, and non-subtractable resources are ignored. For example, `[(2 unreserved cpus)] - [(1 reserved cpu), (1 unreserved cpu)]` == `[(1 unreserved cpu)]`. - Michael ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/40244/#review106992 ----------------------------------------------------------- On Nov. 18, 2015, 11:27 a.m., Neil Conway wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/40244/ > ----------------------------------------------------------- > > (Updated Nov. 18, 2015, 11:27 a.m.) > > > Review request for mesos, Greg Mann and Michael Park. > > > Bugs: MESOS-2455 > https://issues.apache.org/jira/browse/MESOS-2455 > > > Repository: mesos > > > Description > ------- > > Clarified comments in Master::Http::_operation. > > > Diffs > ----- > > src/master/http.cpp 1c4f1406f5d917f5d655a7d61d311365f8999ce0 > > Diff: https://reviews.apache.org/r/40244/diff/ > > > Testing > ------- > > > Thanks, > > Neil Conway > >
