Re: Review Request 61149: Added Future::condition.

2017-07-27 Thread Benjamin Mahler

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




3rdparty/libprocess/include/process/future.hpp
Lines 155-156 (patched)


I'm not sure callers will grasp this, to me this is stringification of the 
future, and in the READY case it would print `'Ready with X'`. Is there a way 
to acheive this when T isn't printable (e.g. `'Ready with '`


- Benjamin Mahler


On July 27, 2017, 1:55 a.m., Benjamin Hindman wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61149/
> ---
> 
> (Updated July 27, 2017, 1:55 a.m.)
> 
> 
> Review request for mesos and Benjamin Mahler.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added Future::condition.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/include/process/future.hpp 
> cce950509f58022e79bb51a6e72ea1a005b9cb50 
> 
> 
> Diff: https://reviews.apache.org/r/61149/diff/1/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>



Re: Review Request 55318: Used loop in PollSocketImpl.

2017-07-27 Thread Benjamin Mahler

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




3rdparty/libprocess/src/poll_socket.cpp
Lines 192-197 (original), 198-203 (patched)


Hm.. what happened here? Previously we treat is_restartable as being 
interrupted, and we don't trip back through poll, but in your change, we treat 
it the same as retryable and we trip back through poll. This distinction is 
lost in your change, was this intentional?



3rdparty/libprocess/src/poll_socket.cpp
Lines 239-257 (original), 244-248 (patched)


Ditto here.


- Benjamin Mahler


On Jan. 8, 2017, 7:44 a.m., Benjamin Hindman wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55318/
> ---
> 
> (Updated Jan. 8, 2017, 7:44 a.m.)
> 
> 
> Review request for mesos and Jie Yu.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Used loop in PollSocketImpl.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/src/poll_socket.cpp 
> 5410b07e7b2ba5de4c1b61f358b6bcb224012eda 
> 
> 
> Diff: https://reviews.apache.org/r/55318/diff/2/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>



Re: Review Request 61123: Added regression test for sandbox volume ownership issue.

2017-07-27 Thread Gilbert Song

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

(Updated July 27, 2017, 6:47 p.m.)


Review request for mesos, Ilya Pronin, Jie Yu, James Peach, Stephan Erb, Vinod 
Kone, and Jiang Yan Xu.


Summary (updated)
-

Added regression test for sandbox volume ownership issue.


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


Repository: mesos


Description (updated)
---

Added regression test for sandbox volume ownership issue.


Diffs (updated)
-

  src/tests/containerizer/linux_filesystem_isolator_tests.cpp 
457311e23a0c848ef3ed69c8be4396e6a01f3b95 


Diff: https://reviews.apache.org/r/61123/diff/2/

Changes: https://reviews.apache.org/r/61123/diff/1-2/


Testing
---

make check

Verified that this test failed if we don't have the bugfix patch.


Thanks,

Gilbert Song



Re: Review Request 61123: Added regression test for host volume ownership issue.

2017-07-27 Thread Gilbert Song


> On July 26, 2017, 11:08 a.m., Ilya Pronin wrote:
> > src/tests/containerizer/linux_filesystem_isolator_tests.cpp
> > Lines 252-255 (patched)
> > 
> >
> > Why do we need Docker for this test? The problem should be reproducible 
> > without it.
> 
> Ilya Pronin wrote:
> I meant an image. Not Docker itself :)

We don't allow `host_path` and `container_path` to be both relative.

https://github.com/apache/mesos/blob/master/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp#L453~#L460


- Gilbert


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


On July 25, 2017, 4:05 p.m., Gilbert Song wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61123/
> ---
> 
> (Updated July 25, 2017, 4:05 p.m.)
> 
> 
> Review request for mesos, Ilya Pronin, Jie Yu, James Peach, Stephan Erb, 
> Vinod Kone, and Jiang Yan Xu.
> 
> 
> Bugs: MESOS-5187
> https://issues.apache.org/jira/browse/MESOS-5187
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added regression test for host volume ownership issue.
> 
> 
> Diffs
> -
> 
>   src/tests/containerizer/linux_filesystem_isolator_tests.cpp 
> 457311e23a0c848ef3ed69c8be4396e6a01f3b95 
> 
> 
> Diff: https://reviews.apache.org/r/61123/diff/1/
> 
> 
> Testing
> ---
> 
> make check
> 
> Verified that this test failed if we don't have the bugfix patch.
> 
> 
> Thanks,
> 
> Gilbert Song
> 
>



Re: Review Request 61122: Fixed the sandbox volume relative host path ownership.

2017-07-27 Thread Gilbert Song

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

(Updated July 27, 2017, 6:44 p.m.)


Review request for mesos, Ilya Pronin, Jie Yu, James Peach, Stephan Erb, Vinod 
Kone, and Jiang Yan Xu.


Summary (updated)
-

Fixed the sandbox volume relative host path ownership.


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


Repository: mesos


Description (updated)
---

This bugfix addresses the issue from MESOS-5178. Basically, the
sandbox volume ownership was not set correctly. This issue can be
exposed if a framework user is non-root while the agent
process runs as root. Then, the non-root user does not have
permissions to write to this volume.

The correct solution should be giving permissions to corresponding
users by leveraging supplementary groups. But we can still
introduce a workaround in this patch by changing the ownership
of this sandbox volume to its sandbox's ownership.


Diffs (updated)
-

  src/slave/containerizer/mesos/isolators/filesystem/linux.cpp 
bf35b7f00d6e80672ffc27cfc3f3a2fd8de69a99 


Diff: https://reviews.apache.org/r/61122/diff/3/

Changes: https://reviews.apache.org/r/61122/diff/2-3/


Testing
---

make check


Thanks,

Gilbert Song



Re: Review Request 61122: Fixed the host volume relative host path ownership.

2017-07-27 Thread Gilbert Song


> On July 25, 2017, 4:26 p.m., Jie Yu wrote:
> > src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
> > Line 487 (original), 498 (patched)
> > 
> >
> > This is sandbox volume, not host volume. Let's change the commit title 
> > as well.
> 
> Gilbert Song wrote:
> I regard a `host_path` 1)absolute and 2)relative both as `host volume`. 
> Otherwise, people will get confused by `sandbox volume` vs `sandbox path 
> volume`. Shouldn't we define the name by `type`?

Fixed it in favor of refactor host-path to the sandbox volume in near term.


- Gilbert


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


On July 25, 2017, 11:41 p.m., Gilbert Song wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61122/
> ---
> 
> (Updated July 25, 2017, 11:41 p.m.)
> 
> 
> Review request for mesos, Ilya Pronin, Jie Yu, James Peach, Stephan Erb, 
> Vinod Kone, and Jiang Yan Xu.
> 
> 
> Bugs: MESOS-5187
> https://issues.apache.org/jira/browse/MESOS-5187
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> This bugfix addresses the issue from MESOS-5178. Basically, the
> host volume ownership was not set correctly. This issue can be
> exposed if a framework user is non-root while the agent
> process runs as root. Then, the non-root user does not have
> permissions to write to this volume.
> 
> The correct solution should be giving permissions to corresponding
> users by leveraging supplementary groups. But we can still
> introduce a workaround in this patch by changing the ownership
> of this host volume to its sandbox's ownership.
> 
> 
> Diffs
> -
> 
>   src/slave/containerizer/mesos/isolators/filesystem/linux.cpp 
> bf35b7f00d6e80672ffc27cfc3f3a2fd8de69a99 
> 
> 
> Diff: https://reviews.apache.org/r/61122/diff/2/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Gilbert Song
> 
>



Re: Review Request 61121: Added regression test for sandbox_path volume ownership issue.

2017-07-27 Thread Gilbert Song


> On July 26, 2017, 9:45 a.m., James Peach wrote:
> > src/tests/containerizer/volume_sandbox_path_isolator_tests.cpp
> > Lines 187 (patched)
> > 
> >
> > Maybe simplify this (here and above):
> > ```
> > ASSERT_SOME(os::chown("nobody", directory.get()));
> > ```

sure, looks better.


- Gilbert


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


On July 27, 2017, 6:43 p.m., Gilbert Song wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61121/
> ---
> 
> (Updated July 27, 2017, 6:43 p.m.)
> 
> 
> Review request for mesos, Greg Mann, Ilya Pronin, Jie Yu, James Peach, Vinod 
> Kone, and Jiang Yan Xu.
> 
> 
> Bugs: MESOS-7830
> https://issues.apache.org/jira/browse/MESOS-7830
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added regression test for sandbox_path volume ownership issue.
> 
> 
> Diffs
> -
> 
>   src/tests/containerizer/volume_sandbox_path_isolator_tests.cpp 
> 3228b9a7df0fcb7973b210a1d0c17a18869c73d4 
> 
> 
> Diff: https://reviews.apache.org/r/61121/diff/2/
> 
> 
> Testing
> ---
> 
> make check
> 
> Verified that this test failed if we don't have the bugfix patch.
> 
> 
> Thanks,
> 
> Gilbert Song
> 
>



Re: Review Request 61121: Added regression test for sandbox_path volume ownership issue.

2017-07-27 Thread Gilbert Song

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

(Updated July 27, 2017, 6:43 p.m.)


Review request for mesos, Greg Mann, Ilya Pronin, Jie Yu, James Peach, Vinod 
Kone, and Jiang Yan Xu.


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


Repository: mesos


Description
---

Added regression test for sandbox_path volume ownership issue.


Diffs (updated)
-

  src/tests/containerizer/volume_sandbox_path_isolator_tests.cpp 
3228b9a7df0fcb7973b210a1d0c17a18869c73d4 


Diff: https://reviews.apache.org/r/61121/diff/2/

Changes: https://reviews.apache.org/r/61121/diff/1-2/


Testing
---

make check

Verified that this test failed if we don't have the bugfix patch.


Thanks,

Gilbert Song



Re: Review Request 61120: Fixed the sandbox_path volume source path ownership.

2017-07-27 Thread Gilbert Song

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

(Updated July 27, 2017, 6:42 p.m.)


Review request for mesos, Greg Mann, Ilya Pronin, Jie Yu, James Peach, Vinod 
Kone, and Jiang Yan Xu.


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


Repository: mesos


Description
---

This bugfix addresses the issue from MESOS-7830. Basically, the
sandbox path volume ownership was not set correctly. This issue
can be exposed if a framework user is non-root while the agent
process runs as root. Then, the non-root user does not have
permissions to write to this volume.

The correct solution should be giving permissions to corresponding
users by leveraging supplementary groups. But we can still
introduce a workaround in this patch by changing the ownership
of the sandbox path volume to its sandbox's ownership.


Diffs (updated)
-

  src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp 
6f7304d4aa40eb1b4815ffc1fec61f7e98291cba 


Diff: https://reviews.apache.org/r/61120/diff/3/

Changes: https://reviews.apache.org/r/61120/diff/2-3/


Testing
---

make check


Thanks,

Gilbert Song



Re: Review Request 55317: Used loop in SocketImpl.

2017-07-27 Thread Benjamin Mahler

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


Ship it!




