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



The patch looks pretty good. For the test case part, it should be the correct 
way to verify if `parse()` works except some nits. I would continue to review 
after compile and test it in my machine.


src/slave/containerizer/docker.cpp (line 62)
<https://reviews.apache.org/r/53047/#comment222894>

    Nit: We sort the headers according some rules which `stout` come first. 
Please move this after 
    
    ```
    #include <stout/os.hpp>
    #include <stout/uuid.hpp>
    ```



src/slave/containerizer/docker.cpp (line 132)
<https://reviews.apache.org/r/53047/#comment222897>

    `containerId.get()` may failed here if `contaienrId` is `None`.
    
    ```
        } else {
    
          vector<string> parts = strings::split(name.get(), 
DOCKER_NAME_SEPERATOR);
         if (parts.size() == 2 || parts.size() == 3) { <-- if this condition is 
`false`, `containerId` would be `None`. So the `containerId.get()` would failed 
in following code.
            ContainerID id;
            id.set_value(parts[1]);
            containerId = id;
          }
        }
    ```
    
    I suggest to put this above `return`. It may looks like
    
    ```
      }
    
      if (containerId.isSome()) {
        // Check if id is a valid UUID
        Try<UUID> uuid = UUID::fromString(containerId.get().value());
        if (uuid.isError()) {
          return None();
        }
      }
    
      return containerId;
    ```


- haosdent huang


On Oct. 21, 2016, 8:24 a.m., Manuwela Kanade wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53047/
> -----------------------------------------------------------
> 
> (Updated Oct. 21, 2016, 8:24 a.m.)
> 
> 
> Review request for mesos, haosdent huang, Timothy Chen, and Vinod Kone.
> 
> 
> Bugs: MESOS-6212
>     https://issues.apache.org/jira/browse/MESOS-6212
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> MESOS-6212: name format validation for mesos managed docker containers.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/tests/uuid_tests.cpp 
> fe9894af93df9cb9b12390d8d7e7885525db384d 
>   src/slave/containerizer/docker.cpp 8ec4c0a25335fb1b36cb2ab82577f6d3e2f7f008 
>   src/tests/containerizer/docker_containerizer_tests.cpp 
> 6d26797abf6d2b5e42b9e7743789e1edc62c9c1a 
> 
> Diff: https://reviews.apache.org/r/53047/diff/
> 
> 
> Testing
> -------
> 
> 1. Ran the "make check"
> 
> 2. Manual Testing done as below:
> Testing without changes: Created and ran an example container which is not 
> run using mesos : named "mesos-rsyslog" which got killed once mesos-agent 
> started with --containerizer=docker,mesos. 
> 
> Testing with changes: Created and ran an example container (not run using 
> mesos): named "mesos-rsyslog" which keeps running and mesos-agent does not 
> kill it thus avoiding the false positive
> 
> 3. Added a testcase to test this scenario. Result below:
> Test run with the fix passes
> [==========] Running 1 test from 1 test case.
> [----------] Global test environment set-up.
> [----------] 1 test from DockerContainerizerTest
> [ RUN      ] DockerContainerizerTest.ROOT_DOCKER_SkipRecoverMalformedUUID
> [       OK ] DockerContainerizerTest.ROOT_DOCKER_SkipRecoverMalformedUUID 
> (16142 ms)
> [----------] 1 test from DockerContainerizerTest (16143 ms total)
> 
> [----------] Global test environment tear-down
> [==========] 1 test from 1 test case ran. (16157 ms total)
> [  PASSED  ] 1 test.
> 
> 
> Test run without the fix fails, since container with malformed UUID also gets 
> killed:
> [==========] Running 1 test from 1 test case.
> [----------] Global test environment set-up.
> [----------] 1 test from DockerContainerizerTest
> [ RUN      ] DockerContainerizerTest.ROOT_DOCKER_SkipRecoverMalformedUUID
> ../../src/tests/containerizer/docker_containerizer_tests.cpp:1529: Failure
> Value of: exists(docker, slaveId, containerId)
>   Actual: false
> Expected: true
> [  FAILED  ] DockerContainerizerTest.ROOT_DOCKER_SkipRecoverMalformedUUID 
> (9054 ms)
> [----------] 1 test from DockerContainerizerTest (9055 ms total)
> 
> 
> Thanks,
> 
> Manuwela Kanade
> 
>

Reply via email to