Repository: mesos Updated Branches: refs/heads/1.0.x d3e6a857e -> c2e6cc649
Updated 'NvidiaVolume' to not error out when binary is missing. Previously, when building the volume, we would error out if a binary we were trying to add was not found on the host filesystem. However, these are not the semantics that we want. By design, we list all the binaries the *may* exist on the filesystem that we want to put in the volume, not all of the binaries that *must* exist. To this end, we should simply skip any unfound binaries and move on to the next one instead of erroring out. Review: https://reviews.apache.org/r/50762/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e9a97c39 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e9a97c39 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e9a97c39 Branch: refs/heads/1.0.x Commit: e9a97c393aaccdd479e804105b533290a08f0a65 Parents: d3e6a85 Author: Kevin Klues <klue...@gmail.com> Authored: Wed Aug 3 15:05:15 2016 -0700 Committer: Benjamin Mahler <bmah...@apache.org> Committed: Wed Aug 3 15:48:27 2016 -0700 ---------------------------------------------------------------------- .../mesos/isolators/gpu/volume.cpp | 29 ++++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/e9a97c39/src/slave/containerizer/mesos/isolators/gpu/volume.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/isolators/gpu/volume.cpp b/src/slave/containerizer/mesos/isolators/gpu/volume.cpp index 478e106..478752f 100644 --- a/src/slave/containerizer/mesos/isolators/gpu/volume.cpp +++ b/src/slave/containerizer/mesos/isolators/gpu/volume.cpp @@ -283,24 +283,23 @@ Try<NvidiaVolume> NvidiaVolume::create() if (!os::exists(path)) { string command = "which " + binary; Try<string> which = os::shell(command); - if (which.isError()) { - return Error("Failed to os::shell '" + command + "': " + which.error()); - } - which = strings::trim(which.get()); + if (which.isSome()) { + which = strings::trim(which.get()); - Result<string> realpath = os::realpath(which.get()); - if (!realpath.isSome()) { - return Error("Failed to os::realpath '" + which.get() + "':" - " " + (realpath.isError() - ? realpath.error() - : "No such file or directory")); - } + Result<string> realpath = os::realpath(which.get()); + if (!realpath.isSome()) { + return Error("Failed to os::realpath '" + which.get() + "':" + " " + (realpath.isError() + ? realpath.error() + : "No such file or directory")); + } - command = "cp " + realpath.get() + " " + path; - Try<string> cp = os::shell(command); - if (cp.isError()) { - return Error("Failed to os::shell '" + command + "': " + cp.error()); + command = "cp " + realpath.get() + " " + path; + Try<string> cp = os::shell(command); + if (cp.isError()) { + return Error("Failed to os::shell '" + command + "': " + cp.error()); + } } } }