Some more description here would be great, i.e. is this fixing a bug due to the 
lack of loop usage? Or is this purely a cleanup, etc.


3rdparty/libprocess/src/socket.cpp
Lines 157 (patched)


This actually doesn't need to be a shared_ptr, you could do this:

```
string buffer;

return loop(
  None(),
  [=]() { ... };
  [=]() mutable {
...
buffer.append(...);
...
  });
```

Since the function will work off a single copy of the variable, this is a 
pretty typical pattern for working off the same variable across invocations of 
the lambda from what I've found.



3rdparty/libprocess/src/socket.cpp
Lines 162 (patched)


`s/{/ {/`


- Benjamin Mahler


On Jan. 8, 2017, 7:44 a.m., Benjamin Hindman wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55317/
> ---
> 
> (Updated Jan. 8, 2017, 7:44 a.m.)
> 
> 
> Review request for mesos and Jie Yu.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Used loop in SocketImpl.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/src/socket.cpp 457c5ff5e1270dd48f63c88fb99385399cc17f9f 
> 
> 
> Diff: https://reviews.apache.org/r/55317/diff/2/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>



Re: Review Request 55315: Bug fixes from failing to hold onto PollSocketImpl reference.

2017-07-27 Thread Benjamin Mahler

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


Fix it, then Ship it!




Could you also clarify what the bugs are? Would be nice to know without having 
to read the diff.


3rdparty/libprocess/src/poll_socket.cpp
Line 99 (original), 98 (patched)


Any reason you removed the other VLOGs but left this in? (also, once you 
remove this no need to store the error string in a variable)



3rdparty/libprocess/src/poll_socket.cpp
Lines 118-121 (patched)


As an optimization, do you want to only do this if you need to? i.e. the 
"is in progress" error case


- Benjamin Mahler


