----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/55191/#review160729 -----------------------------------------------------------
Fix it, then Ship it! i feel that we can write a unit test using `__MESOS_TEST__`, can't we? src/slave/containerizer/mesos/isolators/network/cni/cni.hpp (line 110) <https://reviews.apache.org/r/55191/#comment231927> I would update the constructor of `Info` to take an optional `hostname`. src/slave/containerizer/mesos/isolators/network/cni/cni.cpp (lines 670 - 677) <https://reviews.apache.org/r/55191/#comment231929> I would re-write the logic here: ``` Option<string> rootfs; if (containerConfig.has_rootfs()) { rootfs = containerConfig.rootfs(); } infos.put(containerId, Owned<Info>(new Info( containerNetworks, rootfs, hostname))); ``` src/slave/containerizer/mesos/isolators/network/cni/cni.cpp (line 914) <https://reviews.apache.org/r/55191/#comment231940> s/cniInfo/info/ - Jie Yu On Jan. 5, 2017, 5:04 p.m., James Peach wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/55191/ > ----------------------------------------------------------- > > (Updated Jan. 5, 2017, 5:04 p.m.) > > > Review request for mesos, Avinash sridharan, Jie Yu, and Jiang Yan Xu. > > > Bugs: MESOS-6556 > https://issues.apache.org/jira/browse/MESOS-6556 > > > Repository: mesos > > > Description > ------- > > Since the task info contains a `hostname` field, allow schedulers to > use this to specify the hostname that is assigned to the container. > > > Diffs > ----- > > src/slave/containerizer/mesos/isolators/network/cni/cni.hpp > 276b9003aa2671b9ca819e44fb1cd60ae9dff167 > src/slave/containerizer/mesos/isolators/network/cni/cni.cpp > ea91c71fdfac48a2fc1d31a0ee088a73244be367 > > Diff: https://reviews.apache.org/r/55191/diff/ > > > Testing > ------- > > make check (Fedora 25) > > Manual testing: > ``` > [jpeach@jpeach mesos-config]$ /opt/mesos/bin/mesos-execute > --master=127.0.0.1:5050 --task=file://$(pwd)/sleep-task.json > ... > [jpeach@jpeach mesos-config]$ cat sleep-task.json > { > "name": "sleep", > "agent_id": { "value": "any" }, > "task_id": { > "value": "sleep-1" > }, > "resources": [ > { > "name": "cpus", > "type": "SCALAR", > "scalar": { > "value": 0.4 > }, > "role": "*" > }, > { > "name": "mem", > "type": "SCALAR", > "scalar": { > "value": 32 > }, > "role": "*" > } > ], > "command": { > "value": "ip link > link; ip addr > addr; ip route > route; sleep 1000", > "environment": { > " variables": [ > { "name": "GLOG_v", "value": "2" } > ] > } > }, > "container": { > "type": "MESOS", > "hostname": "sleep.jpeach.org", > "network_infos": { > "name": "cni-test" > }, > "mesos": { > "image": { > "type": "DOCKER", > "docker": { > "name": "gala" > } > } > } > } > } > ... > [root@jpeach jpeach]# nsenter -t 2934 -m -u -i -n -w -r > [root@sleep sandbox]# cat /etc/hostname > sleep.jpeach.org[root@sleep sandbox]# hostname > sleep.jpeach.org > [root@sleep sandbox]# > ``` > > CNI Tests (Fedora 25): > ``` > [jpeach@jpeach build]$ sudo bin/mesos-tests.sh --gtest_filter=*Cni* > ... > [==========] Running 7 tests from 1 test case. > [----------] Global test environment set-up. > [----------] 7 tests from CniIsolatorTest > ... > [----------] 7 tests from CniIsolatorTest (16490 ms total) > > [----------] Global test environment tear-down > [==========] 7 tests from 1 test case ran. (16514 ms total) > [ PASSED ] 7 tests. > ``` > > > Thanks, > > James Peach > >
