You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Andrei Sekretenko <as...@mesosphere.io> on 2019/12/03 17:53:17 UTC

Review Request 71861: Moved creating authz Object out of `Master::authorizeResizeVolume`.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71861/
-----------------------------------------------------------

Review request for mesos, Benjamin Bannier and Benjamin Mahler.


Bugs: MESOS-10023 and MESOS-10056
    https://issues.apache.org/jira/browse/MESOS-10023
    https://issues.apache.org/jira/browse/MESOS-10056


Repository: mesos


Description
-------

Moved creating authz Object out of `Master::authorizeResizeVolume`.


Diffs
-----

  src/master/authorization.hpp PRE-CREATION 
  src/master/authorization.cpp PRE-CREATION 
  src/master/http.cpp e03655863ea2d4e4464b3d14b359de3d7f059778 
  src/master/master.hpp 93630421d58e6fd26566e81a23cd910957795665 
  src/master/master.cpp 14b90a5e276df055bb8a570331f27cab200c9869 


Diff: https://reviews.apache.org/r/71861/diff/1/


Testing
-------


Thanks,

Andrei Sekretenko


Re: Review Request 71861: Moved creating authz Object out of `Master::authorizeResizeVolume`.

Posted by Andrei Sekretenko <as...@mesosphere.io>.

> On Dec. 4, 2019, 7:41 p.m., Benjamin Mahler wrote:
> > src/master/authorization.cpp
> > Lines 98-100 (patched)
> > <https://reviews.apache.org/r/71861/diff/2/?file=2181937#file2181937line98>
> >
> >     everything after "since" is only really relevant to RESERVE or UNRESERVE (pushing or popping)
> >     
> >     I think this function should probably be renamed to `getLegacyValue(...)` and the explanation of what the legacy `value` field is set to for a resource, and why.

Thanks; rewrote that old comment, hopefully now it can help reader understand why this function does what it does. 

I don't think that `getLegacyValue(...)` is a proper name, as for some other operations the legacy `value` is obtained by completely different means.

Left it as `static getReservationRole()`, but might be worth renaming into something like `getEffectiveReservationRole()`/`getLegacyReservationRole()`/...


- Andrei


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71861/#review218920
-----------------------------------------------------------