On Jan. 8, 2017, 7:42 a.m., Benjamin Hindman wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55315/
> ---
> 
> (Updated Jan. 8, 2017, 7:42 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Jie Yu.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Also inlined the lambdas to simplify the code.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/src/poll_socket.cpp 
> 5410b07e7b2ba5de4c1b61f358b6bcb224012eda 
> 
> 
> Diff: https://reviews.apache.org/r/55315/diff/3/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>



Re: Review Request 61097: Added gRPC support in libprocess.

2017-07-27 Thread Chun-Hung Hsiao

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

(Updated July 28, 2017, 1:09 a.m.)


Review request for mesos, Benjamin Mahler, Jie Yu, and Joseph Wu.


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


Repository: mesos


Description (updated)
---

A gRPC client can create a `process::grpc::client::Runtime` instance and
use its `call()` method to send an asynchronous gRPC call to `Channel`
(representing a connection to a gRPC server), and get a future waiting
for the response. The `Runtime` class maintains a `CompletionQueue` to
manage all pending asynchronous gRPC calls, and spawns a thread waiting
for any response from the `CompletionQueue`. All gRPC calls using the same
`Runtime` copy would share the same `CompletionQueue` and thread.


Diffs
-

  3rdparty/libprocess/include/process/grpc.hpp PRE-CREATION 
  3rdparty/libprocess/src/grpc.cpp PRE-CREATION 


Diff: https://reviews.apache.org/r/61097/diff/4/


Testing
---

N/A


Thanks,

Chun-Hung Hsiao



Re: Review Request 61098: Added unit tests for gRPC support in libprocess.

2017-07-27 Thread Chun-Hung Hsiao

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

(Updated July 28, 2017, 12:49 a.m.)


Review request for mesos, Benjamin Mahler, Jie Yu, and Joseph Wu.


Changes
---

Updated based on the latest change in r/61097.


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


Repository: mesos


Description
---

We tested the following 6 scenarios when making gRPC calls:

1. The server responds with an OK.
2. The server responds with a failure.
3. The client discards the calls.
4. The client makes mulitple outstanding calls.
5. The client shuts down during a call.
6. The server is unreachable.
7. The server dose not respond in time.

`grpc_tests.pb.h`, `grpc_tests.pb.cc`, `grpc_tests.grpc.pb.h` and
`grpc_tests.grpc.pb.cc` are created with protobuf 3.3.0 and grpc
1.4.2 through the following command, assuming the current working
directory is `3rdparty/libprocess/src/tests`:
$ /path/to/protoc -I. --cpp_out=. --grpc_out=. \
  --plugin=protoc-gen-grpc=/path/to/grpc_cpp_plugin \
  grpc_tests.proto


Diffs (updated)
-

  3rdparty/libprocess/src/tests/grpc_tests.cpp PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.grpc.pb.h PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.grpc.pb.cc PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.pb.h PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.pb.cc PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.proto PRE-CREATION 


Diff: https://reviews.apache.org/r/61098/diff/4/

Changes: https://reviews.apache.org/r/61098/diff/3-4/


Testing
---

N/A


Thanks,

Chun-Hung Hsiao



Re: Review Request 61097: Added gRPC support in libprocess.

2017-07-27 Thread Chun-Hung Hsiao

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

(Updated July 28, 2017, 12:49 a.m.)


Review request for mesos, Benjamin Mahler, Jie Yu, and Joseph Wu.


Changes
---

`Runtime::wait()` now returns a `Future` that waits for joining the looper 
thread. `Runtime::Data` will now waits for its process to terminate during 
destruction.


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


Repository: mesos


Description
---

A gRPC client can use `process::grpc::call(...)` to send an asynchronous
gRPC call and get a future for the response. The client needs to set up
two data structures: a `Channel` which represents a connection to a gRPC
server, and a `ClientRuntime` which maintains a `CompletionQueue` that
keeps track of all pending asynchronous gRPC calls, and spawns a thread
waiting for any response from the `CompletionQueue`. All gRPC calls
using the same `ClientRuntime` would share the same thread.


Diffs (updated)
-

  3rdparty/libprocess/include/process/grpc.hpp PRE-CREATION 
  3rdparty/libprocess/src/grpc.cpp PRE-CREATION 


Diff: https://reviews.apache.org/r/61097/diff/4/

Changes: https://reviews.apache.org/r/61097/diff/3-4/


Testing
---

N/A


Thanks,

Chun-Hung Hsiao



Re: Review Request 60558: Set container DNS with `--default_container_dns` in Docker executor.

2017-07-27 Thread Avinash sridharan

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




src/docker/docker.cpp
Lines 755 (patched)


I think we need to add the wild card `*` match for `USER` network here. 
Basically if mode is `USER` and `network_name` is present we do a wild card 
match for all networks.

We want to set the DNS for the most specific match.


- Avinash sridharan


On July 25, 2017, 6:05 a.m., Qian Zhang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60558/
> ---
> 
> (Updated July 25, 2017, 6:05 a.m.)
> 
> 
> Review request for mesos, Avinash sridharan and Jie Yu.
> 
> 
> Bugs: MESOS-7709
> https://issues.apache.org/jira/browse/MESOS-7709
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Set container DNS with `--default_container_dns` in Docker executor.
> 
> 
> Diffs
> -
> 
>   src/docker/docker.hpp 5593cb635e073334c6c2566be3d803cd7febb1c3 
>   src/docker/docker.cpp 8081c0203bf62cf62aa3b93d745f0e829ad65509 
>   src/docker/executor.cpp e03f24461ec7b19cacae79c020406f0a475f2d19 
> 
> 
> Diff: https://reviews.apache.org/r/60558/diff/5/
> 
> 
> Testing
> ---
> 
> sudo make check
> 
> 1. Start Mesos master.
> ```
> $ sudo ./bin/mesos-master.sh --work_dir=/opt/mesos
> ```
> 
> 2. Start Mesos agent.
> ```
> $ sudo ./bin/mesos-slave.sh --master=192.168.122.216:5050 
> --containerizers=mesos,docker --image_providers=docker 
> --image_provisioner_backend=aufs 
> --isolation=filesystem/linux,docker/runtime,network/cni,cgroups/cpu,cgroups/mem
>  --network_cni_config_dir=/opt/cni/net_configs 
> --network_cni_plugins_dir=/opt/cni/plugins --work_dir=/opt/mesos 
> --docker_store_dir=/opt/mesos/store/docker 
> --executor_registration_timeout=60mins 
> --default_container_dns=file:///home/stack/dns.json
> 
> $ cat /home/stack/dns.json
> {
>   "mesos": [
> {
>   "network_mode": "CNI",
>   "network_name": "net1",
>   "dns": {
> "nameservers": [ "8.8.8.8", "8.8.4.4" ]
>   }
> }
>   ],
>   "docker": [
> {
>   "network_mode": "BRIDGE",
>   "dns": {
> "nameservers": [ "8.8.8.8", "8.8.4.4" ],
> "search": [ "xxx.com", "yyy.com" ],
> "options": [ "timeout:3", "attempts:2" ]
>   }
> },
> {
>   "network_mode": "USER",
>   "network_name": "net2",
>   "dns": {
> "nameservers": [ "8.8.8.8", "8.8.4.4" ]
>   }
> }
>   ]
> }
> ```
> 
> 3. Launch a Docker container with `mesos-execute`.
> ```
> $ sudo src/mesos-execute --master=192.168.122.216:5050 
> --task=file:///home/stack/task-docker.json
> 
> $cat /home/stack/task-docker.json 
> {
>   "name": "test",
>   "task_id": {"value" : "test"},
>   "agent_id": {"value" : ""},
>   "resources": [
> {
>   "name": "cpus",
>   "type": "SCALAR",
>   "scalar": {
> "value": 0.1
>   }
> },
> {
>   "name": "mem",
>   "type": "SCALAR",
>   "scalar": {
> "value": 32
>   }
> }
>   ],
>   "command": {
> "shell": false
>   },
>   "container": {
> "type": "DOCKER",
> "docker": {
>   "image": "nginx",
>   "network": "BRIDGE"
> }
>   }
> }
> ```
> 
> 4. Check the DNS configuration of the Docker container.
> ```
> $ docker ps 
> CONTAINER IDIMAGE   COMMAND  CREATED  
> STATUS  PORTS   NAMES
> ca642bf31a9fnginx   "nginx -g 'daemon off"   About a 
> minute ago   Up About a minute   80/tcp, 443/tcp 
> mesos-1d48fc32-a138-4c31-a5a9-fd7d279231da
> 
> $ docker exec ca642bf31a9f cat /etc/resolv.conf 
> search xxx.com yyy.com
> nameserver 8.8.8.8
> nameserver 8.8.4.4
> options timeout:3 attempts:2
> ```
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>



Re: Review Request 60600: Set container DNS with `--default_container_dns` in CNI isolator.

2017-07-27 Thread Avinash sridharan

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




src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
Lines 1011 (patched)


We are missing the `*` wildcard match option here,.i.e, if the 
`network_mode = CNI` and the `network_name` is not set it means it is the 
default DNS config for all the CNI networks. While setting up DNS we want to 
setup the DNS for the most specific match.


- Avinash sridharan


On July 25, 2017, 6:06 a.m., Qian Zhang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60600/
> ---
> 
> (Updated July 25, 2017, 6:06 a.m.)
> 
> 
> Review request for mesos, Avinash sridharan and Jie Yu.
> 
> 
> Bugs: MESOS-7709
> https://issues.apache.org/jira/browse/MESOS-7709
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Set container DNS with `--default_container_dns` in CNI isolator.
> 
> 
> Diffs
> -
> 
>   src/slave/containerizer/mesos/isolators/network/cni/cni.cpp 
> 831bc7d0774a0ad3c8cbd7f42d4a3f8bd34d3243 
> 
> 
> Diff: https://reviews.apache.org/r/60600/diff/4/
> 
> 
> Testing
> ---
> 
> sudo make check
> 
> 1. Start Mesos master.
> ```
> $ sudo ./bin/mesos-master.sh --work_dir=/opt/mesos
> ```
> 
> 2. Start Mesos agent.
> ```
> $ sudo ./bin/mesos-slave.sh --master=192.168.122.216:5050 
> --containerizers=mesos,docker --image_providers=docker 
> --image_provisioner_backend=aufs 
> --isolation=filesystem/linux,docker/runtime,network/cni,cgroups/cpu,cgroups/mem
>  --network_cni_config_dir=/opt/cni/net_configs 
> --network_cni_plugins_dir=/opt/cni/plugins --work_dir=/opt/mesos 
> --docker_store_dir=/opt/mesos/store/docker 
> --executor_registration_timeout=60mins 
> --default_container_dns=file:///home/stack/dns.json
> 
> $ cat /opt/cni/net_configs/net1 
> {
> "name": "net1",
> "type": "bridge",
> "bridge": "br1",
> "isGateway": true,
> "ipMasq": true,
> "ipam": {
> "type": "host-local",
> "subnet": "192.168.1.0/24",
> "routes": [
> { "dst": "0.0.0.0/0" }
> ]
> }
> }
> 
> $ cat /opt/cni/net_configs/net2 
> {
> "name": "net2",
> "type": "bridge",
> "bridge": "br2",
> "isGateway": true,
> "ipMasq": true,
> "ipam": {
> "type": "host-local",
> "subnet": "192.168.2.0/24",
> "routes": [
> { "dst": "0.0.0.0/0" }
> ]
> },
> "dns": {
> "nameservers": [ "8.8.4.4" ],
> "domain": "net2.com",
> "search": [ "yyy.com" ],
> "options": [ "attempts:3" ]
> }
> }
> 
> $ cat /home/stack/dns.json
> {
>   "mesos": [
> {
>   "network_mode": "CNI",
>   "network_name": "net1",
>   "dns": {
> "nameservers": [ "8.8.8.8" ],
> "search": [ "xxx.com" ],
> "options": [ "timeout:4" ]
>   }
> }
>   ]
> }
> ```
> 
> 3. Launch a unified container with `mesos-execute`.
> ```
> $ sudo src/mesos-execute --master=192.168.122.216:5050 
> --task=file:///home/stack/task.json
> 
> $ cat /home/stack/task.json 
> {
>   "name": "test",
>   "task_id": {"value" : "test"},
>   "agent_id": {"value" : ""},
>   "resources": [
> {
>   "name": "cpus",
>   "type": "SCALAR",
>   "scalar": {
> "value": 0.1
>   }
> },
> {
>   "name": "mem",
>   "type": "SCALAR",
>   "scalar": {
> "value": 32
>   }
> }
>   ],
>   "command": {
> "value": "sleep 300"
>   },
>   "container": {
> "type": "MESOS",
> "mesos": {
>   "image": {
> "type": "DOCKER",
> "docker": {
>   "name": "busybox"
> }
>   }
> },
> "network_infos": [
>   {
> "name": "net1"
>   },
>   {
> "name": "net2"
>   }
> ]
>   }
> }
> ```
> 
> 4. Check the DNS configuration of the unified container.
> ```
> $ ps -ef | grep sleep 
> root 20060 20037  2 21:45 ?00:00:00 sh -c sleep 300
> root 20074 20060  0 21:45 ?00:00:00 sleep 300
> 
> $ sudo nsenter -t 20060 -m -u -n cat /etc/resolv.conf   
> domain net2.com
> search yyy.com xxx.com
> options attempts:3 timeout:4
> nameserver 8.8.4.4
> nameserver 8.8.8.8
> ```
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>



Re: Review Request 60784: Fixed a bug in operator== for DiskInfo::Source.

2017-07-27 Thread Greg Mann

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


Ship it!




I spent a while trying to come up with a good test case, but unfortunately the 
resources-related operators as written don't make this easy. Code LGTM, let's 
go ahead and ship it.

- Greg Mann


On July 11, 2017, 10:29 p.m., Neil Conway wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60784/
> ---
> 
> (Updated July 11, 2017, 10:29 p.m.)
> 
> 
> Review request for mesos and Greg Mann.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> The previous implementation was incorrect for the case when either
> `right.path` or `right.mount` is set but the corresponding field in
> `left` is unset.
> 
> 
> Diffs
> -
> 
>   src/common/resources.cpp 3f4fff4f1dbe9c8acc55e3077212fe329e53e4d9 
>   src/v1/resources.cpp 55d493e89114acc94b1524f3f94a47ccea20469a 
> 
> 
> Diff: https://reviews.apache.org/r/60784/diff/1/
> 
> 
> Testing
> ---
> 
> `make check`
> 
> I tried to write a unit test for this specific problem but wasn't able to 
> repro :-\ Current coding seems wrong / inconsistent in any case, though.
> 
> 
> Thanks,
> 
> Neil Conway
> 
>



Re: Review Request 60793: Added a test `CniIsolatorTest.ROOT_VerifyDefaultDNS`.

2017-07-27 Thread Avinash sridharan

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




src/tests/containerizer/cni_isolator_tests.cpp
Lines 1226 (patched)


Similar to the `DockerContainerizer` can we add a test for the flags 
themselves to check that we don't allow setting DNS for HOST mode? Also, would 
be great to test the matching algorithm we use to setup the DNS when we have 
multiple DNS entries.


- Avinash sridharan


On July 25, 2017, 6:08 a.m., Qian Zhang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60793/
> ---
> 
> (Updated July 25, 2017, 6:08 a.m.)
> 
> 
> Review request for mesos, Avinash sridharan and Jie Yu.
> 
> 
> Bugs: MESOS-7709
> https://issues.apache.org/jira/browse/MESOS-7709
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added a test `CniIsolatorTest.ROOT_VerifyDefaultDNS`.
> 
> 
> Diffs
> -
> 
>   src/tests/containerizer/cni_isolator_tests.cpp 
> ae0980bd671849fcd3e19941b33c7d3b09fdae7c 
> 
> 
> Diff: https://reviews.apache.org/r/60793/diff/3/
> 
> 
> Testing
> ---
> 
> sudo make check
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>



Re: Review Request 60761: Added a test `DockerContainerizerTest.ROOT_DOCKER_DefaultDNS`.

2017-07-27 Thread Avinash sridharan

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


Fix it, then Ship it!




Ship It!


src/tests/containerizer/docker_containerizer_tests.cpp
Lines 4357 (patched)


Can we have a test for checking validation error on setting up the HOST 
MODE?


- Avinash sridharan


On July 25, 2017, 6:07 a.m., Qian Zhang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60761/
> ---
> 
> (Updated July 25, 2017, 6:07 a.m.)
> 
> 
> Review request for mesos, Avinash sridharan and Jie Yu.
> 
> 
> Bugs: MESOS-7709
> https://issues.apache.org/jira/browse/MESOS-7709
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added a test `DockerContainerizerTest.ROOT_DOCKER_DefaultDNS`.
> 
> 
> Diffs
> -
> 
>   src/tests/containerizer/docker_containerizer_tests.cpp 
> 1e85a79f812399270575ea4a64db10e72f40e648 
> 
> 
> Diff: https://reviews.apache.org/r/60761/diff/3/
> 
> 
> Testing
> ---
> 
> sudo make check
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>



Re: Review Request 60760: Parsed DNS related info from the output of `docker inspect`.

2017-07-27 Thread Avinash sridharan

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


Ship it!




Ship It!

- Avinash sridharan


On July 11, 2017, 9:01 a.m., Qian Zhang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60760/
> ---
> 
> (Updated July 11, 2017, 9:01 a.m.)
> 
> 
> Review request for mesos, Avinash sridharan and Jie Yu.
> 
> 
> Bugs: MESOS-7709
> https://issues.apache.org/jira/browse/MESOS-7709
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Parsed DNS related info from the output of `docker inspect`.
> 
> 
> Diffs
> -
> 
>   src/docker/docker.hpp 5593cb635e073334c6c2566be3d803cd7febb1c3 
>   src/docker/docker.cpp 8ca0c68836ea5d1a1186e79942f6daccf6c6da46 
> 
> 
> Diff: https://reviews.apache.org/r/60760/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>



Review Request 61198: Added explicit EventQueue::Producer/Consumer interfaces.

2017-07-27 Thread Benjamin Hindman

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

Review request for mesos and Benjamin Mahler.


Repository: mesos


Description
---

Added explicit EventQueue::Producer/Consumer interfaces.


Diffs
-

  3rdparty/libprocess/src/event_queue.hpp PRE-CREATION 
  3rdparty/libprocess/src/process.cpp b268cdad776a3ca2a87cbe60eb098bde2a70667c 


Diff: https://reviews.apache.org/r/61198/diff/1/


Testing
---

make check


Thanks,

Benjamin Hindman



Re: Review Request 60933: Added stats/control helpers for the Blkio cgroup subsystem.

2017-07-27 Thread Gilbert Song

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

(Updated July 27, 2017, 5:30 p.m.)


Review request for mesos, haosdent huang, Jason Lai, Jie Yu, Qian Zhang, and 
Zhitao Li.


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


Repository: mesos


Description
---

- Data structure for Blkio entities
- Stats helpers for blkio.throttle.io* (generic blkio stats)
- Stats helpers for blkio.io* (CFQ related stats)
- Comments from the kernel blkio doc for helper functions


Diffs (updated)
-

  src/linux/cgroups.hpp eaf0dcad0ed38c507564624f1647e0c731b8b433 
  src/linux/cgroups.cpp 334005abfc4ec9b20b7dc0212d852ba1f505dbb5 


Diff: https://reviews.apache.org/r/60933/diff/5/

Changes: https://reviews.apache.org/r/60933/diff/4-5/


Testing
---

make check


Thanks,

Gilbert Song



Re: Review Request 61075: Set container DNS with `--default_container_dns` in DockerContainerizer.

2017-07-27 Thread Avinash sridharan

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


Fix it, then Ship it!




Ship It!


src/slave/containerizer/docker.cpp
Lines 1333-1339 (patched)


Some edits to the comment:
We need to pass `flags.default_container_dns` only when the agent is not 
running in a Docker container. This is to handle the case of launching a custom 
executor in a Docker container. If the agent is running in a Docker container 
(i.e., `flags.docker_mesos_image.isSome() == true`), that is the case of 
launching `mesos-docker-executor` in a Docker container with the Docker image 
`flags.docker_mesos_image`. In that case we already set 
`flags.default_container_dns` in the method `dockerFlags()`.


- Avinash sridharan


On July 24, 2017, 8 a.m., Qian Zhang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61075/
> ---
> 
> (Updated July 24, 2017, 8 a.m.)
> 
> 
> Review request for mesos, Avinash sridharan and Jie Yu.
> 
> 
> Bugs: MESOS-7709
> https://issues.apache.org/jira/browse/MESOS-7709
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Set container DNS with `--default_container_dns` in DockerContainerizer.
> 
> 
> Diffs
> -
> 
>   src/slave/containerizer/docker.cpp 2fe92272d7ac6d916371c55affe24598255f10eb 
> 
> 
> Diff: https://reviews.apache.org/r/61075/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>



Re: Review Request 61171: Enabled filtering of the 'GET_AGENTS' v1 API call.

2017-07-27 Thread Greg Mann

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



Looking good; one small comment below to consider.

We should definitely add a test case for this as well.


src/master/http.cpp
Lines 2518-2520 (original), 2553-2555 (patched)


What about authorizing this field? It doesn't include dynamic reservation 
information, but there could be statically reserved resources with role 
information in `SlaveInfo`. I haven't verified that the recovered agents field 
does print the roles of static reservations, but it looks to me like it would?


- Greg Mann


On July 27, 2017, 7:48 a.m., Alexander Rojas wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61171/
> ---
> 
> (Updated July 27, 2017, 7:48 a.m.)
> 
> 
> Review request for mesos, Adam B, Greg Mann, Quinn Leng, and Till Toenshoff.
> 
> 
> Bugs: MESOS-7416
> https://issues.apache.org/jira/browse/MESOS-7416
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Enables filtering of the results of calls to the 'GET_AGENTS' v1
> API. It filters the contents of different resources entries based
> on the 'VIEW_ROLE' permissions of the principal doing the request
> based on resource roles, allocation roles and reservations.
> 
> 
> Diffs
> -
> 
>   src/common/protobuf_utils.hpp 2156f6d158bfee16d29aa3531bdd156af581df01 
>   src/common/protobuf_utils.cpp 4e5ab02c90ad8490efbcc471f7fd7c48be0c4678 
>   src/master/http.cpp 9df086c417a9392f62d600c7a6486be0a1cf7e70 
>   src/master/master.hpp 84465af782d4024f22463d981ef9d0ef7827d043 
> 
> 
> Diff: https://reviews.apache.org/r/61171/diff/2/
> 
> 
> Testing
> ---
> 
> ```shell
> mkdir -p /tmp/mesos/master
> mkdir -p /tmp/mesos/agent
> 
> # Create credentials
> cat < /tmp/mesos/credentials.txt
> hal-9000 dave
> glados potato
> skynet connor
> EOF
> 
> # Create ACLs
> cat < /tmp/mesos/acls.json
> {
>   "permissive": true,
>   "view_roles" : [
>{
>  "principals" : { "type" : "ANY" },
>  "roles" : { "values" : ["*"] }
>},
>{
>  "principals" : { "values" : ["hal-9000"] },
>  "roles" : { "values" : ["space-odyssey"] }
>},
>{
>  "principals" : { "values" : ["hal-9000"] },
>  "roles" : { "type" : "NONE" }
>},
>{
>  "principals" : { "values" : ["glados"] },
>  "roles" : { "values" : ["portal"] }
>},
>{
>  "principals" : { "values" : ["glados"] },
>  "roles" : { "type" : "NONE" }
>},
>{
>  "principals" : { "values" : ["skynet"] },
>  "roles" : { "values" : ["terminator"] }
>},
>{
>  "principals" : { "values" : ["skynet"] },
>  "roles" : { "type" : "NONE" }
>}
>   ]
> }
> EOF
> 
> # Launch Master with some predefined roles.
> ./bin/mesos-master.sh \
> --work_dir=/tmp/mesos/master \
> --log_dir=/tmp/mesos/master/log \
> --authenticate_http \
> --credentials=/tmp/mesos/credentials.txt \
> --authenticate_http_frameworks \
> --http_framework_authenticators=basic \
> --http_authenticators=basic \
> --authenticate_http_readonly \
> --acls=/tmp/mesos/acls.json \
> --roles="space-odyssey,portal,terminator" &
> 
> # Launch Agent with static reservations for all roles.
> sudo ./bin/mesos-agent.sh \
> --master=127.0.0.1:5050 \
> --work_dir=/tmp/mesos/agent \
> --authenticate_http_readwrite \
> --http_authenticators=basic \
> --http_credentials=/tmp/mesos/credentials.txt \
> --acls=/tmp/mesos/acls.json \
> 
> --resources='cpus(space-odyssey):2;cpus(portal):2;cpus(*):4;mem(space-odyssey):250;mem(portal):250;mem(*):10360;ports(space-odyssey):[31000-32000];ports(portal):[32001-33000];ports(*):[33001-35000];disk(space-odyssey):250;disk(portal):250;disk(*):1000'
>  &
> 
> # Launch test framework.
> ./src/mesos-execute \
> --master=127.0.0.1:5050 \
> --command='while true; do echo "Hello World"; sleep 5; done;' \
> --resources="cpus:1;mem:128;disk:32;ports:[31002-31003]" \
> --role=space-odyssey \
> --name=hello-discovery \
> --principal=hal-9000 \
> --secret=dave &
> 
> # Create a dynamic reservation.
> cat > /tmp/resources.json < [
>   {
> "name": "cpus",
> "type": "SCALAR",
> "scalar": { "value": 2 },
> "role": "terminator",
> "reservation": {
>   "principal": "skynet"
> }
>   },
>   {
> "name": "mem",
> "type": "SCALAR",
> "scalar": { "value": 250 },
> "role": "terminator",
> "reservation": {
>   "principal": "skynet"
> }
>   },
>   {
> "name": "disk",
> "type": "SCALAR",
> "scalar": { "value": 250 },
> "role": "terminator",
> "reservation": 

Re: Review Request 61098: Added unit tests for gRPC support in libprocess.

2017-07-27 Thread Chun-Hung Hsiao

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

(Updated July 27, 2017, 10:26 p.m.)


Review request for mesos, Benjamin Mahler, Jie Yu, and Joseph Wu.


Changes
---

Updated based on the changes in r/61097.


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


Repository: mesos


Description
---

We tested the following 6 scenarios when making gRPC calls:

1. The server responds with an OK.
2. The server responds with a failure.
3. The client discards the calls.
4. The client makes mulitple outstanding calls.
5. The client shuts down during a call.
6. The server is unreachable.
7. The server dose not respond in time.

`grpc_tests.pb.h`, `grpc_tests.pb.cc`, `grpc_tests.grpc.pb.h` and
`grpc_tests.grpc.pb.cc` are created with protobuf 3.3.0 and grpc
1.4.2 through the following command, assuming the current working
directory is `3rdparty/libprocess/src/tests`:
$ /path/to/protoc -I. --cpp_out=. --grpc_out=. \
  --plugin=protoc-gen-grpc=/path/to/grpc_cpp_plugin \
  grpc_tests.proto


Diffs (updated)
-

  3rdparty/libprocess/src/tests/grpc_tests.cpp PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.grpc.pb.h PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.grpc.pb.cc PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.pb.h PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.pb.cc PRE-CREATION 
  3rdparty/libprocess/src/tests/grpc_tests.proto PRE-CREATION 


Diff: https://reviews.apache.org/r/61098/diff/3/

Changes: https://reviews.apache.org/r/61098/diff/2-3/


Testing
---

N/A


Thanks,

Chun-Hung Hsiao



Re: Review Request 61097: Added gRPC support in libprocess.

2017-07-27 Thread Chun-Hung Hsiao

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

(Updated July 27, 2017, 10:24 p.m.)


Review request for mesos, Benjamin Mahler, Jie Yu, and Joseph Wu.


Changes
---

Addressed Jie's comments.


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


Repository: mesos


Description
---

A gRPC client can use `process::grpc::call(...)` to send an asynchronous
gRPC call and get a future for the response. The client needs to set up
two data structures: a `Channel` which represents a connection to a gRPC
server, and a `ClientRuntime` which maintains a `CompletionQueue` that
keeps track of all pending asynchronous gRPC calls, and spawns a thread
waiting for any response from the `CompletionQueue`. All gRPC calls
using the same `ClientRuntime` would share the same thread.


Diffs (updated)
-

  3rdparty/libprocess/include/process/grpc.hpp PRE-CREATION 
  3rdparty/libprocess/src/grpc.cpp PRE-CREATION 


Diff: https://reviews.apache.org/r/61097/diff/3/

Changes: https://reviews.apache.org/r/61097/diff/2-3/


Testing
---

N/A


Thanks,

Chun-Hung Hsiao



Re: Review Request 61097: Added gRPC support in libprocess.

2017-07-27 Thread Chun-Hung Hsiao


> On July 26, 2017, 10:49 p.m., Jie Yu wrote:
> > 3rdparty/libprocess/include/process/grpc.hpp
> > Lines 101 (patched)
> > 
> >
> > s/method/stub/
> > 
> > I'd also restructure this a bit (indentation for function paramters 
> > should be 4:
> > ```
> > std::unique_ptr<::grpc::ClientAsyncResponseReader>(T::*stub)(
> > ::grpc::ClientContext*,
> > const Request&,
> > ::grpc::CompletionQueue*),
> > ```

I changed `T` to `Stub` to reflect that it's the `Stub` class in gRPC's 
generated code. `method` is renamed to `rpc`.


> On July 26, 2017, 10:49 p.m., Jie Yu wrote:
> > 3rdparty/libprocess/include/process/grpc.hpp
> > Lines 106 (patched)
> > 
> >
> > In fact, I would introduce a `terminated` field in 
> > `client::Runtime::Data`, and introduce a `wait` method for 
> > `client::Runtime`:
> > ```
> > class Runtime
> > {
> > public:
> >   // The future will become ready when the runtime is terminated;
> >   Future wait()
> >   {
> > return data->terminating.future()
> >   .then(defer(process, [=]() {
> > // NOTE: This is a blocking call. However, the thread is
> > // guaranteed to be exiting, therefore the amount of time in
> > // blocking state is bounded (just like other syscalls we
> > // invoke).
> > looper->join();
> > 
> > return Nothing();
> >   }));
> >   }
> >   
> >   void terminate()
> >   {
> > // This will signal the looper thread to exit.
> > data->terminate.test_and_set();
> >   }
> >   
> > private:
> >   struct Data
> >   {
> > ...
> > std::atomic_flag terminate;
> > Promise terminating;
> >   };
> > };
> > ```
> > 
> > You probably want to use `AsyncNext` rather than `Next` so that the 
> > looper thread can be interrupted (by always checking `data->terminate`.

gRPC requires us to drain the `CompletionQueue` before it gets destructed. 
Therefore even if we make `Data::loop()` interruptible, we still need to run a 
loop somewhere to drain the queue. I'd prefer that we call 
`CompletionQueue::Shutdown()` in `Runtime::terminate()`, then let 
`Data::loop()` to drain all pending callbacks in the queue. Also, if we send 
out another call after `CompletionQueue::Shutdown()` is called, the behavior is 
undocumented. I've reach out to the community to ask if there's a way to do 
error handling on this scenario, but for now I'll make `Runtime::call()` and 
`Runtime::terminate()` mutual exclusive and introduce a `Data::terminate` 
boolean variable (similar to `Future::Data::discard`) to avoid it.

Also, I'd like that `Runtime::terminate()` also trigggers the terminatation of 
the process managed by `data` after it processes all pending callbacks. 
Currently I make `Runtime::terminate()` and `Runtime::wait()` similar to 
`process::terminate()` and `process::wait()`, so `Runtime::wait()` returns a 
bool instead of a `Future`. Please refer to my updated patch and share your 
thoughts about my changes.


> On July 26, 2017, 10:49 p.m., Jie Yu wrote:
> > 3rdparty/libprocess/include/process/grpc.hpp
> > Lines 123 (patched)
> > 
> >
> > who is going to delete the lambda function?
> 
> Chun-Hung Hsiao wrote:
> This lambda will be retrieved and managed by a `shared_ptr` in 
> `client::Runtime::Data::loop()`. When it will be deleted depends on if the 
> call is successful. If so, the `shared_ptr` will be captured by another 
> lambda that is dispatched to `client::Runtime::process`, and thus this lambda 
> will be deleted after execution; otherwise, this lambda will be deleted at 
> the end of the lifecycle of the `shared_ptr`. It is required that a 
> `CompletionQueue` must be drained before getting destructed, so a regular 
> termination process would call `CompletionQueue::Shutdown()` which makes 
> `CompletionQueue::Next()` to return pending calls as failures in 
> `client::Runtime::Data::loop()`, thus all allocated lambdas will eventually 
> be deleted.

Added comments to explain that it will be managed in `Data::loop()`.


> On July 26, 2017, 10:49 p.m., Jie Yu wrote:
> > 3rdparty/libprocess/include/process/grpc.hpp
> > Lines 124 (patched)
> > 
> >
> > I would comment on why you need to capture those field that are not 
> > used in the lambda function. Is it possible that compiler optimize it away?

According to http://en.cppreference.com/w/cpp/language/lambda, my 
interpretation is that they won't be optimized out. @mpark also said so.


> On July 26, 2017, 10:49 p.m., Jie Yu wrote:
> > 

Re: Review Request 61194: Updated the docs for V1 Events.

2017-07-27 Thread Quinn Leng

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

(Updated July 27, 2017, 10:18 p.m.)


Review request for mesos, Anand Mazumdar and Greg Mann.


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


Repository: mesos


Description
---

Added documentation for 'AgentAdded', 'AgentRemoved',
'FrameworkAdded', 'FrameworkUpdated' and 'FrameworkRemoved' events.


Diffs (updated)
-

  docs/operator-http-api.md c096a048001453e5b7efc1fb8e3b9db835685886 


Diff: https://reviews.apache.org/r/61194/diff/2/

Changes: https://reviews.apache.org/r/61194/diff/1-2/


Testing
---


Thanks,

Quinn Leng



Re: Review Request 61194: Updated the docs for V1 Events.

2017-07-27 Thread Anand Mazumdar

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



Also, did you verify that this renders fine on markdown?

- Anand Mazumdar


On July 27, 2017, 10 p.m., Quinn Leng wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61194/
> ---
> 
> (Updated July 27, 2017, 10 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar and Greg Mann.
> 
> 
> Bugs: MESOS-7246
> https://issues.apache.org/jira/browse/MESOS-7246
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added documentation for 'AgentAdded', 'AgentRemoved',
> 'FrameworkAdded', 'FrameworkUpdated' and 'FrameworkRemoved' events.
> 
> 
> Diffs
> -
> 
>   docs/operator-http-api.md c096a048001453e5b7efc1fb8e3b9db835685886 
> 
> 
> Diff: https://reviews.apache.org/r/61194/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Quinn Leng
> 
>



Re: Review Request 61194: Updated the docs for V1 Events.

2017-07-27 Thread Anand Mazumdar

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


Fix it, then Ship it!





docs/operator-http-api.md
Lines 2479 (patched)


s/re-register/re-registers


- Anand Mazumdar


On July 27, 2017, 10 p.m., Quinn Leng wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61194/
> ---
> 
> (Updated July 27, 2017, 10 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar and Greg Mann.
> 
> 
> Bugs: MESOS-7246
> https://issues.apache.org/jira/browse/MESOS-7246
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added documentation for 'AgentAdded', 'AgentRemoved',
> 'FrameworkAdded', 'FrameworkUpdated' and 'FrameworkRemoved' events.
> 
> 
> Diffs
> -
> 
>   docs/operator-http-api.md c096a048001453e5b7efc1fb8e3b9db835685886 
> 
> 
> Diff: https://reviews.apache.org/r/61194/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Quinn Leng
> 
>



Review Request 61194: Updated the docs for V1 Events.

2017-07-27 Thread Quinn Leng

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

Review request for mesos, Anand Mazumdar and Greg Mann.


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


Repository: mesos


Description
---

Added documentation for 'AgentAdded', 'AgentRemoved',
'FrameworkAdded', 'FrameworkUpdated' and 'FrameworkRemoved' events.


Diffs
-

  docs/operator-http-api.md c096a048001453e5b7efc1fb8e3b9db835685886 


Diff: https://reviews.apache.org/r/61194/diff/1/


Testing
---


Thanks,

Quinn Leng



Review Request 61193: Convert resource format for completed frameworks.

2017-07-27 Thread Jiang Yan Xu

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

Review request for mesos, Adam B and Michael Park.


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


Repository: mesos


Description
---

This patch is similar to 4ec820709. We need to convert all resources
from old agents without reservation-refinement capability, including
task resources from completed frameworks.


Diffs
-

  src/master/master.cpp e12c997dad04f8a4ddb47a993a84b2b05c9e2f32 


Diff: https://reviews.apache.org/r/61193/diff/1/


Testing
---

make check and tested in a testing cluster.


Thanks,

Jiang Yan Xu



Review Request 61189: Added authorization for V1 events.

2017-07-27 Thread Quinn Leng

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

Review request for mesos, Anand Mazumdar, Alexander Rojas, and Greg Mann.


Repository: mesos


Description
---

Added authorization filtering for V1 streaming events, the
subscriber should only receive events that are authorized
based on their principal and ACLs.


Diffs
-

  src/master/http.cpp 9df086c417a9392f62d600c7a6486be0a1cf7e70 
  src/master/master.hpp 84465af782d4024f22463d981ef9d0ef7827d043 
  src/master/master.cpp e12c997dad04f8a4ddb47a993a84b2b05c9e2f32 
  src/tests/api_tests.cpp f22ca28c819712d8797e0c0c69dc1ebf1fe5ac1f 


Diff: https://reviews.apache.org/r/61189/diff/1/


Testing
---

make check
GLOG_v=2 ./bin/mesos-tests.sh 
--gtest_filter="ContentType/MasterAPITest.EventsAuthorizationFiltering*" 
--verbose --gtest_repeat=100 --gtest_break_on_failure


Thanks,

Quinn Leng



Re: Review Request 60931: Added test cases for framework streaming events.

2017-07-27 Thread Quinn Leng

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

(Updated July 27, 2017, 6:24 p.m.)


Review request for mesos, Anand Mazumdar, Greg Mann, and Zhitao Li.


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


Repository: mesos


Description
---

Added test cases for 'FRAMEWORK_ADDED', 'FRAMEWORK_UPDATED' and
'FRAMEWORK_REMOVED' events in v1 operator API.


Diffs (updated)
-

  src/tests/api_tests.cpp f22ca28c819712d8797e0c0c69dc1ebf1fe5ac1f 


Diff: https://reviews.apache.org/r/60931/diff/4/

Changes: https://reviews.apache.org/r/60931/diff/3-4/


Testing
---

make check


Thanks,

Quinn Leng



Re: Review Request 60929: Added 'FRAMEWORK_UPDATED' event for master streaming api.

2017-07-27 Thread Quinn Leng

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

(Updated July 27, 2017, 6:23 p.m.)


Review request for mesos, Anand Mazumdar, Greg Mann, and Zhitao Li.


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


Repository: mesos


Description
---

Added event 'FRAMEWORK_UPDATED' for master's v1 streaming operator API.
It will be generated when the framework re-registers with the master.


Diffs (updated)
-

  include/mesos/master/master.proto 7a722a6deac484f28a85f63fd68ef49cb6a47606 
  include/mesos/v1/master/master.proto cf88ea64fa08e4bdcf685de4def28d374eb32fdf 
  src/common/protobuf_utils.hpp 2156f6d158bfee16d29aa3531bdd156af581df01 
  src/common/protobuf_utils.cpp 4e5ab02c90ad8490efbcc471f7fd7c48be0c4678 
  src/master/master.cpp e12c997dad04f8a4ddb47a993a84b2b05c9e2f32 


Diff: https://reviews.apache.org/r/60929/diff/6/

Changes: https://reviews.apache.org/r/60929/diff/5-6/


Testing
---

make check


Thanks,

Quinn Leng



Re: Review Request 59960: Add data structures and stats/control helpers for the Blkio cgroup subsystem

2017-07-27 Thread Gilbert Song


> On July 21, 2017, 4:48 p.m., James Peach wrote:
> > src/linux/cgroups.hpp
> > Lines 442 (patched)
> > 
> >
> > Can we come up with a better name than `Entry`? I think that this is a 
> > per-device sample, so `DeviceValue`?
> > 
> > Similar for `StatEntry`.

this may not be device specific. e.g., it can be `weight` or `leaf_weight`, or 
some `Total` values. Here is the possible fomats in cgroup blkio files:
```
// 1. 
// 2.  
// 3.   
// 4.  
```


- Gilbert


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


On June 9, 2017, 4:24 p.m., Jason Lai wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59960/
> ---
> 
> (Updated June 9, 2017, 4:24 p.m.)
> 
> 
> Review request for mesos, Eric Chung, Xiaojian Huang, Gilbert Song, haosdent 
> huang, Jie Yu, and Zhitao Li.
> 
> 
> Bugs: MESOS-6162
> https://issues.apache.org/jira/browse/MESOS-6162
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> * Data structure for Blkio entities 
> * Stats helpers for `blkio.throttle.io*` (generic blkio stats)
> * Stats helpers for `blkio.io*` (CFQ related stats)
> * Comments from the kernel blkio doc for helper functions
> 
> 
> Diffs
> -
> 
>   src/linux/cgroups.hpp eaf0dcad0ed38c507564624f1647e0c731b8b433 
>   src/linux/cgroups.cpp 334005abfc4ec9b20b7dc0212d852ba1f505dbb5 
> 
> 
> Diff: https://reviews.apache.org/r/59960/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Jason Lai
> 
>



Re: Review Request 60928: Added 'FRAMEWORK_ADDED' event for master streaming api.

2017-07-27 Thread Anand Mazumdar

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


Ship it!




Ship It!

- Anand Mazumdar


On July 25, 2017, 8:24 p.m., Quinn Leng wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60928/
> ---
> 
> (Updated July 25, 2017, 8:24 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Greg Mann, and Zhitao Li.
> 
> 
> Bugs: MESOS-6101
> https://issues.apache.org/jira/browse/MESOS-6101
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added event 'FRAMEWORK_ADDED' for master's v1 streaming operator API.
> It will be generated when the framework registers for the first time.
> 
> 
> Diffs
> -
> 
>   include/mesos/master/master.proto 7a722a6deac484f28a85f63fd68ef49cb6a47606 
>   include/mesos/v1/master/master.proto 
> cf88ea64fa08e4bdcf685de4def28d374eb32fdf 
>   src/common/protobuf_utils.hpp 2156f6d158bfee16d29aa3531bdd156af581df01 
>   src/common/protobuf_utils.cpp 4e5ab02c90ad8490efbcc471f7fd7c48be0c4678 
>   src/master/master.cpp e12c997dad04f8a4ddb47a993a84b2b05c9e2f32 
> 
> 
> Diff: https://reviews.apache.org/r/60928/diff/7/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Quinn Leng
> 
>



Re: Review Request 60929: Added 'FRAMEWORK_UPDATED' event for master streaming api.

2017-07-27 Thread Anand Mazumdar

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


Fix it, then Ship it!





include/mesos/master/master.proto
Lines 522 (patched)


Missing dot at the end. :-)



include/mesos/v1/master/master.proto
Lines 522 (patched)


s/re-register/re-registers



src/master/master.cpp
Lines 2738 (patched)


Why newline here?


- Anand Mazumdar


On July 18, 2017, 12:18 a.m., Quinn Leng wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60929/
> ---
> 
> (Updated July 18, 2017, 12:18 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Greg Mann, and Zhitao Li.
> 
> 
> Bugs: MESOS-6101
> https://issues.apache.org/jira/browse/MESOS-6101
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added event 'FRAMEWORK_UPDATED' for master's v1 streaming operator API.
> It will be generated when the framework re-registers with the master.
> 
> 
> Diffs
> -
> 
>   include/mesos/master/master.proto 7a722a6deac484f28a85f63fd68ef49cb6a47606 
>   include/mesos/v1/master/master.proto 
> cf88ea64fa08e4bdcf685de4def28d374eb32fdf 
>   src/common/protobuf_utils.hpp 2156f6d158bfee16d29aa3531bdd156af581df01 
>   src/common/protobuf_utils.cpp 4e5ab02c90ad8490efbcc471f7fd7c48be0c4678 
>   src/master/master.cpp e12c997dad04f8a4ddb47a993a84b2b05c9e2f32 
> 
> 
> Diff: https://reviews.apache.org/r/60929/diff/5/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Quinn Leng
> 
>



Re: Review Request 60930: Added 'FRAMEWORK_REMOVED' event for master streaming api.

2017-07-27 Thread Anand Mazumdar

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


Ship it!




Ship It!

- Anand Mazumdar


On July 18, 2017, 12:23 a.m., Quinn Leng wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60930/
> ---
> 
> (Updated July 18, 2017, 12:23 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Greg Mann, and Zhitao Li.
> 
> 
> Bugs: MESOS-6101
> https://issues.apache.org/jira/browse/MESOS-6101
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added 'FRAMEWORK_REMOVED' event for master streaming api.
> 
> 
> Diffs
> -
> 
>   include/mesos/master/master.proto 7a722a6deac484f28a85f63fd68ef49cb6a47606 
>   include/mesos/v1/master/master.proto 
> cf88ea64fa08e4bdcf685de4def28d374eb32fdf 
>   src/common/protobuf_utils.hpp 2156f6d158bfee16d29aa3531bdd156af581df01 
>   src/common/protobuf_utils.cpp 4e5ab02c90ad8490efbcc471f7fd7c48be0c4678 
>   src/master/master.cpp e12c997dad04f8a4ddb47a993a84b2b05c9e2f32 
> 
> 
> Diff: https://reviews.apache.org/r/60930/diff/4/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Quinn Leng
> 
>



Re: Review Request 60931: Added test cases for framework streaming events.

2017-07-27 Thread Anand Mazumdar

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


Fix it, then Ship it!




Just some minor nits to fix.


src/tests/api_tests.cpp
Lines 1977 (patched)


s/, as a result, the/. The



src/tests/api_tests.cpp
Lines 1982-1986 (patched)


Move this before L2007 to be close to where its used.



src/tests/api_tests.cpp
Lines 1984 (patched)


s/to be a/to a



src/tests/api_tests.cpp
Lines 1986 (patched)


Can we just use `Weeks(2)` here instead of the magic number



src/tests/api_tests.cpp
Lines 2082 (patched)


s/As a result, the/The


- Anand Mazumdar


On July 18, 2017, 12:29 a.m., Quinn Leng wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60931/
> ---
> 
> (Updated July 18, 2017, 12:29 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Greg Mann, and Zhitao Li.
> 
> 
> Bugs: MESOS-6101
> https://issues.apache.org/jira/browse/MESOS-6101
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added test cases for 'FRAMEWORK_ADDED', 'FRAMEWORK_UPDATED' and
> 'FRAMEWORK_REMOVED' events in v1 operator API.
> 
> 
> Diffs
> -
> 
>   src/tests/api_tests.cpp f22ca28c819712d8797e0c0c69dc1ebf1fe5ac1f 
> 
> 
> Diff: https://reviews.apache.org/r/60931/diff/3/
> 
> 
> Testing
> ---
> 
> make check
> 
> 
> Thanks,
> 
> Quinn Leng
> 
>



Re: Review Request 61183: Triggered 'UpdateSlaveMessage' when 'ResourceProviderManager' updates.

2017-07-27 Thread Mesos Reviewbot Windows

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



Patch looks great!

Reviews applied: [61179, 61180, 61181, 61182, 61183]

Passed command: support\windows-build.bat

- Mesos Reviewbot Windows


On July 27, 2017, 2:49 p.m., Benjamin Bannier wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61183/
> ---
> 
> (Updated July 27, 2017, 2:49 p.m.)
> 
> 
> Review request for mesos, Jie Yu and Jan Schlicht.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> The agent's resource provider manager sends a
> 'ResourceProviderMessage' when its managed resources change. This
> commit adds handling in the agent so that an 'UpdateSlaveMessage' is
> sent to the master to update the total resource available on the
> agent. We also store this total in the agent memory so that it can be
> resent on agent resubscription.
> 
> In order to provide push-like handling of the resource provider
> manager's message queue, we chain recursive calls to the handler for
> continuous processing. Initially, processing is kicked off from
> 'Slave::initialize'. In this simple implementation we e.g., provide no
> direct way to stop processing of messages, yet, but it can be achieved
> by e.g., replacing the manager with a new instance (this would also
> require updating routes).
> 
> Since the agent can only send an 'UpdateSlaveMessage' when it is
> registered with a master, a simple back-off of 5 s is implemented which
> will defer processing of a ready message should the agent not yet have
> registered.
> 
> To facilitate logging we add a stringification function for
> 'ResourceProviderMessage's.
> 
> 
> Diffs
> -
> 
>   src/resource_provider/message.hpp 916926bf278de9ed919384a82a452d3ced06bd04 
>   src/slave/slave.hpp 1fe93dab1b2bef24721cc1bcffebe1b259e96d79 
>   src/slave/slave.cpp 7381530515f86faf4c3e8f82bcd9483f6cf0498b 
>   src/tests/slave_tests.cpp a089cc47eae41cd6baeffd3f4a7ee7c7984aacbd 
> 
> 
> Diff: https://reviews.apache.org/r/61183/diff/1/
> 
> 
> Testing
> ---
> 
> `make check`
> 
> 
> Thanks,
> 
> Benjamin Bannier
> 
>



Review Request 61181: Stored subscribed resources in resource provider manager.

2017-07-27 Thread Benjamin Bannier

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

Review request for mesos, Jie Yu and Jan Schlicht.


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


Repository: mesos


Description
---

In order to be able to always communicate the aggregated total
resources available on all subscribed resource providers, a resource
provider manager needs to keep track of the resources of all
subscribed resource providers. This commit adds a field for that the
manager's internal data structures for that purpose.

To make assigned 'ResourceProviderID's opaque to users of managers, the
manager assigns provider ids to all resources added.


Diffs
-

  src/resource_provider/manager.cpp 44e1576d4462295d404429d51682134306047462 


Diff: https://reviews.apache.org/r/61181/diff/1/


Testing
---

Tested as part of https://reviews.apache.org/r/61182/.


Thanks,

Benjamin Bannier



Review Request 61183: Triggered 'UpdateSlaveMessage' when 'ResourceProviderManager' updates.

2017-07-27 Thread Benjamin Bannier

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

Review request for mesos, Jie Yu and Jan Schlicht.


Repository: mesos


Description
---

The agent's resource provider manager sends a
'ResourceProviderMessage' when its managed resources change. This
commit adds handling in the agent so that an 'UpdateSlaveMessage' is
sent to the master to update the total resource available on the
agent. We also store this total in the agent memory so that it can be
resent on agent resubscription.

In order to provide push-like handling of the resource provider
manager's message queue, we chain recursive calls to the handler for
continuous processing. Initially, processing is kicked off from
'Slave::initialize'. In this simple implementation we e.g., provide no
direct way to stop processing of messages, yet, but it can be achieved
by e.g., replacing the manager with a new instance (this would also
require updating routes).

Since the agent can only send an 'UpdateSlaveMessage' when it is
registered with a master, a simple back-off of 5 s is implemented which
will defer processing of a ready message should the agent not yet have
registered.

To facilitate logging we add a stringification function for
'ResourceProviderMessage's.


Diffs
-

  src/resource_provider/message.hpp 916926bf278de9ed919384a82a452d3ced06bd04 
  src/slave/slave.hpp 1fe93dab1b2bef24721cc1bcffebe1b259e96d79 
  src/slave/slave.cpp 7381530515f86faf4c3e8f82bcd9483f6cf0498b 
  src/tests/slave_tests.cpp a089cc47eae41cd6baeffd3f4a7ee7c7984aacbd 


Diff: https://reviews.apache.org/r/61183/diff/1/


Testing
---

`make check`


Thanks,

Benjamin Bannier



Review Request 61180: Added a resource providers total resources to the subscribe call.

2017-07-27 Thread Benjamin Bannier

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

Review request for mesos, Jie Yu and Jan Schlicht.


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


Repository: mesos


Description
---

Since resource provider resources are dynamic (as opposed to how e.g.,
agent total resources are implemented), they are not part of the
'ResourceProviderInfo'. Instead they are communicated explicitly.

This commit adds total resources the resource provider 'SUBSCRIBE'
call which can be used to communicate the total capacity in both
subscription and resubscription scenarios.


Diffs
-

  include/mesos/resource_provider/resource_provider.proto 
a8a27ed09cde7a9f137e76900a3a1c1a547752ed 
  include/mesos/v1/resource_provider/resource_provider.proto 
34bce7511bc74e157277371a7f46111c9537bcf2 


Diff: https://reviews.apache.org/r/61180/diff/1/


Testing
---

Tested as part of https://reviews.apache.org/r/61182/.


Thanks,

Benjamin Bannier



Review Request 61179: Added 'devolve' overload for 'ResourceProviderID'.

2017-07-27 Thread Benjamin Bannier

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

Review request for mesos, Jie Yu and Jan Schlicht.


Repository: mesos


Description
---

This commit adds the default overload to 'devolve'
'ResourceProviderID's.


Diffs
-

  src/internal/devolve.hpp 656173de0a652431be3c3c3d3796e3f3f7fca278 
  src/internal/devolve.cpp 7eb58e94beb5262a63e2f9b9dfefbd3d288e32ec 


Diff: https://reviews.apache.org/r/61179/diff/1/


Testing
---

Tested as part of https://reviews.apache.org/r/61182/.


Thanks,

Benjamin Bannier



Re: Review Request 61174: Added a test `ProtobufTest.ParseJSONOptionalEnum`.

2017-07-27 Thread Mesos Reviewbot Windows

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



Patch looks great!

Reviews applied: [61109, 61174]

Passed command: support\windows-build.bat

- Mesos Reviewbot Windows


On July 27, 2017, 4:19 p.m., Qian Zhang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61174/
> ---
> 
> (Updated July 27, 2017, 4:19 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and James Peach.
> 
> 
> Bugs: MESOS-7828
> https://issues.apache.org/jira/browse/MESOS-7828
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added a test `ProtobufTest.ParseJSONOptionalEnum`.
> 
> 
> Diffs
> -
> 
>   3rdparty/stout/tests/protobuf_tests.cpp 
> 8877e8934e0f7875bfedcfa88b491ce4b13ca44f 
>   3rdparty/stout/tests/protobuf_tests.proto 
> d16726aa8060aea2b830040b20dbdd467c801483 
> 
> 
> Diff: https://reviews.apache.org/r/61174/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>



Re: Review Request 61172: Added mesos.http and mesos.exceptions for CLI.

2017-07-27 Thread Mesos Reviewbot Windows

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



Patch looks great!

Reviews applied: [61172]

Passed command: support\windows-build.bat

- Mesos Reviewbot Windows


On July 27, 2017, 3:09 p.m., Eric Chung wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61172/
> ---
> 
> (Updated July 27, 2017, 3:09 p.m.)
> 
> 
> Review request for mesos, Armand Grillet, Jason Lai, and Kevin Klues.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Added mesos.http and mesos.exceptions for CLI.
> 
> Part of MESOS-7310, This patch adds the mesos.http and mesos.exceptions 
> modules, which provides a `Resource` class and its descendants for 
> abstracting away common operations over http connectioins with JSON 
> serialization.
> 
> 
> Diffs
> -
> 
>   src/python/cli_new/bootstrap c84e549e59bc7a07b5b70c24c63bc0c16881e442 
>   src/python/cli_new/pylint.config 63fbb94fbf47cccd1053b4c1eafac18b88dbc818 
>   src/python/lib/mesos/exceptions.py PRE-CREATION 
>   src/python/lib/mesos/http.py PRE-CREATION 
>   src/python/lib/requirements.in e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 
>   src/python/lib/tests/conftest.py PRE-CREATION 
>   src/python/lib/tests/test_exceptions.py PRE-CREATION 
>   src/python/lib/tests/test_http.py PRE-CREATION 
>   src/python/lib/tox.ini 8ad030d2dbf1fb7a04f1eaadb587462b4ef3f054 
> 
> 
> Diff: https://reviews.apache.org/r/61172/diff/1/
> 
> 
> Testing
> ---
> 
> under src/python/lib, call `tox` for running unit tests. The test should pass 
> and test coverage should be at 100%.
> 
> 
> Thanks,
> 
> Eric Chung
> 
>



Re: Review Request 61109: Used the default value when parsing an optional enum field.

2017-07-27 Thread Qian Zhang


> On July 26, 2017, 12:01 a.m., James Peach wrote:
> > Could you construct a test for this by parsing a JSON object with a made-up 
> > enum value?

Sure, here it is: https://reviews.apache.org/r/61174/


- Qian


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


On July 25, 2017, 11:17 p.m., Qian Zhang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61109/
> ---
> 
> (Updated July 25, 2017, 11:17 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and James Peach.
> 
> 
> Bugs: MESOS-7828
> https://issues.apache.org/jira/browse/MESOS-7828
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Used the default value when parsing an optional enum field.
> 
> 
> Diffs
> -
> 
>   3rdparty/stout/include/stout/protobuf.hpp 
> 15690b66cc4ae0c1bf2c2176d73c385ca75d3c20 
> 
> 
> Diff: https://reviews.apache.org/r/61109/diff/1/
> 
> 
> Testing
> ---
> 
> With this patch, when accessing master endpoint with an inexistent enum `xxx` 
> in a JSON:
> ```
> curl -X POST -H "Content-Type: application/json" -d '{"type": "xxx"}' 
> 127.0.0.1:5050/api/v1
> ```
> The master log will be:
> ```
> I0725 23:09:53.097790   665 http.cpp:1133] HTTP POST for /master/api/v1 from 
> 127.0.0.1:49566 with User-Agent='curl/7.47.0'
> I0725 23:09:53.098006   665 http.cpp:669] Processing call UNKNOWN
> ```
> This proves when parsing an inexistent enum the default enum value (i.e., 
> `UNKNOWN`) will be used.
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>



Review Request 61174: Added a test `ProtobufTest.ParseJSONOptionalEnum`.

2017-07-27 Thread Qian Zhang

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

Review request for mesos, Benjamin Mahler and James Peach.


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


Repository: mesos


Description
---

Added a test `ProtobufTest.ParseJSONOptionalEnum`.


Diffs
-

  3rdparty/stout/tests/protobuf_tests.cpp 
8877e8934e0f7875bfedcfa88b491ce4b13ca44f 
  3rdparty/stout/tests/protobuf_tests.proto 
d16726aa8060aea2b830040b20dbdd467c801483 


Diff: https://reviews.apache.org/r/61174/diff/1/


Testing
---


Thanks,

Qian Zhang



Re: Review Request 61171: Enabled filtering of the 'GET_AGENTS' v1 API call.

2017-07-27 Thread Alexander Rojas

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

(Updated July 27, 2017, 9:48 a.m.)


Review request for mesos, Adam B, Greg Mann, Quinn Leng, and Till Toenshoff.


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


Repository: mesos


Description
---

Enables filtering of the results of calls to the 'GET_AGENTS' v1
API. It filters the contents of different resources entries based
on the 'VIEW_ROLE' permissions of the principal doing the request
based on resource roles, allocation roles and reservations.


Diffs (updated)
-

  src/common/protobuf_utils.hpp 2156f6d158bfee16d29aa3531bdd156af581df01 
  src/common/protobuf_utils.cpp 4e5ab02c90ad8490efbcc471f7fd7c48be0c4678 
  src/master/http.cpp 9df086c417a9392f62d600c7a6486be0a1cf7e70 
  src/master/master.hpp 84465af782d4024f22463d981ef9d0ef7827d043 


Diff: https://reviews.apache.org/r/61171/diff/2/

Changes: https://reviews.apache.org/r/61171/diff/1-2/


Testing
---

```shell
mkdir -p /tmp/mesos/master
mkdir -p /tmp/mesos/agent

