You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/07/04 00:20:16 UTC
[2/2] mesos git commit: Added container path to Docker::Device.
Added container path to Docker::Device.
Review: https://reviews.apache.org/r/49579
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/380f5079
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/380f5079
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/380f5079
Branch: refs/heads/master
Commit: 380f507926eff3dc48ad90e23e072207f1ed60ac
Parents: f888a1c
Author: Benjamin Mahler <bm...@apache.org>
Authored: Sun Jul 3 16:21:59 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Sun Jul 3 17:19:36 2016 -0700
----------------------------------------------------------------------
src/docker/docker.cpp | 12 ++++++++----
src/docker/docker.hpp | 3 ++-
src/tests/containerizer/docker_tests.cpp | 3 ++-
3 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/380f5079/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index c6ed312..939f69d 100755
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -664,8 +664,8 @@ Future<Option<int>> Docker::run(
if (devices.isSome()) {
foreach (const Device& device, devices.get()) {
- if (!device.path.absolute()) {
- return Failure("Device path '" + device.path.string() + "'"
+ if (!device.hostPath.absolute()) {
+ return Failure("Device path '" + device.hostPath.string() + "'"
" is not an absolute path");
}
@@ -678,14 +678,18 @@ Future<Option<int>> Docker::run(
// that an absolute path is not being provided).
if (permissions.empty()) {
return Failure("At least one access required for --devices:"
- " none specified for '" + device.path.string() + "'");
+ " none specified for"
+ " '" + device.hostPath.string() + "'");
}
// Note that docker silently does not handle default devices
// passed in with restricted permissions (e.g. /dev/null), so
// we don't bother checking this case either.
- argv.push_back("--device=" + device.path.string() + ":" + permissions);
+ argv.push_back("--device=" +
+ device.hostPath.string() + ":" +
+ device.containerPath.string() + ":" +
+ permissions);
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/380f5079/src/docker/docker.hpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.hpp b/src/docker/docker.hpp
index 41443c8..64333b8 100644
--- a/src/docker/docker.hpp
+++ b/src/docker/docker.hpp
@@ -55,7 +55,8 @@ public:
struct Device
{
- Path path;
+ Path hostPath;
+ Path containerPath;
struct Access
{
http://git-wip-us.apache.org/repos/asf/mesos/blob/380f5079/src/tests/containerizer/docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/docker_tests.cpp b/src/tests/containerizer/docker_tests.cpp
index 49bd7c2..c586fd2 100644
--- a/src/tests/containerizer/docker_tests.cpp
+++ b/src/tests/containerizer/docker_tests.cpp
@@ -688,7 +688,8 @@ TEST_F(DockerTest, ROOT_DOCKER_NVIDIA_GPU_DeviceAllow)
commandInfo.set_value("touch /dev/nvidiactl && touch /dev/null");
Docker::Device nvidiaCtl;
- nvidiaCtl.path = Path("/dev/nvidiactl");
+ nvidiaCtl.hostPath = Path("/dev/nvidiactl");
+ nvidiaCtl.containerPath = Path("/dev/nvidiactl");
nvidiaCtl.access.read = true;
nvidiaCtl.access.write = true;
nvidiaCtl.access.mknod = true;