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

(Updated Dec. 21, 2015, 5:32 p.m.)


Review request for mesos, Benjamin Hindman, Artem Harutyunyan, Jie Yu, Joris 
Van Remoortere, and Timothy Chen.


Changes
-------

Add to Logger Module review chain.


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


Repository: mesos


Description
-------

This changes the FDs used by the `mesos-docker-executor` to inherit rather than 
open anew.

In the `mesos-docker-executor`, we originally passed the log file path (i.e. 
`path::join(sandboxDirectory, "stdout")`) as an argument to `Docker::run`.  In 
the executor's context, the log file is already open as `STDOUT_FILENO`.

By inheriting the FD, the docker containerizer's logging-code will path mirrors 
that of the mesos containerizer.


Diffs
-----

  src/docker/docker.hpp 33d6fb3e82ff7328ad093648a45546a18ec7b8cb 
  src/docker/docker.cpp 5dc4667d93b143b54841d85606affe3e4926757a 
  src/docker/executor.cpp 4042cec0acbe03d937ea3c53ffde745cbba552d2 
  src/slave/containerizer/docker.cpp 2d2dd4e0df36207c5f3cbb4fe2c50df51c0f3e9e 
  src/tests/mesos.hpp 1c6acabab9d189a6d3cc8d63359053fd230377b8 

Diff: https://reviews.apache.org/r/41560/diff/


Testing
-------

make check (Centos7)
sudo bin/mesos-tests.sh --gtest_filter="*ROOT_DOCKER_Logs*"

Also confirmed that the changed pipes will still output to the sandbox.  See 
below for repro steps.

---

# Manual test for launching an executor from an agent launched with 
`--docker_mesos_image=<something>`

---

Dockerfile:
```
FROM centos:7
MAINTAINER Joseph Wu <jos...@mesosphere.io>

RUN yum -y update systemd

RUN yum install -y tar wget
RUN wget 
http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo 
-O /etc/yum.repos.d/epel-apache-maven.repo

RUN yum groupinstall -y "Development Tools"
RUN yum install -y apache-maven python-devel java-1.7.0-openjdk-devel 
zlib-devel libcurl-devel openssl-devel cyrus-sasl-devel cyrus-sasl-md5 
apr-devel subversion-devel apr-util-devel libevent-devel

RUN yum install -y perf nmap-ncat

RUN yum install -y git

RUN yum install -y docker

# Export environment.
ENV JAVA_HOME /usr/lib/jvm/java-1.7.0-openjdk/

# Include libmesos on library path.
ENV LD_LIBRARY_PATH /usr/local/lib

# Copy local checkout into /opt
ADD . /opt

WORKDIR /opt

# Configure!
RUN ./bootstrap
RUN mkdir -p build && cd build && ../configure --enable-ssl --enable-libevent

WORKDIR /opt/build

# Build and cleanup in a single layer.
RUN make -j4 install && cd /
```

---

On Centos7, prepare the docker image:
```
sudo docker build -t mesos/mesos:git-docker-pipe .
```

---

Start the master:
```
bin/mesos-master.sh --work_dir=/tmp/master --ip=127.0.0.1
```

Start the agent inside a Docker container:
```
sudo docker run -t  -v /var/run/docker.sock:/var/run/docker.sock -v 
/sys/fs/cgroup:/sys/fs/cgroup -v /tmp/mesos:/tmp/mesos --pid=host --net=host -i 
mesos/mesos:git-docker-pipe \
mesos-slave --master=127.0.0.1:5050 --containerizers=docker 
--docker_mesos_image="mesos/mesos:git-docker-pipe" --switch_user=false
```

Run one of the following (they should both work):
```
src/docker-no-executor-framework 127.0.0.1:5050

src/mesos-execute --master=127.0.0.1:5050 --containerizer=docker 
--docker_image=busybox --name="DockerInDocker" --command="echo hello"
```

Then check to see if anything was printed in 
`/tmp/mesos/slaves/<SLAVE_ID>/frameworks/<FRAMEWORK_ID>/executors/<EXECUTOR_ID>/runs/latest/`.


Thanks,

Joseph Wu

Reply via email to