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 2014/11/21 01:40:45 UTC

mesos git commit: Added missed changes to DiskInfo patches..

Repository: mesos
Updated Branches:
  refs/heads/master 455bfff6e -> 0f1160b1b


Added missed changes to DiskInfo patches..


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

Branch: refs/heads/master
Commit: 0f1160b1b4d9a82ab1e7b09ba871065105ad272c
Parents: 455bfff
Author: Jie Yu <yu...@gmail.com>
Authored: Thu Nov 20 16:40:14 2014 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Nov 20 16:40:20 2014 -0800

----------------------------------------------------------------------
 src/common/resources.cpp      | 11 +++++++----
 src/tests/resources_tests.cpp |  4 ++--
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0f1160b1/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 6fabca9..27c6240 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -76,8 +76,8 @@ bool operator == (const Resource& left, const Resource& right)
     return false;
   }
 
-  // NOTE: Not setting the DiskInfo is the same as setting the
-  // DiskInfo with no 'volume' and 'persistence' (default).
+  // NOTE: Not setting the DiskInfo is the same as setting an empty
+  // DiskInfo, therefore we just call .disk() even if it's not set.
   if (left.disk() != right.disk()) {
     return false;
   }
@@ -106,7 +106,7 @@ bool operator != (const Resource& left, const Resource& right)
 // TODO(jieyu): Even if two Resource objects with DiskInfo have the
 // same persistence ID, they cannot be added together. In fact, this
 // shouldn't happen if we do not add resources from different
-// namespaces (e.g., slave). Consider adding a warning.
+// namespaces (e.g., across slave). Consider adding a warning.
 static bool addable(const Resource& left, const Resource& right)
 {
   return left.name() == right.name() &&
@@ -124,7 +124,7 @@ static bool addable(const Resource& left, const Resource& right)
 // 'right' to be contained within 'left'. For example, assuming that
 // "left = {1, 2}" and "right = {2, 3}", "left" and "right" are
 // subtractable because "left - right = {1}". However, "left" does not
-// contains "right".
+// contain "right".
 // NOTE: For Resource objects that have DiskInfo, we can only do
 // subtraction if they are equal.
 static bool subtractable(const Resource& left, const Resource& right)
@@ -146,6 +146,9 @@ static bool subtractable(const Resource& left, const Resource& right)
 // Tests if "right" is contained in "left".
 static bool contains(const Resource& left, const Resource& right)
 {
+  // NOTE: This is a necessary condition for 'contains'.
+  // 'subtractable' will verify name, role, type and DiskInfo
+  // compatibility.
   if (!subtractable(left, right)) {
     return false;
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/0f1160b1/src/tests/resources_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/resources_tests.cpp b/src/tests/resources_tests.cpp
index 93b5a53..e71ddd3 100644
--- a/src/tests/resources_tests.cpp
+++ b/src/tests/resources_tests.cpp
@@ -851,13 +851,13 @@ TEST_F(DiskResourcesTest, Validation)
   Option<Error> error = Resources::validate(cpus);
   ASSERT_SOME(error);
   EXPECT_EQ(
-      "Resource with DiskInfo does not have the name 'disk'",
+      "DiskInfo should not be set for cpus resource",
       error.get().message);
 
   error = Resources::validate(createDiskResource("10", "*", "1", "path"));
   ASSERT_SOME(error);
   EXPECT_EQ(
-      "Do not allow a persistent disk volume without reservation",
+      "Persistent disk volume is disallowed for '*' role",
       error.get().message);
 
   error = Resources::validate(createDiskResource("10", "role", "1", None()));