You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by tn...@apache.org on 2015/09/25 18:33:02 UTC

[10/17] mesos git commit: Restructure Docker provisioner and protos.

http://git-wip-us.apache.org/repos/asf/mesos/blob/4dedbf4a/src/slave/containerizer/provisioners/docker/metadata_manager.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/provisioners/docker/metadata_manager.cpp b/src/slave/containerizer/provisioners/docker/metadata_manager.cpp
deleted file mode 100644
index 55eb382..0000000
--- a/src/slave/containerizer/provisioners/docker/metadata_manager.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <vector>
-
-#include <glog/logging.h>
-
-#include <stout/foreach.hpp>
-#include <stout/hashset.hpp>
-#include <stout/os.hpp>
-#include <stout/protobuf.hpp>
-
-#include <process/defer.hpp>
-#include <process/dispatch.hpp>
-#include <process/owned.hpp>
-
-#include "common/status_utils.hpp"
-
-#include "messages/docker_provisioner.hpp"
-
-#include "slave/containerizer/provisioners/docker/paths.hpp"
-#include "slave/containerizer/provisioners/docker/metadata_manager.hpp"
-#include "slave/state.hpp"
-
-using namespace process;
-
-using std::list;
-using std::string;
-using std::vector;
-
-namespace mesos {
-namespace internal {
-namespace slave {
-namespace docker {
-
-
-class MetadataManagerProcess : public process::Process<MetadataManagerProcess>
-{
-public:
-  ~MetadataManagerProcess() {}
-
-  static Try<process::Owned<MetadataManagerProcess>> create(
-      const Flags& flags);
-
-  Future<DockerImage> put(
-      const ImageName& name,
-      const std::list<std::string>& layerIds);
-
-  Future<Option<DockerImage>> get(const ImageName& name);
-
-  Future<Nothing> recover();
-
-  // TODO(chenlily): Implement removal of unreferenced images.
-
-private:
-  MetadataManagerProcess(const Flags& flags);
-
-  // Write out metadata manager state to persistent store.
-  Try<Nothing> persist();
-
-  const Flags flags;
-
-  // This is a lookup table for images that are stored in memory. It is keyed
-  // by the name of the DockerImage.
-  // For example, "ubuntu:14.04" -> ubuntu14:04 DockerImage.
-  hashmap<std::string, DockerImage> storedImages;
-};
-
-
-Try<Owned<MetadataManager>> MetadataManager::create(const Flags& flags)
-{
-  Try<Owned<MetadataManagerProcess>> process =
-    MetadataManagerProcess::create(flags);
-  if (process.isError()) {
-    return Error("Failed to create Metadata Manager: " + process.error());
-  }
-  return Owned<MetadataManager>(new MetadataManager(process.get()));
-}
-
-
-MetadataManager::MetadataManager(Owned<MetadataManagerProcess> process)
-  : process(process)
-{
-  process::spawn(CHECK_NOTNULL(process.get()));
-}
-
-
-MetadataManager::~MetadataManager()
-{
-  process::terminate(process.get());
-  process::wait(process.get());
-}
-
-
-Future<Nothing> MetadataManager::recover()
-{
-  return process::dispatch(process.get(), &MetadataManagerProcess::recover);
-}
-
-
-Future<DockerImage> MetadataManager::put(
-    const ImageName& name,
-    const list<string>& layerIds)
-{
-  return dispatch(
-      process.get(), &MetadataManagerProcess::put, name, layerIds);
-}
-
-
-Future<Option<DockerImage>> MetadataManager::get(const ImageName& name)
-{
-  return dispatch(process.get(), &MetadataManagerProcess::get, name);
-}
-
-
-MetadataManagerProcess::MetadataManagerProcess(const Flags& flags)
-  : flags(flags) {}
-
-
-Try<Owned<MetadataManagerProcess>> MetadataManagerProcess::create(
-    const Flags& flags)
-{
-  Owned<MetadataManagerProcess> metadataManager =
-    Owned<MetadataManagerProcess>(new MetadataManagerProcess(flags));
-
-  return metadataManager;
-}
-
-
-Future<DockerImage> MetadataManagerProcess::put(
-    const ImageName& name,
-    const list<string>& layerIds)
-{
-  storedImages[name.name()] = DockerImage(name, layerIds);
-
-  Try<Nothing> status = persist();
-  if (status.isError()) {
-    return Failure("Failed to save state of Docker images" + status.error());
-  }
-
-  return storedImages[name.name()];
-}
-
-
-Future<Option<DockerImage>> MetadataManagerProcess::get(const ImageName& name)
-{
-  if (!storedImages.contains(name.name())) {
-    return None();
-  }
-
-  return storedImages[name.name()];
-}
-
-
-Try<Nothing> MetadataManagerProcess::persist()
-{
-  DockerProvisionerImages images;
-
-  foreachpair(
-      const string& name, const DockerImage& dockerImage, storedImages) {
-    DockerProvisionerImages::Image* image = images.add_images();
-
-    image->set_name(name);
-
-    foreach (const string& layerId, dockerImage.layerIds) {
-      image->add_layer_ids(layerId);
-    }
-  }
-
-  Try<Nothing> status = mesos::internal::slave::state::checkpoint(
-      paths::getStoredImagesPath(flags.docker_store_dir), images);
-  if (status.isError()) {
-    return Error("Failed to perform checkpoint: " + status.error());
-  }
-
-  return Nothing();
-}
-
-
-Future<Nothing> MetadataManagerProcess::recover()
-{
-  string storedImagesPath = paths::getStoredImagesPath(flags.docker_store_dir);
-
-  storedImages.clear();
-  if (!os::exists(storedImagesPath)) {
-    LOG(INFO) << "No images to load from disk. Docker provisioner image "
-              << "storage path: " << storedImagesPath << " does not exist.";
-    return Nothing();
-  }
-
-  Result<DockerProvisionerImages> images =
-    ::protobuf::read<DockerProvisionerImages>(storedImagesPath);
-  if (images.isError()) {
-    return Failure("Failed to read protobuf for Docker provisioner image: " +
-                   images.error());
-  }
-
-  for (int i = 0; i < images.get().images_size(); i++) {
-    string name = images.get().images(i).name();
-
-    list<string> layerIds;
-    vector<string> missingLayerIds;
-    for (int j = 0; j < images.get().images(i).layer_ids_size(); j++) {
-      string layerId = images.get().images(i).layer_ids(j);
-
-      layerIds.push_back(layerId);
-
-      if (!os::exists(
-              paths::getImageLayerRootfsPath(flags.docker_store_dir, layerId))) {
-        missingLayerIds.push_back(layerId);
-      }
-    }
-
-    if (!missingLayerIds.empty()) {
-      foreach (const string& layerId, missingLayerIds) {
-        LOG(WARNING) << "Image layer: " << layerId << " required for Docker "
-                     << "image: " << name << " is not on disk.";
-      }
-      LOG(WARNING) << "Skipped loading image: " << name
-                   << " due to missing layers.";
-      continue;
-    }
-
-    Try<ImageName> imageName = ImageName::create(name);
-    if (imageName.isError()) {
-      return Failure("Unable to parse Docker image name: " + imageName.error());
-    }
-    storedImages[imageName.get().name()] = DockerImage(imageName.get(), layerIds);
-  }
-
-  LOG(INFO) << "Loaded " << storedImages.size() << " Docker images.";
-
-  return Nothing();
-}
-
-} // namespace docker {
-} // namespace slave {
-} // namespace internal {
-} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/4dedbf4a/src/slave/containerizer/provisioners/docker/metadata_manager.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/provisioners/docker/metadata_manager.hpp b/src/slave/containerizer/provisioners/docker/metadata_manager.hpp
deleted file mode 100644
index 9db3f47..0000000
--- a/src/slave/containerizer/provisioners/docker/metadata_manager.hpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __MESOS_DOCKER_METADATA_MANAGER_HPP__
-#define __MESOS_DOCKER_METADATA_MANAGER_HPP__
-
-#include <list>
-#include <string>
-
-#include <stout/hashmap.hpp>
-#include <stout/json.hpp>
-#include <stout/option.hpp>
-#include <stout/protobuf.hpp>
-#include <stout/try.hpp>
-
-#include <process/future.hpp>
-#include <process/owned.hpp>
-#include <process/process.hpp>
-
-#include "slave/containerizer/provisioners/docker.hpp"
-
-#include "slave/flags.hpp"
-
-namespace mesos {
-namespace internal {
-namespace slave {
-namespace docker {
-
-// Forward Declaration.
-class MetadataManagerProcess;
-
-/**
- * The MetadataManager tracks the Docker images cached by the
- * provisioner that are stored on disk. It keeps track of the layers
- * that Docker images are composed of and recovers DockerImage objects
- * upon initialization by checking for dependent layers stored on disk.
- * Currently, image layers are stored indefinitely, with no garbage
- * collection of unreferenced image layers.
- */
-class MetadataManager
-{
-public:
-  static Try<process::Owned<MetadataManager>> create(const Flags& flags);
-
-   ~MetadataManager();
-
-  /**
-   * Create a DockerImage, put it in metadata manager and persist the reference
-   * store state to disk.
-   *
-   * @param name     the name of the Docker image to place in the reference
-   *                 store.
-   * @param layerIds the list of layer ids that comprise the Docker image in
-   *                 order where the root layer's id (no parent layer) is first
-   *                 and the leaf layer's id is last.
-   */
-  process::Future<DockerImage> put(
-      const ImageName& name,
-      const std::list<std::string>& layerIds);
-
-  /**
-   * Retrieve DockerImage based on image name if it is among the DockerImages
-   * stored in memory.
-   *
-   * @param name  the name of the Docker image to retrieve
-   */
-  process::Future<Option<DockerImage>> get(const ImageName& name);
-
-  /**
-   * Recover all stored DockerImage and its layer references.
-   */
-  process::Future<Nothing> recover();
-
-private:
-  explicit MetadataManager(process::Owned<MetadataManagerProcess> process);
-
-  MetadataManager(const MetadataManager&); // Not copyable.
-  MetadataManager& operator=(const MetadataManager&); // Not assignable.
-
-  process::Owned<MetadataManagerProcess> process;
-};
-
-
-} // namespace docker {
-} // namespace slave {
-} // namespace internal {
-} // namespace mesos {
-
-#endif // __MESOS_DOCKER_METADATA_MANAGER_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/4dedbf4a/src/slave/containerizer/provisioners/docker/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/provisioners/docker/paths.cpp b/src/slave/containerizer/provisioners/docker/paths.cpp
deleted file mode 100644
index 5a54ba1..0000000
--- a/src/slave/containerizer/provisioners/docker/paths.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "slave/containerizer/provisioners/docker/paths.hpp"
-
-#include <stout/path.hpp>
-
-using std::string;
-
-namespace mesos {
-namespace internal {
-namespace slave {
-namespace docker {
-namespace paths {
-
-string getStagingDir(const string& storeDir)
-{
-  return path::join(storeDir, "staging");
-}
-
-string getTempStaging(const string& storeDir)
-{
-  return path::join(getStagingDir(storeDir), "XXXXXX");
-}
-
-string getLocalImageTarPath(
-    const string& discoveryDir,
-    const string& name)
-{
-  return path::join(discoveryDir, name + ".tar");
-}
-
-string getLocalImageRepositoriesPath(const string& staging)
-{
-  return path::join(staging, "repositories");
-}
-
-std::string getLocalImageLayerPath(
-    const string& staging,
-    const string& layerId)
-{
-  return path::join(staging, layerId);
-}
-
-string getLocalImageLayerManifestPath(
-    const string& staging,
-    const string& layerId)
-{
-  return path::join(getLocalImageLayerPath(staging, layerId), "json");
-}
-
-string getLocalImageLayerTarPath(
-  const string& staging,
-  const string& layerId)
-{
-  return path::join(getLocalImageLayerPath(staging, layerId), "layer.tar");
-}
-
-string getLocalImageLayerRootfsPath(
-    const string& staging,
-    const string& layerId)
-{
-  return path::join(getLocalImageLayerPath(staging, layerId), "rootfs");
-}
-
-string getImageLayerPath(
-    const string& storeDir,
-    const string& layerId)
-{
-  return path::join(storeDir, "layers", layerId);
-}
-
-string getImageLayerRootfsPath(
-    const string& storeDir,
-    const string& layerId)
-{
-  return path::join(getImageLayerPath(storeDir, layerId), "rootfs");
-}
-
-string getStoredImagesPath(const string& storeDir)
-{
-  return path::join(storeDir, "storedImages");
-}
-
-} // namespace paths {
-} // namespace docker {
-} // namespace slave {
-} // namespace internal {
-} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/4dedbf4a/src/slave/containerizer/provisioners/docker/paths.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/provisioners/docker/paths.hpp b/src/slave/containerizer/provisioners/docker/paths.hpp
deleted file mode 100644
index 02f129f..0000000
--- a/src/slave/containerizer/provisioners/docker/paths.hpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __MESOS_DOCKER_PATHS_HPP__
-#define __MESOS_DOCKER_PATHS_HPP__
-
-#include <list>
-#include <string>
-
-#include <mesos/mesos.hpp>
-
-namespace mesos {
-namespace internal {
-namespace slave {
-namespace docker {
-namespace paths {
-
-/**
- * The Docker store file system layout is as follows:
- * Image store dir ('--docker_store_dir' slave flag)
- *    |--staging (contains temp directories for downloads and extract)
- *    |--layers
- *       |--<layer_id>
- *           |--rootfs
- *    |--rootfses
- *    |--storedImages (file holding on cached images)
- */
-
-std::string getStagingDir(const std::string& storeDir);
-
-std::string getTempStaging(const std::string& storeDir);
-
-std::string getLocalImageTarPath(
-    const std::string& discoveryDir,
-    const std::string& name);
-
-std::string getLocalImageRepositoriesPath(const std::string& staging);
-
-std::string getLocalImageLayerPath(
-    const std::string& staging,
-    const std::string& layerId);
-
-std::string getLocalImageLayerManifestPath(
-    const std::string& staging,
-    const std::string& layerId);
-
-std::string getLocalImageLayerTarPath(
-  const std::string& staging,
-  const std::string& layerId);
-
-std::string getLocalImageLayerRootfsPath(
-  const std::string& staging,
-  const std::string& layerId);
-
-std::string getImageLayerPath(
-    const std::string& storeDir,
-    const std::string& layerId);
-
-std::string getImageLayerRootfsPath(
-    const std::string& storeDir,
-    const std::string& layerId);
-
-std::string getStoredImagesPath(const std::string& storeDir);
-
-} // namespace paths {
-} // namespace docker {
-} // namespace slave {
-} // namespace internal {
-} // namespace mesos {
-
-#endif // __MESOS_DOCKER_PATHS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/4dedbf4a/src/slave/containerizer/provisioners/docker/store.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/provisioners/docker/store.hpp b/src/slave/containerizer/provisioners/docker/store.hpp
deleted file mode 100644
index 03958bf..0000000
--- a/src/slave/containerizer/provisioners/docker/store.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __MESOS_DOCKER_STORE_HPP__
-#define __MESOS_DOCKER_STORE_HPP__
-
-#include <string>
-
-#include <stout/hashmap.hpp>
-#include <stout/nothing.hpp>
-#include <stout/option.hpp>
-#include <stout/try.hpp>
-
-#include <process/future.hpp>
-
-#include "slave/containerizer/fetcher.hpp"
-#include "slave/containerizer/provisioners/docker.hpp"
-
-#include "slave/flags.hpp"
-
-namespace mesos {
-namespace internal {
-namespace slave {
-namespace docker {
-
-// Store fetches the Docker images and stores them on disk.
-class Store
-{
-public:
-  static Try<process::Owned<Store>> create(
-      const Flags& flags,
-      Fetcher* fetcher);
-
-  virtual ~Store() {}
-
-  /**
-   * Get image by name.
-   *
-   * @param name The name of the Docker image to retrieve from store.
-   *
-   * @return The DockerImage that holds the Docker layers.
-   */
-  virtual process::Future<DockerImage> get(const ImageName& name) = 0;
-
-  /**
-   * Recover all stored images
-   */
-  virtual process::Future<Nothing> recover() = 0;
-
-  // TODO(chenlily): Implement removing an image.
-
-protected:
-  Store() {}
-};
-
-} // namespace docker {
-} // namespace slave {
-} // namespace internal {
-} // namespace mesos {
-
-#endif // __MESOS_DOCKER_STORE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/4dedbf4a/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index b0af3d8..bf26b98 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -98,13 +98,13 @@ mesos::internal::slave::Flags::Flags()
       "Directory the docker provisioner will store images in",
       "/tmp/mesos/store/docker");
 
