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 2016/02/04 20:46:58 UTC
[1/2] mesos git commit: Moved Appc spec proto messages to its own
spec file.
Repository: mesos
Updated Branches:
refs/heads/master ebdece373 -> c133962c7
Moved Appc spec proto messages to its own spec file.
Review: https://reviews.apache.org/r/43003/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/66bb572b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/66bb572b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/66bb572b
Branch: refs/heads/master
Commit: 66bb572b9fbed99ab175cecf58e8844ba6ad55b5
Parents: ebdece3
Author: Jojy Varghese <jo...@mesosphere.io>
Authored: Thu Feb 4 11:23:03 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Feb 4 11:31:26 2016 -0800
----------------------------------------------------------------------
include/mesos/appc/spec.hpp | 57 ++++++++++
include/mesos/appc/spec.proto | 58 ++++++++++
include/mesos/mesos.proto | 42 -------
src/CMakeLists.txt | 6 +-
src/Makefile.am | 16 ++-
src/appc/spec.cpp | 110 +++++++++++++++++++
.../mesos/provisioner/appc/paths.cpp | 12 --
.../mesos/provisioner/appc/paths.hpp | 10 +-
.../mesos/provisioner/appc/spec.cpp | 102 -----------------
.../mesos/provisioner/appc/spec.hpp | 52 ---------
.../mesos/provisioner/appc/store.cpp | 15 ++-
.../containerizer/provisioner_appc_tests.cpp | 6 +-
12 files changed, 259 insertions(+), 227 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/include/mesos/appc/spec.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/appc/spec.hpp b/include/mesos/appc/spec.hpp
new file mode 100644
index 0000000..462159d
--- /dev/null
+++ b/include/mesos/appc/spec.hpp
@@ -0,0 +1,57 @@
+// 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 __PROVISIONER_APPC_SPEC_HPP__
+#define __PROVISIONER_APPC_SPEC_HPP__
+
+#include <string>
+
+#include <stout/error.hpp>
+#include <stout/option.hpp>
+
+#include <mesos/appc/spec.pb.h>
+
+namespace appc {
+namespace spec {
+
+// Returns the rootfs of an image, given its path as per the spec.
+std::string getImageRootfsPath(const std::string& imagePath);
+
+
+// Returns the path of an image's manifest, given its path as per the spec.
+std::string getImageManifestPath(const std::string& imagePath);
+
+
+// Validate if the specified image manifest conforms to the Appc spec.
+Option<Error> validateManifest(const ImageManifest& manifest);
+
+
+// Validate if the specified image ID conforms to the Appc spec.
+Option<Error> validateImageID(const std::string& imageId);
+
+
+// Validate if the specified image has the disk layout that conforms
+// to the Appc spec.
+Option<Error> validateLayout(const std::string& imagePath);
+
+
+// Parse the ImageManifest in the specified JSON string.
+Try<ImageManifest> parse(const std::string& value);
+
+} // namespace spec {
+} // namespace appc {
+
+#endif // __PROVISIONER_APPC_SPEC_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/include/mesos/appc/spec.proto
----------------------------------------------------------------------
diff --git a/include/mesos/appc/spec.proto b/include/mesos/appc/spec.proto
new file mode 100644
index 0000000..4ef0473
--- /dev/null
+++ b/include/mesos/appc/spec.proto
@@ -0,0 +1,58 @@
+// 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.
+
+package appc.spec;
+
+/**
+* Protobuf for the Appc image manifest JSON schema:
+* https://github.com/appc/spec/blob/master/spec/aci.md#image-manifest-schema
+* Where possible, any field required in the schema is required in the protobuf
+* but some cannot be expressed, e.g., a repeated string that has at least one
+* element. Further validation should be performed after parsing the JSON into
+* the protobuf.
+* This version of Appc protobuf is based on Appc spec version 0.6.1.
+* TODO(xujyan): This protobuf currently defines a subset of fields in the spec
+* that Mesos makes use of to avoid confusion. New fields are going to be added
+* when Mesos starts to support them.
+*/
+message ImageManifest {
+ required string acKind = 1;
+ required string acVersion = 2;
+ required string name = 3;
+
+ message Label {
+ required string name = 1;
+ required string value = 2;
+ }
+
+ repeated Label labels = 4;
+
+ message Annotation {
+ required string name = 1;
+ required string value = 2;
+ }
+
+ repeated Annotation annotations = 5;
+
+ message Dependency {
+ required string imageName = 1;
+ optional string imageID = 2;
+ repeated Label labels = 3;
+ optional uint64 size = 4;
+ }
+
+ repeated Dependency dependencies = 6;
+}
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index f42a45e..5d1a20b 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -1654,45 +1654,3 @@ message DiscoveryInfo {
optional Ports ports = 6;
optional Labels labels = 7;
}
-
-
-/**
-* Protobuf for the Appc image manifest JSON schema:
-* https://github.com/appc/spec/blob/master/spec/aci.md#image-manifest-schema
-* Where possible, any field required in the schema is required in the protobuf
-* but some cannot be expressed, e.g., a repeated string that has at least one
-* element. Further validation should be performed after parsing the JSON into
-* the protobuf.
-* This version of Appc protobuf is based on Appc spec version 0.6.1.
-* TODO(xujyan): This protobuf currently defines a subset of fields in the spec
-* that Mesos makes use of to avoid confusion. New fields are going to be added
-* when Mesos starts to support them.
-*/
-message AppcImageManifest {
- required string acKind = 1;
- required string acVersion = 2;
- required string name = 3;
-
- message Label {
- required string name = 1;
- required string value = 2;
- }
-
- repeated Label labels = 4;
-
- message Annotation {
- required string name = 1;
- required string value = 2;
- }
-
- repeated Annotation annotations = 5;
-
- message Dependency {
- required string imageName = 1;
- optional string imageID = 2;
- repeated Label labels = 3;
- optional uint64 size = 4;
- }
-
- repeated Dependency dependencies = 6;
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2c23af5..dede573 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -85,6 +85,10 @@ configure_file(
# SOURCE FILES FOR THE MESOS LIBRARY.
#####################################
+set(APPC_SRC
+ appc/spec.cpp
+ )
+
set(AUTHENTICATION_SRC
authentication/cram_md5/authenticatee.cpp
authentication/cram_md5/authenticator.cpp
@@ -238,7 +242,6 @@ if (NOT WIN32)
slave/containerizer/mesos/provisioner/provisioner.cpp
slave/containerizer/mesos/provisioner/store.cpp
slave/containerizer/mesos/provisioner/appc/paths.cpp
- slave/containerizer/mesos/provisioner/appc/spec.cpp
slave/containerizer/mesos/provisioner/appc/store.cpp
slave/containerizer/mesos/provisioner/backend.cpp
slave/containerizer/mesos/provisioner/backends/copy.cpp
@@ -303,6 +306,7 @@ set(MESOS_SRC
if (NOT WIN32)
set(MESOS_SRC
${MESOS_SRC}
+ ${APPC_SRC}
${AUTHENTICATION_SRC}
${AUTHORIZER_SRC}
${COMMON_SRC}
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index a851862..642dee4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -147,6 +147,7 @@ endif
# First, let's define necessary protocol buffer files.
ALLOCATOR_PROTO = $(top_srcdir)/include/mesos/master/allocator.proto
+APPC_SPEC_PROTO = $(top_srcdir)/include/mesos/appc/spec.proto
AUTHENTICATION_PROTO = $(top_srcdir)/include/mesos/authentication/authentication.proto
AUTHORIZATION_PROTO = $(top_srcdir)/include/mesos/authorizer/authorizer.proto
CONTAINERIZER_PROTO = $(top_srcdir)/include/mesos/containerizer/containerizer.proto
@@ -171,6 +172,8 @@ V1_SCHEDULER_PROTO = $(top_srcdir)/include/mesos/v1/scheduler/scheduler.proto
CXX_PROTOS = \
../include/mesos/mesos.pb.cc \
../include/mesos/mesos.pb.h \
+ ../include/mesos/appc/spec.pb.cc \
+ ../include/mesos/appc/spec.pb.h \
../include/mesos/authentication/authentication.pb.cc \
../include/mesos/authentication/authentication.pb.h \
../include/mesos/authorizer/authorizer.pb.cc \
@@ -370,6 +373,15 @@ nodist_pkginclude_HEADERS = \
../include/mesos/version.hpp \
../include/mesos/mesos.pb.h
+appcdir = $(pkgincludedir)/appc
+
+appc_HEADERS = \
+ $(top_srcdir)/include/mesos/appc/spec.hpp \
+ $(top_srcdir)/include/mesos/appc/spec.proto
+
+nodist_appc_HEADERS = \
+ ../include/mesos/appc/spec.pb.h
+
authenticationdir = $(pkgincludedir)/authentication
authentication_HEADERS = \
@@ -565,6 +577,7 @@ libmesos_no_3rdparty_la_SOURCES = \
# TODO(tillt): Remove authentication/cram_md5/* which will enable us to
# lose the immediate cyrus-sasl2 dependency.
libmesos_no_3rdparty_la_SOURCES += \
+ appc/spec.cpp \
authentication/cram_md5/authenticatee.cpp \
authentication/cram_md5/authenticator.cpp \
authentication/cram_md5/auxprop.cpp \
@@ -647,7 +660,6 @@ libmesos_no_3rdparty_la_SOURCES += \
slave/containerizer/mesos/provisioner/provisioner.cpp \
slave/containerizer/mesos/provisioner/store.cpp \
slave/containerizer/mesos/provisioner/appc/paths.cpp \
- slave/containerizer/mesos/provisioner/appc/spec.cpp \
slave/containerizer/mesos/provisioner/appc/store.cpp \
slave/containerizer/mesos/provisioner/backends/copy.cpp \
slave/containerizer/mesos/provisioner/docker/local_puller.cpp \
@@ -757,7 +769,6 @@ libmesos_no_3rdparty_la_SOURCES += \
slave/containerizer/mesos/provisioner/provisioner.hpp \
slave/containerizer/mesos/provisioner/store.hpp \
slave/containerizer/mesos/provisioner/appc/paths.hpp \
- slave/containerizer/mesos/provisioner/appc/spec.hpp \
slave/containerizer/mesos/provisioner/appc/store.hpp \
slave/containerizer/mesos/provisioner/backends/copy.hpp \
slave/containerizer/mesos/provisioner/docker/local_puller.hpp \
@@ -1005,6 +1016,7 @@ lib_LTLIBRARIES += libmesos.la
# Include as part of the distribution.
libmesos_la_SOURCES = \
$(ALLOCATOR_PROTO) \
+ $(APPC_SPEC_PROTO) \
$(AUTHENTICATION_PROTO) \
$(AUTHORIZATION_PROTO) \
$(CONTAINERIZER_PROTO) \
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/appc/spec.cpp
----------------------------------------------------------------------
diff --git a/src/appc/spec.cpp b/src/appc/spec.cpp
new file mode 100644
index 0000000..fc36a0b
--- /dev/null
+++ b/src/appc/spec.cpp
@@ -0,0 +1,110 @@
+// 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 <stout/path.hpp>
+#include <stout/protobuf.hpp>
+#include <stout/strings.hpp>
+
+#include <stout/os/stat.hpp>
+
+#include <mesos/appc/spec.hpp>
+
+#include "slave/containerizer/mesos/provisioner/appc/paths.hpp"
+
+using std::string;
+
+namespace appc {
+namespace spec {
+
+string getImageRootfsPath(const string& imagePath)
+{
+ return path::join(imagePath, "rootfs");
+}
+
+
+string getImageManifestPath(const string& imagePath)
+{
+ return path::join(imagePath, "manifest");
+}
+
+
+Option<Error> validateManifest(const ImageManifest& manifest)
+{
+ // TODO(idownes): Validate that required fields are present when
+ // this cannot be expressed in the protobuf specification, e.g.,
+ // repeated fields with >= 1.
+ // TODO(xujyan): More thorough type validation:
+ // https://github.com/appc/spec/blob/master/spec/types.md
+ if (manifest.ackind() != "ImageManifest") {
+ return Error("Incorrect acKind field: " + manifest.ackind());
+ }
+
+ return None();
+}
+
+
+Option<Error> validateImageID(const string& imageId)
+{
+ if (!strings::startsWith(imageId, "sha512-")) {
+ return Error("Image ID needs to start with sha512-");
+ }
+
+ string hash = strings::remove(imageId, "sha512-", strings::PREFIX);
+ if (hash.length() != 128) {
+ return Error("Invalid hash length for: " + hash);
+ }
+
+ return None();
+}
+
+
+Option<Error> validateLayout(const string& imagePath)
+{
+ if (!os::stat::isdir(getImageRootfsPath(imagePath))) {
+ return Error("No rootfs directory found in image layout");
+ }
+
+ if (!os::stat::isfile(getImageManifestPath(imagePath))) {
+ return Error("No manifest found in image layout");
+ }
+
+ return None();
+}
+
+
+Try<ImageManifest> parse(const string& value)
+{
+ Try<JSON::Object> json = JSON::parse<JSON::Object>(value);
+ if (json.isError()) {
+ return Error("JSON parse failed: " + json.error());
+ }
+
+ Try<ImageManifest> manifest = protobuf::parse<ImageManifest>(json.get());
+
+ if (manifest.isError()) {
+ return Error("Protobuf parse failed: " + manifest.error());
+ }
+
+ Option<Error> error = validateManifest(manifest.get());
+ if (error.isSome()) {
+ return Error("Schema validation failed: " + error.get().message);
+ }
+
+ return manifest.get();
+}
+
+} // namespace spec {
+} // namespace appc {
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/slave/containerizer/mesos/provisioner/appc/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/appc/paths.cpp b/src/slave/containerizer/mesos/provisioner/appc/paths.cpp
index 94df5b2..7016ec7 100644
--- a/src/slave/containerizer/mesos/provisioner/appc/paths.cpp
+++ b/src/slave/containerizer/mesos/provisioner/appc/paths.cpp
@@ -57,12 +57,6 @@ string getImageRootfsPath(
}
-string getImageRootfsPath(const string& imagePath)
-{
- return path::join(imagePath, "rootfs");
-}
-
-
string getImageManifestPath(
const string& storeDir,
const string& imageId)
@@ -70,12 +64,6 @@ string getImageManifestPath(
return path::join(getImagePath(storeDir, imageId), "manifest");
}
-
-string getImageManifestPath(const string& imagePath)
-{
- return path::join(imagePath, "manifest");
-}
-
} // namespace paths {
} // namespace appc {
} // namespace slave {
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/slave/containerizer/mesos/provisioner/appc/paths.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/appc/paths.hpp b/src/slave/containerizer/mesos/provisioner/appc/paths.hpp
index dfeb3ff..6000940 100644
--- a/src/slave/containerizer/mesos/provisioner/appc/paths.hpp
+++ b/src/slave/containerizer/mesos/provisioner/appc/paths.hpp
@@ -19,11 +19,11 @@
#include <string>
-#include <mesos/mesos.hpp>
-
#include <stout/hashmap.hpp>
#include <stout/try.hpp>
+#include <mesos/appc/spec.hpp>
+
namespace mesos {
namespace internal {
namespace slave {
@@ -62,16 +62,10 @@ std::string getImageRootfsPath(
const std::string& imageId);
-std::string getImageRootfsPath(const std::string& imagePath);
-
-
std::string getImageManifestPath(
const std::string& storeDir,
const std::string& imageId);
-
-std::string getImageManifestPath(const std::string& imagePath);
-
} // namespace paths {
} // namespace appc {
} // namespace slave {
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/slave/containerizer/mesos/provisioner/appc/spec.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/appc/spec.cpp b/src/slave/containerizer/mesos/provisioner/appc/spec.cpp
deleted file mode 100644
index 324cdfe..0000000
--- a/src/slave/containerizer/mesos/provisioner/appc/spec.cpp
+++ /dev/null
@@ -1,102 +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 <stout/os/stat.hpp>
-#include <stout/protobuf.hpp>
-#include <stout/strings.hpp>
-
-#include "slave/containerizer/mesos/provisioner/appc/paths.hpp"
-#include "slave/containerizer/mesos/provisioner/appc/spec.hpp"
-
-using std::string;
-
-namespace mesos {
-namespace internal {
-namespace slave {
-namespace appc {
-namespace spec {
-
-Option<Error> validateManifest(const AppcImageManifest& manifest)
-{
- // TODO(idownes): Validate that required fields are present when
- // this cannot be expressed in the protobuf specification, e.g.,
- // repeated fields with >= 1.
- // TODO(xujyan): More thorough type validation:
- // https://github.com/appc/spec/blob/master/spec/types.md
- if (manifest.ackind() != "ImageManifest") {
- return Error("Incorrect acKind field: " + manifest.ackind());
- }
-
- return None();
-}
-
-
-Option<Error> validateImageID(const string& imageId)
-{
- if (!strings::startsWith(imageId, "sha512-")) {
- return Error("Image ID needs to start with sha512-");
- }
-
- string hash = strings::remove(imageId, "sha512-", strings::PREFIX);
- if (hash.length() != 128) {
- return Error("Invalid hash length for: " + hash);
- }
-
- return None();
-}
-
-
-Option<Error> validateLayout(const string& imagePath)
-{
- if (!os::stat::isdir(paths::getImageRootfsPath(imagePath))) {
- return Error("No rootfs directory found in image layout");
- }
-
- if (!os::stat::isfile(paths::getImageManifestPath(imagePath))) {
- return Error("No manifest found in image layout");
- }
-
- return None();
-}
-
-
-Try<AppcImageManifest> parse(const string& value)
-{
- Try<JSON::Object> json = JSON::parse<JSON::Object>(value);
- if (json.isError()) {
- return Error("JSON parse failed: " + json.error());
- }
-
- Try<AppcImageManifest> manifest =
- protobuf::parse<AppcImageManifest>(json.get());
-
- if (manifest.isError()) {
- return Error("Protobuf parse failed: " + manifest.error());
- }
-
- Option<Error> error = validateManifest(manifest.get());
- if (error.isSome()) {
- return Error("Schema validation failed: " + error.get().message);
- }
-
- return manifest.get();
-}
-
-} // namespace spec {
-} // namespace appc {
-} // namespace slave {
-} // namespace internal {
-} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/slave/containerizer/mesos/provisioner/appc/spec.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/appc/spec.hpp b/src/slave/containerizer/mesos/provisioner/appc/spec.hpp
deleted file mode 100644
index d4fd8cb..0000000
--- a/src/slave/containerizer/mesos/provisioner/appc/spec.hpp
+++ /dev/null
@@ -1,52 +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 __PROVISIONER_APPC_SPEC_HPP__
-#define __PROVISIONER_APPC_SPEC_HPP__
-
-#include <string>
-
-#include <stout/error.hpp>
-#include <stout/option.hpp>
-
-#include <mesos/mesos.hpp>
-
-namespace mesos {
-namespace internal {
-namespace slave {
-namespace appc {
-namespace spec {
-
-// Validate if the specified image manifest conforms to the Appc spec.
-Option<Error> validateManifest(const AppcImageManifest& manifest);
-
-// Validate if the specified image ID conforms to the Appc spec.
-Option<Error> validateImageID(const std::string& imageId);
-
-// Validate if the specified image has the disk layout that conforms
-// to the Appc spec.
-Option<Error> validateLayout(const std::string& imagePath);
-
-// Parse the AppcImageManifest in the specified JSON string.
-Try<AppcImageManifest> parse(const std::string& value);
-
-} // namespace spec {
-} // namespace appc {
-} // namespace slave {
-} // namespace internal {
-} // namespace mesos {
-
-#endif // __PROVISIONER_APPC_SPEC_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/slave/containerizer/mesos/provisioner/appc/store.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/appc/store.cpp b/src/slave/containerizer/mesos/provisioner/appc/store.cpp
index 73c4df8..be90a86 100644
--- a/src/slave/containerizer/mesos/provisioner/appc/store.cpp
+++ b/src/slave/containerizer/mesos/provisioner/appc/store.cpp
@@ -26,12 +26,15 @@
#include <stout/os.hpp>
#include <stout/path.hpp>
+#include <mesos/appc/spec.hpp>
+
#include "slave/containerizer/mesos/provisioner/appc/paths.hpp"
-#include "slave/containerizer/mesos/provisioner/appc/spec.hpp"
#include "slave/containerizer/mesos/provisioner/appc/store.hpp"
using namespace process;
+namespace spec = appc::spec;
+
using std::list;
using std::string;
using std::vector;
@@ -47,7 +50,7 @@ struct CachedImage
static Try<CachedImage> create(const string& imagePath);
CachedImage(
- const AppcImageManifest& _manifest,
+ const spec::ImageManifest& _manifest,
const string& _id,
const string& _path)
: manifest(_manifest), id(_id), path(_path) {}
@@ -57,7 +60,7 @@ struct CachedImage
return path::join(path, "rootfs");
}
- const AppcImageManifest manifest;
+ const spec::ImageManifest manifest;
// Image ID of the format "sha512-value" where "value" is the hex
// encoded string of the sha512 digest of the uncompressed tar file
@@ -83,12 +86,12 @@ Try<CachedImage> CachedImage::create(const string& imagePath)
return Error("Invalid image ID: " + error.get().message);
}
- Try<string> read = os::read(paths::getImageManifestPath(imagePath));
+ Try<string> read = os::read(spec::getImageManifestPath(imagePath));
if (read.isError()) {
return Error("Failed to read manifest: " + read.error());
}
- Try<AppcImageManifest> manifest = spec::parse(read.get());
+ Try<spec::ImageManifest> manifest = spec::parse(read.get());
if (manifest.isError()) {
return Error("Failed to parse manifest: " + manifest.error());
}
@@ -120,7 +123,7 @@ static bool matches(Image::Appc requirements, const CachedImage& candidate)
}
hashmap<string, string> candidateLabels;
- foreach (const AppcImageManifest::Label& label,
+ foreach (const spec::ImageManifest::Label& label,
candidate.manifest.labels()) {
candidateLabels[label.name()] = label.value();
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/66bb572b/src/tests/containerizer/provisioner_appc_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_appc_tests.cpp b/src/tests/containerizer/provisioner_appc_tests.cpp
index e3d08d9..012dba4 100644
--- a/src/tests/containerizer/provisioner_appc_tests.cpp
+++ b/src/tests/containerizer/provisioner_appc_tests.cpp
@@ -29,12 +29,12 @@
#include <stout/tests/utils.hpp>
+#include <mesos/appc/spec.hpp>
+
#include "slave/paths.hpp"
#include "slave/containerizer/mesos/provisioner/paths.hpp"
#include "slave/containerizer/mesos/provisioner/provisioner.hpp"
-
-#include "slave/containerizer/mesos/provisioner/appc/spec.hpp"
#include "slave/containerizer/mesos/provisioner/appc/store.hpp"
using std::list;
@@ -45,6 +45,8 @@ using namespace process;
using namespace mesos::internal::slave::appc;
+namespace spec = appc::spec;
+
using mesos::internal::slave::Fetcher;
using mesos::internal::slave::Provisioner;
[2/2] mesos git commit: Fixed the stout Makefile.am.
Posted by ji...@apache.org.
Fixed the stout Makefile.am.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c133962c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c133962c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c133962c
Branch: refs/heads/master
Commit: c133962c7110fb4b6569da4236afe24f12e383b0
Parents: 66bb572
Author: Jie Yu <yu...@gmail.com>
Authored: Thu Feb 4 11:46:44 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Feb 4 11:46:44 2016 -0800
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/include/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c133962c/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
index 7b38abf..03eff5a 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
@@ -33,7 +33,6 @@ nobase_include_HEADERS = \
stout/foreach.hpp \
stout/format.hpp \
stout/fs.hpp \
- stout/freebsd.hpp \
stout/gtest.hpp \
stout/gzip.hpp \
stout/hashmap.hpp \
@@ -68,6 +67,7 @@ nobase_include_HEADERS = \
stout/os/fcntl.hpp \
stout/os/find.hpp \
stout/os/fork.hpp \
+ stout/os/freebsd.hpp \
stout/os/ftruncate.hpp \
stout/os/getcwd.hpp \
stout/os/killtree.hpp \