You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/02/05 01:43:52 UTC

[1/2] mesos git commit: Removed unnecessary mkdirs in ProvisionerDockerLocalStoreTest.

Repository: mesos
Updated Branches:
  refs/heads/master 165b5c6b8 -> 6043624ab


Removed unnecessary mkdirs in ProvisionerDockerLocalStoreTest.

`LocalStoreTestWithTar` and `PullingSameImageSimutanuously` started
with creating directories that were already created by `SetUp()` and
directories that are not used.

Review: https://reviews.apache.org/r/56291/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/aefae584
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/aefae584
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/aefae584

Branch: refs/heads/master
Commit: aefae58499ac49a1e75c02a7365ef8cbdf296d4e
Parents: 165b5c6
Author: Ilya Pronin <ip...@twopensource.com>
Authored: Sat Feb 4 15:55:29 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Sat Feb 4 15:55:42 2017 -0800

----------------------------------------------------------------------
 src/tests/containerizer/provisioner_docker_tests.cpp | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/aefae584/src/tests/containerizer/provisioner_docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp b/src/tests/containerizer/provisioner_docker_tests.cpp
index af9987f..38f20d4 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -182,13 +182,8 @@ protected:
 // stored in the proper locations accessible to the Docker provisioner.
 TEST_F(ProvisionerDockerLocalStoreTest, LocalStoreTestWithTar)
 {
-  const string archivesDir = path::join(os::getcwd(), "images");
-  const string image = path::join(archivesDir, "abc");
-  ASSERT_SOME(os::mkdir(archivesDir));
-  ASSERT_SOME(os::mkdir(image));
-
   slave::Flags flags;
-  flags.docker_registry = archivesDir;
+  flags.docker_registry = path::join(os::getcwd(), "images");
   flags.docker_store_dir = path::join(os::getcwd(), "store");
   flags.image_provisioner_backend = COPY_BACKEND;
 
@@ -275,13 +270,8 @@ public:
 // when multiple requests for the same image is in flight.
 TEST_F(ProvisionerDockerLocalStoreTest, PullingSameImageSimutanuously)
 {
-  const string archivesDir = path::join(os::getcwd(), "images");
-  const string image = path::join(archivesDir, "abc:latest");
-  ASSERT_SOME(os::mkdir(archivesDir));
-  ASSERT_SOME(os::mkdir(image));
-
   slave::Flags flags;
-  flags.docker_registry = "file://" + archivesDir;
+  flags.docker_registry = path::join(os::getcwd(), "images");
   flags.docker_store_dir = path::join(os::getcwd(), "store");
 
   MockPuller* puller = new MockPuller();


[2/2] mesos git commit: Added skipping already stored layers to local Docker puller.

Posted by ji...@apache.org.
Added skipping already stored layers to local Docker puller.

If a layer is already in the store, there's no need to extract it.
`RegistryPuller` already does this and `Store` is ready for such
puller behaviour.

Review: https://reviews.apache.org/r/56174/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6043624a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6043624a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6043624a

Branch: refs/heads/master
Commit: 6043624aba9b3315eccf2ab19ddaf3a30ac9952c
Parents: aefae58
Author: Ilya Pronin <ip...@twopensource.com>
Authored: Sat Feb 4 17:14:18 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Sat Feb 4 17:31:55 2017 -0800

----------------------------------------------------------------------
 .../mesos/provisioner/docker/local_puller.cpp        | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6043624a/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp b/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp
index ee391af..5bc68d2 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp
@@ -51,8 +51,9 @@ namespace docker {
 class LocalPullerProcess : public Process<LocalPullerProcess>
 {
 public:
-  LocalPullerProcess(const string& _archivesDir)
+  LocalPullerProcess(const string& _storeDir, const string& _archivesDir)
     : ProcessBase(process::ID::generate("docker-provisioner-local-puller")),
+      storeDir(_storeDir),
       archivesDir(_archivesDir) {}
 
   ~LocalPullerProcess() {}
@@ -82,6 +83,7 @@ private:
       const string& layerId,
       const string& backend);
 
+  const string storeDir;
   const string archivesDir;
 };
 
@@ -97,7 +99,7 @@ Try<Owned<Puller>> LocalPuller::create(const Flags& flags)
           << flags.docker_registry << "'";
 
   Owned<LocalPullerProcess> process(
-      new LocalPullerProcess(flags.docker_registry));
+      new LocalPullerProcess(flags.docker_store_dir, flags.docker_registry));
 
   return Owned<Puller>(new LocalPuller(process));
 }
@@ -282,6 +284,15 @@ Future<Nothing> LocalPullerProcess::extractLayers(
 {
   list<Future<Nothing>> futures;
   foreach (const string& layerId, layerIds) {
+    // Check if the layer is already in the store. If yes, skip the
+    // unnecessary extracting.
+    if (os::exists(paths::getImageLayerRootfsPath(
+            storeDir,
+            layerId,
+            backend))) {
+      continue;
+    }
+
     futures.push_back(extractLayer(directory, layerId, backend));
   }