Created staging dir only when needed. Created staging dir only when needed.
Review: https://reviews.apache.org/r/61546/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c6d21afc Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c6d21afc Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c6d21afc Branch: refs/heads/1.2.x Commit: c6d21afcf83277cd43fdeb88a87c29ec4c81964a Parents: 67598ba Author: Qian Zhang <zhq527...@gmail.com> Authored: Fri Aug 11 15:53:55 2017 -0700 Committer: Gilbert Song <songzihao1...@gmail.com> Committed: Fri Aug 11 16:27:32 2017 -0700 ---------------------------------------------------------------------- .../mesos/provisioner/docker/store.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/c6d21afc/src/slave/containerizer/mesos/provisioner/docker/store.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/provisioner/docker/store.cpp b/src/slave/containerizer/mesos/provisioner/docker/store.cpp index 68ce265..74e17ad 100644 --- a/src/slave/containerizer/mesos/provisioner/docker/store.cpp +++ b/src/slave/containerizer/mesos/provisioner/docker/store.cpp @@ -249,18 +249,19 @@ Future<Image> StoreProcess::_get( } } - Try<string> staging = - os::mkdtemp(paths::getStagingTempDir(flags.docker_store_dir)); - - if (staging.isError()) { - return Failure("Failed to create a staging directory: " + staging.error()); - } - - // If there is already an pulling going on for the given 'name', we + // If there is already a pulling going on for the given 'name', we // will skip the additional pulling. const string name = stringify(reference); if (!pulling.contains(name)) { + Try<string> staging = + os::mkdtemp(paths::getStagingTempDir(flags.docker_store_dir)); + + if (staging.isError()) { + return Failure( + "Failed to create a staging directory: " + staging.error()); + } + Owned<Promise<Image>> promise(new Promise<Image>()); Future<Image> future = puller->pull(reference, staging.get(), backend)