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




src/slave/containerizer/mesos/isolators/network/cni/cni.cpp (lines 834 - 856)
<https://reviews.apache.org/r/51871/#comment216867>

    Instead of the typedef, it will be neater to chain a couple futures 
together.  You only want to check that all `cp` operations succeed.
    
    In your `foreach`:
    ```
    // Stays the same.
    Try<Subprocess> s = subprocess( ... );
    
    // Stays the same.
    if (s.isError()) { ... }
    
    // Chain the stderr reading here.
    Future<Nothing> status = s->status()
      .then([s](const Option<int>& status) -> Future<Nothing> {
          if (status.isNone()) {
            return Failure("Failed to reap subprocess to copy file");
          } else if (status.get() != 0) {
            return io::read(cp.err().get())
              .then([](const string& err) -> Future<Nothing> {
                return Failure("Failed to copy file: " + err);
              });
          }
    
          return Nothing();
        });
    ```
    
    Your list of futures then becomes:
    ```
    list<Future<Nothing>> futures;
    ```
    
    And then you can convert the nothing futures into a single nothing:
    ```
    return collect(futures)
      .then([](const list<Nothing>& nothings) -> Future<Nothing> { ... });
    ```


- Joseph Wu


On Sept. 16, 2016, 4:31 p.m., Avinash sridharan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51871/
> -----------------------------------------------------------
> 
> (Updated Sept. 16, 2016, 4:31 p.m.)
> 
> 
> Review request for mesos, Gilbert Song, Jie Yu, Joseph Wu, and Qian Zhang.
> 
> 
> Bugs: MESOS-6156
>     https://issues.apache.org/jira/browse/MESOS-6156
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The network file setup in the `network/cni` isolator is now nesting
> aware. Since the children share the network and UTS namespace with the
> parent, the network files need to be created only for the parent
> container. For the child containers, the network files will be simply
> a symlink to a parents network files.
> 
> 
> Diffs
> -----
> 
>   src/slave/containerizer/mesos/isolators/network/cni/cni.cpp 
> 822f11eab5b00c014563322a8c3b2c14cb440e0b 
> 
> Diff: https://reviews.apache.org/r/51871/diff/
> 
> 
> Testing
> -------
> 
> make
> make check
> sudo ./bin/mesos-tests.sh
> 
> 
> Thanks,
> 
> Avinash sridharan
> 
>

Reply via email to