-  add(&Flags::docker_backend,
-      "docker_backend",
-      "Strategy for docker provisioning container rootfs from images",
-      "copy");
+  add(&Flags::docker_store_discovery,
+      "docker_store_discovery",
+      "Strategy for docker store to fetch images",
+      "local");
 
-  add(&Flags::docker_discovery_local_dir,
-      "docker_discovery_local_dir",
+  add(&Flags::docker_store_discovery_local_dir,
+      "docker_store_discovery_local_dir",
       "Directory for docker provisioner to look in for local images",
       "/tmp/mesos/images/docker");
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/4dedbf4a/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index 758d495..1ce123c 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -53,10 +53,11 @@ public:
   std::string image_provisioner_backend;
   std::string appc_store_dir;
 
-  std::string docker_store;
+  std::string docker_provisioner_backend;
   std::string docker_store_dir;
-  std::string docker_backend;
-  std::string docker_discovery_local_dir;
+  std::string docker_store_discovery;
+  std::string docker_store_discovery_local_dir;
+
   std::string default_role;
   Option<std::string> attributes;
   Bytes fetcher_cache_size;

http://git-wip-us.apache.org/repos/asf/mesos/blob/4dedbf4a/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 dd4f813..3a817c0 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -702,7 +702,7 @@ class DockerProvisionerLocalStoreTest : public TemporaryDirectoryTest
 public:
   void verifyLocalDockerImage(
       const slave::Flags& flags,
-      const DockerImage& dockerImage)
+      const vector<string>& layers)
   {
     string layersPath = path::join(flags.docker_store_dir, "layers");
 
@@ -717,12 +717,10 @@ public:
         os::read(path::join(layersPath, "456", "rootfs", "temp")));
 
     // Verify the Docker Image provided.
