----------------------------------------------------------- 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) <https://reviews.apache.org/r/63105/#comment265782> We need a separated validation function. A resource provider will do the following: ``` Option<Error> 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) <https://reviews.apache.org/r/63105/#comment265784> 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) <https://reviews.apache.org/r/63105/#comment265788> `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) <https://reviews.apache.org/r/63105/#comment265790> `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) <https://reviews.apache.org/r/63105/#comment265793> `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 > >
