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/08/03 22:06:14 UTC

mesos git commit: Updated 'NvidiaVolume' to not error out when binary is missing.

Repository: mesos
Updated Branches:
  refs/heads/master 6f2a452d4 -> e31985119


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/e3198511
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e3198511
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e3198511

Branch: refs/heads/master
Commit: e31985119bdf69d496c0a2ed77ee0d7ddec2602b
Parents: 6f2a452
Author: Kevin Klues <kl...@gmail.com>
Authored: Wed Aug 3 15:05:15 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Wed Aug 3 15:05:15 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/e3198511/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());
+        }
       }
     }
   }