-    EXPECT_EQ(dockerImage.imageName.repository, "abc");
-    EXPECT_EQ(dockerImage.imageName.tag, "latest");
-    list<string> expectedLayers;
+    vector<string> expectedLayers;
     expectedLayers.push_back("123");
     expectedLayers.push_back("456");
-    EXPECT_EQ(dockerImage.layerIds, expectedLayers);
+    EXPECT_EQ(expectedLayers, layers);
   }
 
 protected:
@@ -796,25 +794,25 @@ TEST_F(DockerProvisionerLocalStoreTest, LocalStoreTestWithTar)
   ASSERT_SOME(os::mkdir(image));
 
   slave::Flags flags;
-  flags.docker_store = "local";
+  flags.docker_store_discovery = "local";
   flags.docker_store_dir = path::join(os::getcwd(), "store");
-  flags.docker_discovery_local_dir = imageDir;
+  flags.docker_store_discovery_local_dir = imageDir;
 
-  // Fetcher is not relevant to local store. It is passed through from the
-  // provisioner interface.
-  Fetcher fetcher;
-  Try<Owned<Store>> store = Store::create(flags, &fetcher);
+  Try<Owned<slave::Store>> store =
+    mesos::internal::slave::docker::Store::create(flags);
   ASSERT_SOME(store);
 
   string sandbox = path::join(os::getcwd(), "sandbox");
   ASSERT_SOME(os::mkdir(sandbox));