On Jan. 2, 2020, 8:01 p.m., Andrei Sekretenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/71861/
> -----------------------------------------------------------
> 
> (Updated Jan. 2, 2020, 8:01 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier and Benjamin Mahler.
> 
> 
> Bugs: MESOS-10023 and MESOS-10056
>     https://issues.apache.org/jira/browse/MESOS-10023
>     https://issues.apache.org/jira/browse/MESOS-10056
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Moved creating authz Object out of `Master::authorizeResizeVolume`.
> 
> 
> Diffs
> -----
> 
>   src/master/authorization.hpp PRE-CREATION 
>   src/master/authorization.cpp PRE-CREATION 
>   src/master/http.cpp 72587bf054e413402ebf4c6ff8060f7ca8ffcf1b 
>   src/master/master.hpp f97b085ae908278731acd326df68f9f381f09483 
>   src/master/master.cpp 14b90a5e276df055bb8a570331f27cab200c9869 
> 
> 
> Diff: https://reviews.apache.org/r/71861/diff/3/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Andrei Sekretenko
> 
>


Re: Review Request 71861: Moved creating authz Object out of `Master::authorizeResizeVolume`.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71861/#review218920
-----------------------------------------------------------




src/master/authorization.hpp
Lines 38-46 (patched)
<https://reviews.apache.org/r/71861/#comment306837>

    This constructor seems really unfortunate to me, it's pretty hard to know what it's for since it has no name (unlike a static function), and it seems like we don't want callers touching this, so we'd probably want whatever this is to be private?
    
    Seems like a private static helper would be best? That way we can keep a single clean (private) constructor:
    
    ```
    private:
      ActionObject(Action a, Object&& o) : action(a), object(std::move(o)) {};
      
      static ActionObject fromResourceWithLegacyValue(...);
    ```



src/master/authorization.hpp
Lines 44 (patched)
<https://reviews.apache.org/r/71861/#comment306836>

    Note the inconsistency between Action (here) and Action& (above), I commented on this argument in the initial patch so be sure to keep it consistent when you update this one.
    
    For enums (much like int or double), I think the style guide would prefer to just take it as non-const `Action action`.



src/master/authorization.cpp
Lines 42 (patched)
<https://reviews.apache.org/r/71861/#comment306838>

    Ditto from previous reviews w.r.t. assignment style



src/master/authorization.cpp
Lines 98-100 (patched)
<https://reviews.apache.org/r/71861/#comment306835>

    everything after "since" is only really relevant to RESERVE or UNRESERVE (pushing or popping)
    
    I think this function should probably be renamed to `getLegacyValue(...)` and the explanation of what the legacy `value` field is set to for a resource, and why.


- Benjamin Mahler


On Dec. 3, 2019, 5:53 p.m., Andrei Sekretenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/71861/
> -----------------------------------------------------------
> 
> (Updated Dec. 3, 2019, 5:53 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier and Benjamin Mahler.
> 
> 
> Bugs: MESOS-10023 and MESOS-10056
>     https://issues.apache.org/jira/browse/MESOS-10023
>     https://issues.apache.org/jira/browse/MESOS-10056
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Moved creating authz Object out of `Master::authorizeResizeVolume`.
> 
> 
> Diffs
> -----
> 
>   src/master/authorization.hpp PRE-CREATION 
>   src/master/authorization.cpp PRE-CREATION 
>   src/master/http.cpp 6d8485656982a4d556b042a6a3d95cfed21370d3 
>   src/master/master.hpp 93630421d58e6fd26566e81a23cd910957795665 
>   src/master/master.cpp 14b90a5e276df055bb8a570331f27cab200c9869 
> 
> 
> Diff: https://reviews.apache.org/r/71861/diff/2/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Andrei Sekretenko
> 
>


Re: Review Request 71861: Moved creating authz Object out of `Master::authorizeResizeVolume`.

Posted by Benjamin Mahler <bm...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71861/#review219146
-----------------------------------------------------------


Ship it!





src/master/http.cpp
Lines 158 (patched)
<https://reviews.apache.org/r/71861/#comment307251>

    Seems like this should go above with the other mesos::authorization using statements?


- Benjamin Mahler


On Jan. 2, 2020, 8:01 p.m., Andrei Sekretenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/71861/
> -----------------------------------------------------------
> 
> (Updated Jan. 2, 2020, 8:01 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier and Benjamin Mahler.
> 
> 
> Bugs: MESOS-10023 and MESOS-10056
>     https://issues.apache.org/jira/browse/MESOS-10023
>     https://issues.apache.org/jira/browse/MESOS-10056
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Moved creating authz Object out of `Master::authorizeResizeVolume`.
> 
> 
> Diffs
> -----
> 
>   src/master/authorization.hpp PRE-CREATION 
>   src/master/authorization.cpp PRE-CREATION 
>   src/master/http.cpp 72587bf054e413402ebf4c6ff8060f7ca8ffcf1b 
>   src/master/master.hpp f97b085ae908278731acd326df68f9f381f09483 
>   src/master/master.cpp 14b90a5e276df055bb8a570331f27cab200c9869 
> 
> 
> Diff: https://reviews.apache.org/r/71861/diff/3/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Andrei Sekretenko
> 
>


Re: Review Request 71861: Moved creating authz Object out of `Master::authorizeResizeVolume`.

Posted by Andrei Sekretenko <as...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71861/
-----------------------------------------------------------

(Updated Jan. 2, 2020, 8:01 p.m.)


Review request for mesos, Benjamin Bannier and Benjamin Mahler.


Bugs: MESOS-10023 and MESOS-10056
    https://issues.apache.org/jira/browse/MESOS-10023
    https://issues.apache.org/jira/browse/MESOS-10056


Repository: mesos


Description
-------

Moved creating authz Object out of `Master::authorizeResizeVolume`.


Diffs (updated)
-----

  src/master/authorization.hpp PRE-CREATION 
  src/master/authorization.cpp PRE-CREATION 
  src/master/http.cpp 72587bf054e413402ebf4c6ff8060f7ca8ffcf1b 
  src/master/master.hpp f97b085ae908278731acd326df68f9f381f09483 
  src/master/master.cpp 14b90a5e276df055bb8a570331f27cab200c9869 


Diff: https://reviews.apache.org/r/71861/diff/3/

Changes: https://reviews.apache.org/r/71861/diff/2-3/


Testing
-------


Thanks,

Andrei Sekretenko