Hendrik,

Sorry about the late response on that. I am glad that you figured it out
yourself.

Currently, for local persistent volumes (consumes 'disk' resources on the
agent), the container_path has to be relative. We made that decision based
on a couple of reasons:
1) not all the systems Mesos supports has bind mount (e.g., osx, windows).
Because of that, we don't want to introduce an API that works on some
system, but not on others. A relative container_path (e.g., "abc") means
that the volume can be accessed at $MESOS_SANDBOX/abc. This can be
supported on all systems (i.e., using bind mount on Linux, symlinks on
others).
2) Mesos allows the resources of a container to expand when executor
receives a new task from the framework. The new task might contains a local
persistent volume. Dynamically adding volumes to a running container is not
supported by Docker daemon until recently. Even though, one needs to setup
mount propagation properly before hand. Supporting an absolute
container_path will make it very hard to implement (you'll need to make
sure the parent mount of `container_path` is a shared mount). To solve that
issue, we only set mount propagation for mesos sandbox directory. That's
the reason why we enforce that container_path has to be relative for local
persistent volumes.

The workaround you have is perfectly fine for command tasks. We should
definitely document this. I'll make sure that we follow up on that.

Thanks!
- Jie

On Fri, Jun 24, 2016 at 1:25 PM, Hendrik Haddorp <[email protected]>
wrote:

> Basically the same issue was actually reported recently in MESOS-3413
> [1]. The discussion in there resulted in a code change in the Mesos
> framework for ArangoDB [2]. One first has to create a volume with some
> container path and then add a volume to the ContainerInfo when launching
> the docker container that uses the same path as host path for the
> volume. Now the container path needs to be absolute, like /data. Files
> that are now being created below /data show up in the persistent volume
> and newly launched containers with the same mapping can reuse the data.
> Not that obvious in my opinion but it works :-)
>
> [1] https://issues.apache.org/jira/browse/MESOS-3413
> [2]
>
> https://github.com/arangodb/arangodb-mesos-framework/commit/98ccbdbaa5ae41f83b02ca42e7325746ad044099
>
> p.s.: looks like jira is currently down ...
>
> On 23/06/16 16:56, Hendrik Haddorp wrote:
> > Hi,
> >
> > I'm trying to write a Mesos framework that should create persistent
> > volumes and then start a Docker container that uses this. So far I was
> > able to dynamically reserve resources (cpu, memory and disk) and create
> > a persistent volume in the reserved disk space. I'm also able to launch
> > a Docker container. I just can't figure out how to connect these
> > correctly. I either get told that some fields are not set correctly, end
> > up with mounting a path on the host system or nothing at all seems to
> > happen.
> >
> > Would be nice if somebody could show how a TaskInfo protobuf would need
> > to get filled to achieve this.
> >
> > thanks,
> > Hendrik
>
>

Reply via email to