# Create credentials
cat < /tmp/mesos/credentials.txt
hal-9000 dave
glados potato
skynet connor
EOF

# Create ACLs
cat < /tmp/mesos/acls.json
{
  "permissive": true,
  "view_roles" : [
   {
 "principals" : { "type" : "ANY" },
 "roles" : { "values" : ["*"] }
   },
   {
 "principals" : { "values" : ["hal-9000"] },
 "roles" : { "values" : ["space-odyssey"] }
   },
   {
 "principals" : { "values" : ["hal-9000"] },
 "roles" : { "type" : "NONE" }
   },
   {
 "principals" : { "values" : ["glados"] },
 "roles" : { "values" : ["portal"] }
   },
   {
 "principals" : { "values" : ["glados"] },
 "roles" : { "type" : "NONE" }
   },
   {
 "principals" : { "values" : ["skynet"] },
 "roles" : { "values" : ["terminator"] }
   },
   {
 "principals" : { "values" : ["skynet"] },
 "roles" : { "type" : "NONE" }
   }
  ]
}
EOF

# Launch Master with some predefined roles.
./bin/mesos-master.sh \
--work_dir=/tmp/mesos/master \
--log_dir=/tmp/mesos/master/log \
--authenticate_http \
--credentials=/tmp/mesos/credentials.txt \
--authenticate_http_frameworks \
--http_framework_authenticators=basic \
--http_authenticators=basic \
--authenticate_http_readonly \
--acls=/tmp/mesos/acls.json \
--roles="space-odyssey,portal,terminator" &

