Repository: mesos Updated Branches: refs/heads/master 758bed323 -> b65d3f75e
Fixed the sanity check on OSX for persistent volumes. Review: https://reviews.apache.org/r/36742 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b65d3f75 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b65d3f75 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b65d3f75 Branch: refs/heads/master Commit: b65d3f75edd9d3fdf368543fead0969ae4b2d3ca Parents: 758bed3 Author: Jie Yu <[email protected]> Authored: Thu Jul 23 12:37:00 2015 -0700 Committer: Jie Yu <[email protected]> Committed: Thu Jul 23 22:24:39 2015 -0700 ---------------------------------------------------------------------- .../containerizer/isolators/filesystem/posix.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/b65d3f75/src/slave/containerizer/isolators/filesystem/posix.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/isolators/filesystem/posix.cpp b/src/slave/containerizer/isolators/filesystem/posix.cpp index 72d2738..2aa8406 100644 --- a/src/slave/containerizer/isolators/filesystem/posix.cpp +++ b/src/slave/containerizer/isolators/filesystem/posix.cpp @@ -230,11 +230,22 @@ Future<Nothing> PosixFilesystemIsolatorProcess::update( (realpath.isError() ? realpath.error() : "No such directory")); } - // NOTE: A sanity check which we don't expect to happen. - if (realpath.get() != original) { + // A sanity check to make sure the target of the symlink does + // not change. In fact, this is not supposed to happen. + // NOTE: Here, we compare the realpaths because 'original' might + // contain symbolic links. + Result<string> _original = os::realpath(original); + if (!_original.isSome()) { return Failure( - "The existing symlink '" + link + "' points to '" + original + - "' and the new target is '" + realpath.get() + "'"); + "Failed to get the realpath of volume '" + original + "': " + + (_original.isError() ? _original.error() : "No such directory")); + } + + if (realpath.get() != _original.get()) { + return Failure( + "The existing symlink '" + link + "' points to '" + + _original.get() + "' and the new target is '" + + realpath.get() + "'"); } } else { LOG(INFO) << "Adding symlink from '" << original << "' to '"
