> On Aug. 30, 2015, 12:36 a.m., Jie Yu wrote:
> > src/slave/containerizer/provisioners/appc.cpp, line 83
> > <https://reviews.apache.org/r/37881/diff/2/?file=1059946#file1059946line83>
> >
> >     Why not const as well?

Because operator[] on backends is not const. But I switched to use 
`backends.get(backend).get()` to avoid using `[]` and made it const.


> On Aug. 30, 2015, 12:36 a.m., Jie Yu wrote:
> > src/slave/containerizer/provisioners/appc.cpp, lines 131-132
> > <https://reviews.apache.org/r/37881/diff/2/?file=1059946#file1059946line131>
> >
> >     Let's try to make the indentation in this file consistent (don't mix).
> >     
> >     Either
> >     ```
> >     return Error(xxx,
> >                  yyy);
> >     ```
> >     
> >     Or
> >     ```
> >     return Error(
> >         xxx,
> >         yyy);
> >     ```

Fixed a few inconsistencies to use option 1 for string concatenations.


> On Aug. 30, 2015, 12:36 a.m., Jie Yu wrote:
> > src/slave/containerizer/provisioners/appc.cpp, lines 174-181
> > <https://reviews.apache.org/r/37881/diff/2/?file=1059946#file1059946line174>
> >
> >     Let's put all the logics in AppcProvisionerProcess (which is the 
> > convention we used consistently in the code base).

In store.cpp there used to be Store::create() and StoreProcess::create() and 
Store::create() simply called StoreProcess::create() and had 
StoreProcess::create() handle argument validation and preparation and your 
comment was to get rid of StoreProcess::create() and just do the validation in 
Store::create() and then call `StoreProcess::StoreProcess()`: 
https://reviews.apache.org/r/37311/diff/2?file=1036566#file1036566line50

It is the same situation here.

FWIW `MesosContainerizer::create()` does similar validation and IIRC the rule 
is for regular methods: Inserting logic into `XYZ::doSomething()` before it 
delegates to `XYZProcess::doSomething()` is aganist the expectation that 
`XYZ::doSomething()` is entirely asychronous.


> On Aug. 30, 2015, 12:36 a.m., Jie Yu wrote:
> > src/slave/containerizer/provisioners/appc.cpp, lines 328-332
> > <https://reviews.apache.org/r/37881/diff/2/?file=1059946#file1059946line328>
> >
> >     We try to avoid race as much as possible, even if 'backends' here is 
> > read only.
> >     
> >     Can you pull this code into `_provision`? I found it more readable then 
> > using a lambda here.
> >     
> >     Lambda is useful if it does not rely on 'this' (i.e., a static method).
> >     
> >     ```
> >     return store->get(image)
> >       .then(defer(self(), &Self::_provision, containerId, rootfs, 
> > lambda::_1));
> >       
> >     Future<string> _provision(...)
> >     {
> >       ...
> >       return backends[..]->provision(layers, rootfs)
> >         .then([rootfs]() { return rootfs; });
> >     }
> >     ```

First-time labmda user here, thanks!


> On Aug. 30, 2015, 12:36 a.m., Jie Yu wrote:
> > src/slave/containerizer/provisioners/appc.cpp, lines 372-381
> > <https://reviews.apache.org/r/37881/diff/2/?file=1059946#file1059946line372>
> >
> >     Hum, that makes me wonder if we need to return bool for backends. Looks 
> > like that's not necessary. Also, you need to consider the case where 
> > provision fails partially.

FWIW current linux.cpp is not reading the result from `Future<bool> 
Provisioner::destory()` either, but let's revist this after this patch.


- Jiang Yan


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


On Aug. 30, 2015, 6:49 p.m., Jiang Yan Xu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37881/
> -----------------------------------------------------------
> 
> (Updated Aug. 30, 2015, 6:49 p.m.)
> 
> 
> Review request for mesos, Jie Yu and Timothy Chen.
> 
> 
> Bugs: MESOS-2796
>     https://issues.apache.org/jira/browse/MESOS-2796
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Implemented AppcProvisioner.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am 7b620ff66856b3f0adac121b3297d55ed71a3d99 
>   src/slave/containerizer/provisioner.hpp 
> 541dd4e0b2f0c92a45c00cab6132a2be69654838 
>   src/slave/containerizer/provisioner.cpp 
> efc7e6996ff6663bebaf61989a7e040bd2ad7a5e 
>   src/slave/containerizer/provisioners/appc.hpp PRE-CREATION 
>   src/slave/containerizer/provisioners/appc.cpp PRE-CREATION 
>   src/slave/containerizer/provisioners/appc/paths.hpp 
> 41e3bf79da0854406c488855f953111e67353829 
>   src/slave/containerizer/provisioners/appc/paths.cpp 
> 3113c84b9526dd9e9e89fb9aa4ec75ed66a996c7 
>   src/slave/flags.hpp e56738e2dfd6593ef8f093687919da287af78f77 
>   src/slave/flags.cpp b36710d6d7a7250bc071a57310a2d54bfb3bc624 
>   src/tests/containerizer/appc_provisioner_tests.cpp 
> 47b66b9c30cefe8f9a8e2c1c1341776c2d235020 
> 
> Diff: https://reviews.apache.org/r/37881/diff/
> 
> 
> Testing
> -------
> 
> sudo make check.
> 
> More test cases coming.
> 
> 
> Thanks,
> 
> Jiang Yan Xu
> 
>

Reply via email to