# Launch Agent with static reservations for all roles.
sudo ./bin/mesos-agent.sh \
--master=127.0.0.1:5050 \
--work_dir=/tmp/mesos/agent \
--authenticate_http_readwrite \
--http_authenticators=basic \
--http_credentials=/tmp/mesos/credentials.txt \
--acls=/tmp/mesos/acls.json \

--resources='cpus(space-odyssey):2;cpus(portal):2;cpus(*):4;mem(space-odyssey):250;mem(portal):250;mem(*):10360;ports(space-odyssey):[31000-32000];ports(portal):[32001-33000];ports(*):[33001-35000];disk(space-odyssey):250;disk(portal):250;disk(*):1000'
 &

# Launch test framework.
./src/mesos-execute \
--master=127.0.0.1:5050 \
--command='while true; do echo "Hello World"; sleep 5; done;' \
--resources="cpus:1;mem:128;disk:32;ports:[31002-31003]" \
--role=space-odyssey \
--name=hello-discovery \
--principal=hal-9000 \
--secret=dave &

# Create a dynamic reservation.
cat > /tmp/resources.json < /tmp/quota.json <

Re: Review Request 61171: Enabled filtering of the 'GET_AGENTS' v1 API call.

2017-07-27 Thread Mesos Reviewbot Windows

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



