You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Zhitao Li <zh...@gmail.com> on 2018/03/13 22:49:08 UTC

Review Request 66050: Implement grow and shrink of persistent volume.

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

Review request for mesos, Chun-Hung Hsiao and Gaston Kleiman.


Bugs: MESOS-4965
    https://issues.apache.org/jira/browse/MESOS-4965


Repository: mesos


Description
-------

Implement grow and shrink of persistent volume.


Diffs
-----

  src/common/protobuf_utils.cpp 9c5fb97afb58f98013b79f3cbaea7dacc3603271 
  src/common/resources_utils.cpp 99b16e0d17b224eefa1e28f5f66c4284069c0e57 
  src/master/master.cpp 223ebf29ac4dd1dea9080e4bef4b2d4d064d847f 
  src/master/validation.hpp 7c129ceb929596acbb64d37025e055661277e6bf 
  src/master/validation.cpp 9254cd22e67d9aca53135701575fb0857ff6f7d6 
  src/tests/mesos.hpp 2c3d0c9350bbbbcd2223ff20c0797d1849d38c19 


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


Testing
-------


Thanks,

Zhitao Li


Re: Review Request 66050: Implemented grow and shrink of persistent volumes.

Posted by Zhitao Li <zh...@gmail.com>.

> On March 22, 2018, 3:43 p.m., Chun-Hung Hsiao wrote:
> > src/master/validation.cpp
> > Lines 2354 (patched)
> > <https://reviews.apache.org/r/66050/diff/3/?file=1985444#file1985444line2354>
> >
> >     Let's do the following in order.
> >     
> >     First, general validations:
> >     - `resource::validate(grow.volume())` (The check is not included in `validatePersistentVolume`)
> >     - `resource::validate(grow.addition())`
> >     - `!isPersistentVolume(grow.addition())`
> >     
> >     Second, reject RP resources:
> >     ``` 
> >     if (Resources::hasResourceProvider(grow.volume())) {
> >       return Error("Growing a volume from a resource provider is not supported");
> >     }
> >     ```
> >     
> >     Third, validations specific to agent default resources:
> >     - Validations for `grow.volume()`:
> >       1) `resource::validatePersistentVolume(grow.volume())`
> >       2) `!Resources::isShared(grow.volume())
> >       3) `checkpointedResources.contains(unallocated(grow.volume()))`
> >       4) `!unallocated(usedResources).contains(unallocated(grow.volume()))`
> >     
> >     - Validations for `grow.addition()`:
> >       1) `!Resources::hasResourceProvider(grow.addition())`
> >       2) `checkpointedResources.contains(unallocated(grow.addition()))`
> >       3) `!unallocated(usedResources).contains(unallocated(grow.addition())`
> >      
> >     Alternatively, the containment checks for `checkpointedResources` and `usedResources` could be put together if that makes the code easier to read. Also if `checkpointedResources` or `usedResources` contains RP resources, we cloud move the checks to the first section. (I think that's not the case for `checkpointedResources` but need double check.)
> >     
> >     I'm not sure if we need to check if `pendingTasks` contains the resources to be consumed. Wouldn't this be validated later when validating `LAUNCH` or `LAUNCH_GROUP`?
> >     
> >     Finally, for agent default resources, we coulde exercise `addable()` to validate if the two resources are compatible:
> >     ```
> >     Resources stripped = grow.volume();
> >     if (stripped.disk.has_source()) {
> >       stripped.mutable_disk()->clear_persistence();
> >       stripped.mutable_disk()->clear_volume();
> >     }
> >     
> >     if ((stripped + grow.addition()).size() != 1) {
> >       return Error("Incompatible resources in the 'volume' and 'addition' field");
> >     }
> >     ```

I like the `addable()` idea. I would even propose that we also create helper function to capture the logic of clear persistent volume info from a disk resource.

```
Try<Resources> backToDisk = grow.volume().clearPersistentVolume();

...
```

notes: also add: `!isEmpty(addition), !isPersistentVolume(addition)`


- Zhitao


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


On March 26, 2018, 11:30 p.m., Zhitao Li wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66050/
> -----------------------------------------------------------
> 
> (Updated March 26, 2018, 11:30 p.m.)
> 
> 
> Review request for mesos, Chun-Hung Hsiao, Gaston Kleiman, and Greg Mann.
> 
> 
> Bugs: MESOS-4965
>     https://issues.apache.org/jira/browse/MESOS-4965
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The new offer operations are implemented as non-speculative operations,
> which means they cannot be chained with previous offer operations which
> depend on results of each other.
> 
> 
> Diffs
> -----
> 
>   src/common/protobuf_utils.cpp 2acdc798200e82d14651b1edcc5f83e174477d53 
>   src/common/resources_utils.cpp 9be01c1abd48264e308960f35cc7c2ee8a367518 
>   src/master/master.cpp 20692c36c021fdae91de0b156f26fc56cf7c4f45 
>   src/master/validation.hpp 7c129ceb929596acbb64d37025e055661277e6bf 
>   src/master/validation.cpp 9254cd22e67d9aca53135701575fb0857ff6f7d6 
>   src/slave/slave.cpp e76daabad0d2d68aa42d1da809d4a23459eaaacb 
>   src/tests/mesos.hpp 01fd1c2bf21ef96dbab0769a1c1c92d7e3b60032 
>   src/tests/persistent_volume_tests.cpp 924d8458e54e34a49c99593482b5908c5f7c7a48 
>   src/tests/reservation_tests.cpp 8d8e9c8390e65187269bd194bb322bbdff88e0bd 
> 
> 
> Diff: https://reviews.apache.org/r/66050/diff/6/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Zhitao Li
> 
>


Re: Review Request 66050: Implemented grow and shrink of persistent volumes.

Posted by Zhitao Li <zh...@gmail.com>.

> On March 22, 2018, 3:43 p.m., Chun-Hung Hsiao wrote:
> > src/common/resources_utils.cpp
> > Lines 199-261 (patched)
> > <https://reviews.apache.org/r/66050/diff/3/?file=1985441#file1985441line199>
> >
> >     We should not speculatively carve out the conversion here. Let's wait for the `UpdateOperationStatusMessage` and get the converted resource instead.

Per discussion, we will reuse this function but the conversions carved out will not be applied in master.


- Zhitao


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


On March 26, 2018, 11:30 p.m., Zhitao Li wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66050/
> -----------------------------------------------------------
> 
> (Updated March 26, 2018, 11:30 p.m.)
> 
> 
> Review request for mesos, Chun-Hung Hsiao, Gaston Kleiman, and Greg Mann.
> 
> 
> Bugs: MESOS-4965
>     https://issues.apache.org/jira/browse/MESOS-4965
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The new offer operations are implemented as non-speculative operations,
> which means they cannot be chained with previous offer operations which
> depend on results of each other.
> 
> 
> Diffs
> -----
> 
>   src/common/protobuf_utils.cpp 2acdc798200e82d14651b1edcc5f83e174477d53 
>   src/common/resources_utils.cpp 9be01c1abd48264e308960f35cc7c2ee8a367518 
>   src/master/master.cpp 20692c36c021fdae91de0b156f26fc56cf7c4f45 
>   src/master/validation.hpp 7c129ceb929596acbb64d37025e055661277e6bf 
>   src/master/validation.cpp 9254cd22e67d9aca53135701575fb0857ff6f7d6 
>   src/slave/slave.cpp e76daabad0d2d68aa42d1da809d4a23459eaaacb 
>   src/tests/mesos.hpp 01fd1c2bf21ef96dbab0769a1c1c92d7e3b60032 
>   src/tests/persistent_volume_tests.cpp 924d8458e54e34a49c99593482b5908c5f7c7a48 
>   src/tests/reservation_tests.cpp 8d8e9c8390e65187269bd194bb322bbdff88e0bd 
> 
> 
> Diff: https://reviews.apache.org/r/66050/diff/6/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Zhitao Li
> 
>


Re: Review Request 66050: Implemented grow and shrink of persistent volumes.

Posted by Chun-Hung Hsiao <ch...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66050/#review199802
-----------------------------------------------------------



Halfway reviewing. Posting some comments first.


src/common/resources_utils.cpp
Lines 199-261 (patched)
<https://reviews.apache.org/r/66050/#comment280261>

    We should not speculatively carve out the conversion here. Let's wait for the `UpdateOperationStatusMessage` and get the converted resource instead.



src/master/master.cpp
Line 4018 (original), 4018 (patched)
<https://reviews.apache.org/r/66050/#comment280263>

    "If an operation other than LAUNCH and LAUNCH_GROUP contains invalid resources,"



src/master/master.cpp
Lines 4837 (patched)
<https://reviews.apache.org/r/66050/#comment280264>

    Let check the agent capabilities here:
    ```
    if (!slave->capabilities.resourceProvider) {
      drop(framework,
           operation,
           "Not supported on agent " + stringify(*slave) +
           " because it does not have RESOURCE_PROVIDER capability");
      continue;
    }
    ```



src/master/validation.cpp
Lines 2328 (patched)
<https://reviews.apache.org/r/66050/#comment280278>

    s/grow/growVolume/ for consistency.



src/master/validation.cpp
Lines 2354 (patched)
<https://reviews.apache.org/r/66050/#comment280282>

    Let's do the following in order.
    
    First, general validations:
    - `resource::validate(grow.volume())` (The check is not included in `validatePersistentVolume`)
    - `resource::validate(grow.addition())`
    - `!isPersistentVolume(grow.addition())`
    
    Second, reject RP resources:
    ``` 
    if (Resources::hasResourceProvider(grow.volume())) {
      return Error("Growing a volume from a resource provider is not supported");
    }
    ```
    
    Third, validations specific to agent default resources:
    - Validations for `grow.volume()`:
      1) `resource::validatePersistentVolume(grow.volume())`
      2) `!Resources::isShared(grow.volume())
      3) `checkpointedResources.contains(unallocated(grow.volume()))`
      4) `!unallocated(usedResources).contains(unallocated(grow.volume()))`
    
    - Validations for `grow.addition()`:
      1) `!Resources::hasResourceProvider(grow.addition())`
      2) `checkpointedResources.contains(unallocated(grow.addition()))`
      3) `!unallocated(usedResources).contains(unallocated(grow.addition())`
     
    Alternatively, the containment checks for `checkpointedResources` and `usedResources` could be put together if that makes the code easier to read. Also if `checkpointedResources` or `usedResources` contains RP resources, we cloud move the checks to the first section. (I think that's not the case for `checkpointedResources` but need double check.)
    
    I'm not sure if we need to check if `pendingTasks` contains the resources to be consumed. Wouldn't this be validated later when validating `LAUNCH` or `LAUNCH_GROUP`?
    
    Finally, for agent default resources, we coulde exercise `addable()` to validate if the two resources are compatible:
    ```
    Resources stripped = grow.volume();
    if (stripped.disk.has_source()) {
      stripped.mutable_disk()->clear_persistence();
      stripped.mutable_disk()->clear_volume();
    }
    
    if ((stripped + grow.addition()).size() != 1) {
      return Error("Incompatible resources in the 'volume' and 'addition' field");
    }
    ```



src/master/validation.cpp
Lines 2372 (patched)
<https://reviews.apache.org/r/66050/#comment280275>

    "Growing a shared persistent volume is not supported"


- Chun-Hung Hsiao


On March 22, 2018, 4:27 p.m., Zhitao Li wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66050/
> -----------------------------------------------------------
> 
> (Updated March 22, 2018, 4:27 p.m.)
> 
> 
> Review request for mesos, Chun-Hung Hsiao and Gaston Kleiman.
> 
> 
> Bugs: MESOS-4965
>     https://issues.apache.org/jira/browse/MESOS-4965
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The new offer operations are implemented as non-speculative operations,
> which means they cannot be chained with previous offer operations which
> depend on results of each other.
> 
> 
> Diffs
> -----
> 
>   src/common/protobuf_utils.cpp 2acdc798200e82d14651b1edcc5f83e174477d53 
>   src/common/resources_utils.cpp 9be01c1abd48264e308960f35cc7c2ee8a367518 
>   src/master/master.cpp 390fbe9fe71981101ed2bd9a1f1b21b0e3727b7b 
>   src/master/validation.hpp 7c129ceb929596acbb64d37025e055661277e6bf 
>   src/master/validation.cpp 9254cd22e67d9aca53135701575fb0857ff6f7d6 
>   src/slave/slave.cpp e76daabad0d2d68aa42d1da809d4a23459eaaacb 
>   src/tests/mesos.hpp 2c3d0c9350bbbbcd2223ff20c0797d1849d38c19 
>   src/tests/persistent_volume_tests.cpp 924d8458e54e34a49c99593482b5908c5f7c7a48 
>   src/tests/reservation_tests.cpp 8d8e9c8390e65187269bd194bb322bbdff88e0bd 
> 
> 
> Diff: https://reviews.apache.org/r/66050/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Zhitao Li
> 
>


Re: Review Request 66050: Implemented grow and shrink of persistent volumes.

Posted by Zhitao Li <zh...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66050/
-----------------------------------------------------------

(Updated March 22, 2018, 9:27 a.m.)


Review request for mesos, Chun-Hung Hsiao and Gaston Kleiman.


Changes
-------

Proper implementation as non-speculative operations.


Bugs: MESOS-4965
    https://issues.apache.org/jira/browse/MESOS-4965


Repository: mesos


Description
-------

The new offer operations are implemented as non-speculative operations,
which means they cannot be chained with previous offer operations which
depend on results of each other.


Diffs (updated)
-----

  src/common/protobuf_utils.cpp e0609b6154409d24ee99365feeffbdabe90d4e67 
  src/common/resources_utils.cpp 9be01c1abd48264e308960f35cc7c2ee8a367518 
  src/master/master.cpp 78f16d685328cf203e0d684338a2d8df943c9292 
  src/master/validation.hpp 7c129ceb929596acbb64d37025e055661277e6bf 
  src/master/validation.cpp 9254cd22e67d9aca53135701575fb0857ff6f7d6 
  src/slave/slave.cpp 915d4f1bbd642ca5d2587cfdd846262cb7e08788 
  src/tests/mesos.hpp 2c3d0c9350bbbbcd2223ff20c0797d1849d38c19 
  src/tests/persistent_volume_tests.cpp 924d8458e54e34a49c99593482b5908c5f7c7a48 
  src/tests/reservation_tests.cpp 8d8e9c8390e65187269bd194bb322bbdff88e0bd 


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

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


Testing
-------


Thanks,

Zhitao Li


Re: Review Request 66050: Implemented grow and shrink of persistent volumes.

Posted by Zhitao Li <zh...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66050/
-----------------------------------------------------------

(Updated March 20, 2018, 6:32 p.m.)


Review request for mesos, Chun-Hung Hsiao and Gaston Kleiman.


Changes
-------

Updated after API discussion.


Summary (updated)
-----------------

Implemented grow and shrink of persistent volumes.


Bugs: MESOS-4965
    https://issues.apache.org/jira/browse/MESOS-4965


Repository: mesos


Description (updated)
-------

The new offer operations are implemented as non-speculative operations,
which means they cannot be chained with previous offer operations which
depend on results of each other.


Diffs (updated)
-----

  src/common/protobuf_utils.cpp e0609b6154409d24ee99365feeffbdabe90d4e67 
  src/common/resources_utils.cpp 9be01c1abd48264e308960f35cc7c2ee8a367518 
  src/master/master.cpp 78f16d685328cf203e0d684338a2d8df943c9292 
  src/master/validation.hpp 7c129ceb929596acbb64d37025e055661277e6bf 
  src/master/validation.cpp 9254cd22e67d9aca53135701575fb0857ff6f7d6 
  src/slave/slave.cpp 915d4f1bbd642ca5d2587cfdd846262cb7e08788 
  src/tests/mesos.hpp 2c3d0c9350bbbbcd2223ff20c0797d1849d38c19 
  src/tests/persistent_volume_tests.cpp 924d8458e54e34a49c99593482b5908c5f7c7a48 
  src/tests/reservation_tests.cpp 8d8e9c8390e65187269bd194bb322bbdff88e0bd 


Diff: https://reviews.apache.org/r/66050/diff/2/

Changes: https://reviews.apache.org/r/66050/diff/1-2/


Testing
-------


Thanks,

Zhitao Li