Added `getContainerIOSwitchboardAddress` helper to containerizer paths. Review: https://reviews.apache.org/r/54238
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1420cfaf Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1420cfaf Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1420cfaf Branch: refs/heads/master Commit: 1420cfaf95e57f3938c44c6748cd2a6879f0c1ed Parents: a13b70a Author: Kevin Klues <klue...@gmail.com> Authored: Wed Nov 30 17:40:32 2016 -0800 Committer: Jie Yu <yujie....@gmail.com> Committed: Thu Dec 1 10:11:45 2016 -0800 ---------------------------------------------------------------------- src/slave/containerizer/mesos/paths.cpp | 13 +++++++++++-- src/slave/containerizer/mesos/paths.hpp | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/1420cfaf/src/slave/containerizer/mesos/paths.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/paths.cpp b/src/slave/containerizer/mesos/paths.cpp index 422fb80..e090392 100644 --- a/src/slave/containerizer/mesos/paths.cpp +++ b/src/slave/containerizer/mesos/paths.cpp @@ -139,13 +139,22 @@ Result<int> getContainerStatus( #ifndef __WINDOWS__ -Result<unix::Address> getContainerIOSwitchboardAddress( +string getContainerIOSwitchboardSocketPath( const string& runtimeDir, const ContainerID& containerId) { - const string path = path::join( + return path::join( getRuntimePath(runtimeDir, containerId), IO_SWITCHBOARD_SOCKET_FILE); +} + + +Result<unix::Address> getContainerIOSwitchboardAddress( + const string& runtimeDir, + const ContainerID& containerId) +{ + const string path = getContainerIOSwitchboardSocketPath( + runtimeDir, containerId); if (!os::exists(path)) { // This is possible because we don't atomically create the http://git-wip-us.apache.org/repos/asf/mesos/blob/1420cfaf/src/slave/containerizer/mesos/paths.hpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/paths.hpp b/src/slave/containerizer/mesos/paths.hpp index 44df6c0..c0fe2a4 100644 --- a/src/slave/containerizer/mesos/paths.hpp +++ b/src/slave/containerizer/mesos/paths.hpp @@ -97,6 +97,12 @@ Result<int> getContainerStatus( #ifndef __WINDOWS__ +// The helper method to get the socket file path. +std::string getContainerIOSwitchboardSocketPath( + const std::string& runtimeDir, + const ContainerID& containerId); + + // The helper method to read the io switchboard socket file. Result<process::network::unix::Address> getContainerIOSwitchboardAddress( const std::string& runtimeDir,