Patch looks great!

Reviews applied: [61171]

Passed command: support\windows-build.bat

- Mesos Reviewbot Windows


On July 27, 2017, 12:06 a.m., Alexander Rojas wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61171/
> ---
> 
> (Updated July 27, 2017, 12:06 a.m.)
> 
> 
> Review request for mesos, Adam B, Greg Mann, Quinn Leng, and Till Toenshoff.
> 
> 
> Bugs: MESOS-7416
> https://issues.apache.org/jira/browse/MESOS-7416
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Enables filtering of the results of calls to the 'GET_AGENTS' v1
> API. It filters the contents of different resources entries based
> on the 'VIEW_ROLE' permissions of the principal doing the request
> based on resource roles, allocation roles and reservations.
> 
> 
> Diffs
> -
> 
>   src/common/protobuf_utils.hpp 2156f6d158bfee16d29aa3531bdd156af581df01 
>   src/common/protobuf_utils.cpp 4e5ab02c90ad8490efbcc471f7fd7c48be0c4678 
>   src/master/http.cpp 9df086c417a9392f62d600c7a6486be0a1cf7e70 
>   src/master/master.hpp 84465af782d4024f22463d981ef9d0ef7827d043 
> 
> 
> Diff: https://reviews.apache.org/r/61171/diff/1/
> 
> 
> Testing
> ---
> 
> ```shell
> mkdir -p /tmp/mesos/master
> mkdir -p /tmp/mesos/agent
> 
> # Create credentials
> cat < /tmp/mesos/credentials.txt
> hal-9000 dave
> glados potato
> skynet connor
> EOF
> 
> # Create ACLs
> cat < /tmp/mesos/acls.json
> {
>   "permissive": true,
>   "view_roles" : [
>{
>  "principals" : { "type" : "ANY" },
>  "roles" : { "values" : ["*"] }
>},
>{
>  "principals" : { "values" : ["hal-9000"] },
>  "roles" : { "values" : ["space-odyssey"] }
>},
>{
>  "principals" : { "values" : ["hal-9000"] },
>  "roles" : { "type" : "NONE" }
>},
>{
>  "principals" : { "values" : ["glados"] },
>  "roles" : { "values" : ["portal"] }
>},
>{
>  "principals" : { "values" : ["glados"] },
>  "roles" : { "type" : "NONE" }
>},
>{
>  "principals" : { "values" : ["skynet"] },
>  "roles" : { "values" : ["terminator"] }
>},
>{
>  "principals" : { "values" : ["skynet"] },
>  "roles" : { "type" : "NONE" }
>}
>   ]
> }
> EOF
> 
> # Launch Master with some predefined roles.
> ./bin/mesos-master.sh \
> --work_dir=/tmp/mesos/master \
> --log_dir=/tmp/mesos/master/log \
> --authenticate_http \
> --credentials=/tmp/mesos/credentials.txt \
> --authenticate_http_frameworks \
> --http_framework_authenticators=basic \
> --http_authenticators=basic \
> --authenticate_http_readonly \
> --acls=/tmp/mesos/acls.json \
> --roles="space-odyssey,portal,terminator" &
> 
> # Launch Agent with static reservations for all roles.
> sudo ./bin/mesos-agent.sh \
> --master=127.0.0.1:5050 \
> --work_dir=/tmp/mesos/agent \
> --authenticate_http_readwrite \
> --http_authenticators=basic \
> --http_credentials=/tmp/mesos/credentials.txt \
> --acls=/tmp/mesos/acls.json \
> 
> --resources='cpus(space-odyssey):2;cpus(portal):2;cpus(*):4;mem(space-odyssey):250;mem(portal):250;mem(*):10360;ports(space-odyssey):[31000-32000];ports(portal):[32001-33000];ports(*):[33001-35000];disk(space-odyssey):250;disk(portal):250;disk(*):1000'
>  &
> 
> # Launch test framework.
> ./src/mesos-execute \
> --master=127.0.0.1:5050 \
> --command='while true; do echo "Hello World"; sleep 5; done;' \
> --resources="cpus:1;mem:128;disk:32;ports:[31002-31003]" \
> --role=space-odyssey \
> --name=hello-discovery \
> --principal=hal-9000 \
> --secret=dave &
> 
> # Create a dynamic reservation.
> cat > /tmp/resources.json < [
>   {
> "name": "cpus",
> "type": "SCALAR",
> "scalar": { "value": 2 },
> "role": "terminator",
> "reservation": {
>   "principal": "skynet"
> }
>   },
>   {
> "name": "mem",
> "type": "SCALAR",
> "scalar": { "value": 250 },
> "role": "terminator",
> "reservation": {
>   "principal": "skynet"
> }
>   },
>   {
> "name": "disk",
> "type": "SCALAR",
> "scalar": { "value": 250 },
> "role": "terminator",
> "reservation": {
>   "principal": "skynet"
> }
>   },
>   {
> "name": "ports",
> "type": "RANGES",
> "ranges": {
>   "range": [
> { 
>   "begin": 33001,
>   "end": 34000
> }
>   ]
> },
> "role": "terminator",
> "reservation": {
>   "principal": "skynet"
> }
>   }
> ]
> EOM
> 
> http \
> -a skynet:connor \
> -f POST \
> 127.0.0.1:5050/master/reserve \
> 

Re: Review Request 61172: Added mesos.http and mesos.exceptions for CLI.

2017-07-27 Thread Eric Chung

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

(Updated July 27, 2017, 7:09 a.m.)


Review request for mesos, Armand Grillet, Jason Lai, and Kevin Klues.


Repository: mesos


Description (updated)
---

Added mesos.http and mesos.exceptions for CLI.

Part of MESOS-7310, This patch adds the mesos.http and mesos.exceptions 
modules, which provides a `Resource` class and its descendants for abstracting 
away common operations over http connectioins with JSON serialization.


Diffs
-

  src/python/cli_new/bootstrap c84e549e59bc7a07b5b70c24c63bc0c16881e442 
  src/python/cli_new/pylint.config 63fbb94fbf47cccd1053b4c1eafac18b88dbc818 
  src/python/lib/mesos/exceptions.py PRE-CREATION 
  src/python/lib/mesos/http.py PRE-CREATION 
  src/python/lib/requirements.in e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 
  src/python/lib/tests/conftest.py PRE-CREATION 
  src/python/lib/tests/test_exceptions.py PRE-CREATION 
  src/python/lib/tests/test_http.py PRE-CREATION 
  src/python/lib/tox.ini 8ad030d2dbf1fb7a04f1eaadb587462b4ef3f054 


Diff: https://reviews.apache.org/r/61172/diff/1/


Testing
---

under src/python/lib, call `tox` for running unit tests. The test should pass 
and test coverage should be at 100%.


Thanks,

Eric Chung



Review Request 61171: Enabled filtering of the 'GET_AGENTS' v1 API call.

2017-07-27 Thread Alexander Rojas

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

Review request for mesos, Adam B, Greg Mann, Quinn Leng, and Till Toenshoff.


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


Repository: mesos


Description
---

Enables filtering of the results of calls to the 'GET_AGENTS' v1
API. It filters the contents of different resources entries based
on the 'VIEW_ROLE' permissions of the principal doing the request
based on resource roles, allocation roles and reservations.


Diffs
-

  src/common/protobuf_utils.hpp 2156f6d158bfee16d29aa3531bdd156af581df01 
  src/common/protobuf_utils.cpp 4e5ab02c90ad8490efbcc471f7fd7c48be0c4678 
  src/master/http.cpp 9df086c417a9392f62d600c7a6486be0a1cf7e70 
  src/master/master.hpp 84465af782d4024f22463d981ef9d0ef7827d043 


Diff: https://reviews.apache.org/r/61171/diff/1/


Testing
---

```shell
mkdir -p /tmp/mesos/master
mkdir -p /tmp/mesos/agent

