[ 
https://issues.apache.org/jira/browse/MESOS-5278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15310050#comment-15310050
 ] 

Guangya Liu commented on MESOS-5278:
------------------------------------

Did some test with python as follows.

1) Create a volume file
{code}
root@mesos002:~/test/setns# cat /root/test/v6.json
  [{
  "container_path":"\/tmp\/abc2",
  "mode":"RW",
  "source":
    {
      "docker_volume":
        {
          "driver":"convoy",
          "driver_options":
            {"parameter":[
              {
                "key":"iops",
                "value":"150"
              }
            ]},
            "name":"dvd2"
         },
         "type":"DOCKER_VOLUME"
    }
}]
{code}

2) Start up mesos-executor
{code}
root@mesos002:~/src/mesos/m2/mesos/build# ./src/mesos-execute 
--master=192.168.56.12:5050 --command="sleep 100000" --name=test 
--docker_image=ubuntu:14.04 --volumes=/root/test/v6.json
I0601 00:19:22.391978 31447 scheduler.cpp:187] Version: 1.0.0
I0601 00:19:22.394105 31471 scheduler.cpp:471] New master detected at 
master@192.168.56.12:5050
Subscribed with ID '6ead2bbc-ae7e-4973-9a8d-0c9c02668573-0000'
Submitted task 'test' to agent '6ead2bbc-ae7e-4973-9a8d-0c9c02668573-S0'
Received status update TASK_RUNNING for task 'test'
  source: SOURCE_EXECUTOR
{code}

3) Check convoy volume list and mount point
{code}
root@mesos002:~/test/setns# convoy list
{
        "01569b03-81f2-47be-8d16-169c1adcb541": {
                "UUID": "01569b03-81f2-47be-8d16-169c1adcb541",
                "Name": "dvd2",
                "Driver": "devicemapper",
                "MountPoint": 
"/var/lib/convoy/devicemapper/mounts/01569b03-81f2-47be-8d16-169c1adcb541",
                "CreatedTime": "Mon Apr 18 10:57:32 +0800 2016",
                "DriverInfo": {
                        "DevID": "12",
                        "Device": 
"/dev/mapper/01569b03-81f2-47be-8d16-169c1adcb541",
                        "Driver": "devicemapper",
                        "MountPoint": 
"/var/lib/convoy/devicemapper/mounts/01569b03-81f2-47be-8d16-169c1adcb541",
                        "Size": "107374182400"
                },
                "Snapshots": {}
        }
}
root@mesos002:~/test/setns# ls 
/var/lib/convoy/devicemapper/mounts/01569b03-81f2-47be-8d16-169c1adcb541
ibm2  lost+found
{code}

4) Using a python script to enter the mnt namespace of the container.
{code}
root@mesos002:~/test/setns# cat setns.py
#!/usr/bin/env python

import ctypes
import sys
import os
import subprocess

f = None
libc = ctypes.CDLL('libc.so.6')
myfd = os.open('/proc/31563/ns/mnt', os.O_RDONLY)
libc.setns(myfd, 0)

subprocess.Popen(['ls', '/tmp/abc2'])
root@mesos002:~/test/setns# python setns.py
ibm2  lost+found
{code}

There are currently two issues for this CLI:
1) The agent do not export the executor pid or task pid, so I cannot get the 
task process id now. Seems we need to expose the executor pid or task pid to 
mesos task endpoint?
2) Where does {{mesos enter}} run? Only in master or on the host where the 
container is running? I can see that for docker, I have to run {{docker exec}} 
on the docker server where the container is running; but with swarm, I can run 
{{docker exec}} anywhere. If want to enable {{mesos enter}} run anywhere, we 
may need to add some logic such as {{remote exec}} to {{mesos enter}}.

> Add a CLI allowing a user to enter a container.
> -----------------------------------------------
>
>                 Key: MESOS-5278
>                 URL: https://issues.apache.org/jira/browse/MESOS-5278
>             Project: Mesos
>          Issue Type: Improvement
>            Reporter: Jie Yu
>            Assignee: Guangya Liu
>
> Containers created by the unified containerizer (Mesos containerizer) uses 
> various namespaces (e.g., mount, network, etc.).
> To improve debugability, we should create a CLI that allows an operator or a 
> user to enter the namespaces associated with the container, and execute an 
> arbitrary command in that container (similar to `docker exec`).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to