-  Try<ImageName> imageName = ImageName::create("abc");
-  ASSERT_SOME(imageName);
 
-  Future<DockerImage> dockerImage = store.get()->get(imageName.get());
-  AWAIT_READY(dockerImage);
+  Image mesosImage;
+  mesosImage.set_type(Image::DOCKER);
+  mesosImage.mutable_docker()->set_name("abc");
 
-  verifyLocalDockerImage(flags, dockerImage.get());
+  Future<vector<string>> layers = store.get()->get(mesosImage);
+  AWAIT_READY(layers);
+
+  verifyLocalDockerImage(flags, layers.get());
 }
 
 // This tests the ability of the reference store to recover the images it has
@@ -822,32 +820,33 @@ TEST_F(DockerProvisionerLocalStoreTest, LocalStoreTestWithTar)
 TEST_F(DockerProvisionerLocalStoreTest, MetadataManagerInitialization)
 {
   slave::Flags flags;
-  flags.docker_store = "local";
+  flags.docker_store_discovery = "local";
   flags.docker_store_dir = path::join(os::getcwd(), "store");
-  flags.docker_discovery_local_dir = path::join(os::getcwd(), "images");
+  flags.docker_store_discovery_local_dir = path::join(os::getcwd(), "images");
 
-  // Fetcher is not relevant to local store. It is passed through from the
-  // provisioner interface.
-  Fetcher fetcher;
-  Try<Owned<Store>> store = Store::create(flags, &fetcher);
+  Try<Owned<slave::Store>> store =
+    mesos::internal::slave::docker::Store::create(flags);
   ASSERT_SOME(store);
 
   string sandbox = path::join(os::getcwd(), "sandbox");
   ASSERT_SOME(os::mkdir(sandbox));
-  Try<ImageName> imageName = ImageName::create("abc");
-  ASSERT_SOME(imageName);
-  Future<DockerImage> dockerImage = store.get()->get(imageName.get());
-  AWAIT_READY(dockerImage);
+
+  Image image;
+  image.set_type(Image::DOCKER);
+  image.mutable_docker()->set_name("abc");
+
+  Future<vector<string>> layers = store.get()->get(image);
+  AWAIT_READY(layers);
 
   // Store is deleted and recreated. Reference Store is initialized upon
   // creation of the store.
   store.get().reset();
-  store = Store::create(flags, &fetcher);
+  store = mesos::internal::slave::docker::Store::create(flags);
   ASSERT_SOME(store);
 
-  dockerImage = store.get()->get(imageName.get());
-  AWAIT_READY(dockerImage);
-  verifyLocalDockerImage(flags, dockerImage.get());
+  layers = store.get()->get(image);
+  AWAIT_READY(layers);
+  verifyLocalDockerImage(flags, layers.get());
 }
 
 } // namespace tests {