# Create credentials
cat < /tmp/mesos/credentials.txt
hal-9000 dave
glados potato
skynet connor
EOF

# Create ACLs
cat < /tmp/mesos/acls.json
{
  "permissive": true,
  "view_roles" : [
   {
 "principals" : { "type" : "ANY" },
 "roles" : { "values" : ["*"] }
   },
   {
 "principals" : { "values" : ["hal-9000"] },
 "roles" : { "values" : ["space-odyssey"] }
   },
   {
 "principals" : { "values" : ["hal-9000"] },
 "roles" : { "type" : "NONE" }
   },
   {
 "principals" : { "values" : ["glados"] },
 "roles" : { "values" : ["portal"] }
   },
   {
 "principals" : { "values" : ["glados"] },
 "roles" : { "type" : "NONE" }
   },
   {
 "principals" : { "values" : ["skynet"] },
 "roles" : { "values" : ["terminator"] }
   },
   {
 "principals" : { "values" : ["skynet"] },
 "roles" : { "type" : "NONE" }
   }
  ]
}
EOF

# Launch Master with some predefined roles.
./bin/mesos-master.sh \
--work_dir=/tmp/mesos/master \
--log_dir=/tmp/mesos/master/log \
--authenticate_http \
--credentials=/tmp/mesos/credentials.txt \
--authenticate_http_frameworks \
--http_framework_authenticators=basic \
--http_authenticators=basic \
--authenticate_http_readonly \
--acls=/tmp/mesos/acls.json \
--roles="space-odyssey,portal,terminator" &

