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

mesos git commit: Removed some DiskInfo validations from C++ Resources in favor of doing them in the master.

Repository: mesos
Updated Branches:
  refs/heads/master 042553404 -> 0a07f365f


Removed some DiskInfo validations from C++ Resources in favor of doing
them in the master.

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


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

Branch: refs/heads/master
Commit: 0a07f365f9e83bacfd0e1c04dd50c0c5c1b6cd59
Parents: 0425534
Author: Jie Yu <yu...@gmail.com>
Authored: Tue Nov 25 17:24:50 2014 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Nov 25 17:24:51 2014 -0800

----------------------------------------------------------------------
 src/common/resources.cpp      | 28 +++-------------------------
 src/tests/resources_tests.cpp | 12 ------------
 2 files changed, 3 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0a07f365/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 27c6240..535a0ea 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -361,31 +361,9 @@ Option<Error> Resources::validate(const Resource& resource)
   }
 
   // Checks for 'disk' resource.
-  if (resource.has_disk()) {
-    if (resource.name() != "disk") {
-      return Error(
-          "DiskInfo should not be set for " + resource.name() + " resource");
-    }
-
-    if (resource.disk().has_persistence()) {
-      if (resource.role() == "*") {
-        return Error("Persistent disk volume is disallowed for '*' role");
-      }
-
-      if (!resource.disk().has_volume()) {
-        return Error("Persistent disk should specify a volume");
-      }
-    }
-
-    if (resource.disk().has_volume()) {
-      if (resource.disk().volume().mode() == Volume::RO) {
-        return Error("Do not support RO volume in DiskInfo");
-      }
-
-      if (resource.disk().volume().has_host_path()) {
-        return Error("Volume in DiskInfo should not have 'host_path' set");
-      }
-    }
+  if (resource.has_disk() && resource.name() != "disk") {
+    return Error(
+        "DiskInfo should not be set for " + resource.name() + " resource");
   }
 
   return None();

http://git-wip-us.apache.org/repos/asf/mesos/blob/0a07f365/src/tests/resources_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/resources_tests.cpp b/src/tests/resources_tests.cpp
index e71ddd3..cfad938 100644
--- a/src/tests/resources_tests.cpp
+++ b/src/tests/resources_tests.cpp
@@ -854,18 +854,6 @@ TEST_F(DiskResourcesTest, Validation)
       "DiskInfo should not be set for cpus resource",
       error.get().message);
 
-  error = Resources::validate(createDiskResource("10", "*", "1", "path"));
-  ASSERT_SOME(error);
-  EXPECT_EQ(
-      "Persistent disk volume is disallowed for '*' role",
-      error.get().message);
-
-  error = Resources::validate(createDiskResource("10", "role", "1", None()));
-  ASSERT_SOME(error);
-  EXPECT_EQ(
-      "Persistent disk should specify a volume",
-      error.get().message);
-
   EXPECT_NONE(
       Resources::validate(createDiskResource("10", "role", "1", "path")));