Re: Review Request 63105: Added 'apply' handlers for storage operations.

2017-10-19 Thread Chun-Hung Hsiao


> On Oct. 19, 2017, 10:42 p.m., Chun-Hung Hsiao wrote:
> > src/common/resources.cpp
> > Line 1765 (original), 1765 (patched)
> > 
> >
> > We need a separated validation function. A resource provider will do 
> > the following:
> > ```
> > Option error = Resources::validateOperation(operation);
> > if (error.isSome()) {
> >   Update operation status: OFFER_OPERATION_ERROR;
> > }
> > 
> > Do the actual operation, e.g., call CSI.
> > if (actual operation fails) {
> >   Update oeration status: OFFER_OPERATION_FAILED;
> > }
> > 
> > checkpointedResources.apply(target resource);
> > Update operation status: OFFER_OPERATION_FINISHED;
> > ```
> > Can you separate the validation logic from `Resources::apply` and 
> > provide an interface?
> > 
> > We can also use the new validation functions in 
> > `src/common/resource_utils.cpp`

Hmm discussed with Jie and now it seems to me that the validation will be done 
on the master. Then I think for SLRP a single `apply()` is sufficient.


- Chun-Hung


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


On Oct. 18, 2017, 2:36 p.m., Jan Schlicht wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/63105/
> ---
> 
> (Updated Oct. 18, 2017, 2:36 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier and Jie Yu.
> 
> 
> Bugs: MESOS-7594
> https://issues.apache.org/jira/browse/MESOS-7594
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added 'apply' handlers for storage operations.
> 
> 
> Diffs
> -
> 
>   src/common/resources.cpp 7ee4dae1389e037531aec533a3d235ee06443ea8 
> 
> 
> Diff: https://reviews.apache.org/r/63105/diff/1/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Jan Schlicht
> 
>



Re: Review Request 63105: Added 'apply' handlers for storage operations.

2017-10-19 Thread Chun-Hung Hsiao

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




src/common/resources.cpp
Line 1765 (original), 1765 (patched)


We need a separated validation function. A resource provider will do the 
following:
```
Option error = Resources::validateOperation(operation);
if (error.isSome()) {
  Update operation status: OFFER_OPERATION_ERROR;
}

Do the actual operation, e.g., call CSI.
if (actual operation fails) {
  Update oeration status: OFFER_OPERATION_FAILED;
}

checkpointedResources.apply(target resource);
Update operation status: OFFER_OPERATION_FINISHED;
```
Can you separate the validation logic from `Resources::apply` and provide 
an interface?

We can also use the new validation functions in 
`src/common/resource_utils.cpp`



src/common/resources.cpp
Lines 1776 (patched)


Here is a list of things to check:
`source.has_disk()`
`source.disk().has_source()`
`!source.disk().source().has_id()`
`source.disk().source().type() == Resource::DiskInfo::Source::RAW`
`(operation.create_volume().target_type() == 
Resource::DiskInfo::Source::PATH || operation.create_volume().target_type() == 
Resource::DiskInfo::Source::MOUNT)`



src/common/resources.cpp
Lines 1796 (patched)


`volume.has_disk()`
`volume.disk().has_source()`
`volume.disk().source().has_id()`
`(volume.disk().source()type() == Resource::DiskInfo::Source::PATH || 
volume.disk().source().type() == Resource::DiskInfo::Source::MOUNT)`
`!volume.disk().has_persistence()`



src/common/resources.cpp
Lines 1816 (patched)


`source.has_disk()`
`source.disk().has_source()`
`!source.disk().source().has_id()`
`source.disk().source().type() == Resource::DiskInfo::Source::RAW`



src/common/resources.cpp
Lines 1836 (patched)


`block.has_disk()`
`block.disk().has_source()`
`block.disk().source().has_id()`
`block.disk().source()type() == Resource::DiskInfo::Source::BLOCK`
`!volume.disk().has_persistence()`


- Chun-Hung Hsiao


On Oct. 18, 2017, 2:36 p.m., Jan Schlicht wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/63105/
> ---
> 
> (Updated Oct. 18, 2017, 2:36 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier and Jie Yu.
> 
> 
> Bugs: MESOS-7594
> https://issues.apache.org/jira/browse/MESOS-7594
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added 'apply' handlers for storage operations.
> 
> 
> Diffs
> -
> 
>   src/common/resources.cpp 7ee4dae1389e037531aec533a3d235ee06443ea8 
> 
> 
> Diff: https://reviews.apache.org/r/63105/diff/1/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Jan Schlicht
> 
>



Re: Review Request 63105: Added 'apply' handlers for storage operations.

2017-10-18 Thread Jan Schlicht

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

(Updated Oct. 18, 2017, 4:36 p.m.)


Review request for mesos, Benjamin Bannier and Jie Yu.


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


Repository: mesos


Description
---

Added 'apply' handlers for storage operations.


Diffs
-

  src/common/resources.cpp 7ee4dae1389e037531aec533a3d235ee06443ea8 


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


Testing
---

make check


Thanks,

Jan Schlicht



Review Request 63105: Added 'apply' handlers for storage operations.

2017-10-18 Thread Jan Schlicht

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

Review request for mesos, Benjamin Bannier and Jie Yu.


Repository: mesos


Description
---

Added 'apply' handlers for storage operations.


Diffs
-

  src/common/resources.cpp 7ee4dae1389e037531aec533a3d235ee06443ea8 


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


Testing
---

make check


Thanks,

Jan Schlicht