# Launch Agent with static reservations for all roles.
sudo ./bin/mesos-agent.sh \
--master=127.0.0.1:5050 \
--work_dir=/tmp/mesos/agent \
--authenticate_http_readwrite \
--http_authenticators=basic \
--http_credentials=/tmp/mesos/credentials.txt \
--acls=/tmp/mesos/acls.json \

--resources='cpus(space-odyssey):2;cpus(portal):2;cpus(*):4;mem(space-odyssey):250;mem(portal):250;mem(*):10360;ports(space-odyssey):[31000-32000];ports(portal):[32001-33000];ports(*):[33001-35000];disk(space-odyssey):250;disk(portal):250;disk(*):1000'
 &

# Launch test framework.
./src/mesos-execute \
--master=127.0.0.1:5050 \
--command='while true; do echo "Hello World"; sleep 5; done;' \
--resources="cpus:1;mem:128;disk:32;ports:[31002-31003]" \
--role=space-odyssey \
--name=hello-discovery \
--principal=hal-9000 \
--secret=dave &

# Create a dynamic reservation.
cat > /tmp/resources.json < /tmp/quota.json <

Review Request 61172: Added mesos.http and mesos.exceptions for CLI.

2017-07-27 Thread Eric Chung

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

Review request for mesos.


Repository: mesos


Description
---

Added mesos.http and mesos.exceptions for CLI.

This patch adds the mesos.http and mesos.exceptions modules, which provides a 
`Resource` class and its descendants for abstracting away common operations 
over http connectioins with JSON serialization.


Diffs
-

  src/python/cli_new/bootstrap c84e549e59bc7a07b5b70c24c63bc0c16881e442 
  src/python/cli_new/pylint.config 63fbb94fbf47cccd1053b4c1eafac18b88dbc818 
  src/python/lib/mesos/exceptions.py PRE-CREATION 
  src/python/lib/mesos/http.py PRE-CREATION 
  src/python/lib/requirements.in e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 
  src/python/lib/tests/conftest.py PRE-CREATION 
  src/python/lib/tests/test_exceptions.py PRE-CREATION 
  src/python/lib/tests/test_http.py PRE-CREATION 
  src/python/lib/tox.ini 8ad030d2dbf1fb7a04f1eaadb587462b4ef3f054 


Diff: https://reviews.apache.org/r/61172/diff/1/


Testing
---

under src/python/lib, call `tox` for running unit tests. The test should pass 
and test coverage should be at 100%.


Thanks,

Eric Chung