Added RESOURCE_PROVIDER agent capability.

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


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

Branch: refs/heads/master
Commit: 5b83b31c91fa35ff55a2d29a05eb526330343b44
Parents: 6b9d0c5
Author: Jie Yu <[email protected]>
Authored: Tue Oct 10 16:09:30 2017 -0700
Committer: Jie Yu <[email protected]>
Committed: Sun Oct 29 15:57:28 2017 +0100

----------------------------------------------------------------------
 include/mesos/mesos.proto     | 9 +++++++++
 include/mesos/v1/mesos.proto  | 9 +++++++++
 src/common/protobuf_utils.cpp | 3 ++-
 src/common/protobuf_utils.hpp | 7 +++++++
 4 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5b83b31c/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index ca0f395..12652fe 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -965,6 +965,15 @@ message SlaveInfo {
       // NOTE: Resources are said to have refined reservations if it uses the
       // `Resource.reservations` field, and `Resource.reservations_size() > 1`.
       RESERVATION_REFINEMENT = 3;
+
+      // This expresses the ability for the agent to handle resource
+      // provider related operations. This includes the following:
+      //
+      // (1) The ability to report resources that are provided by some
+      //     local resource providers through the resource provider API.
+      //
+      // (2) The ability to provide offer operations feedback.
+      RESOURCE_PROVIDER = 4;
     }
 
     // Enum fields should be optional, see: MESOS-4997.

http://git-wip-us.apache.org/repos/asf/mesos/blob/5b83b31c/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index c97b180..e0797ae 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -957,6 +957,15 @@ message AgentInfo {
       // NOTE: Resources are said to have refined reservations if it uses the
       // `Resource.reservations` field, and `Resource.reservations_size() > 1`.
       RESERVATION_REFINEMENT = 3;
+
+      // This expresses the ability for the agent to handle resource
+      // provider related operations. This includes the following:
+      //
+      // (1) The ability to report resources that are provided by some
+      //     local resource providers through the resource provider API.
+      //
+      // (2) The ability to provide offer operations feedback.
+      RESOURCE_PROVIDER = 4;
     }
 
     // Enum fields should be optional, see: MESOS-4997.

http://git-wip-us.apache.org/repos/asf/mesos/blob/5b83b31c/src/common/protobuf_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp
index fd4858a..cbb7947 100644
--- a/src/common/protobuf_utils.cpp
+++ b/src/common/protobuf_utils.cpp
@@ -751,7 +751,8 @@ bool operator==(const Capabilities& left, const 
Capabilities& right)
   // equality.
   return left.multiRole == right.multiRole &&
          left.hierarchicalRole == right.hierarchicalRole &&
-         left.reservationRefinement == right.reservationRefinement;
+         left.reservationRefinement == right.reservationRefinement &&
+         left.resourceProvider == right.resourceProvider;
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/5b83b31c/src/common/protobuf_utils.hpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.hpp b/src/common/protobuf_utils.hpp
index c43ab75..d5fef9c 100644
--- a/src/common/protobuf_utils.hpp
+++ b/src/common/protobuf_utils.hpp
@@ -208,6 +208,9 @@ struct Capabilities
         case SlaveInfo::Capability::RESERVATION_REFINEMENT:
           reservationRefinement = true;
           break;
+        case SlaveInfo::Capability::RESOURCE_PROVIDER:
+          resourceProvider = true;
+          break;
         // If adding another case here be sure to update the
         // equality operator.
       }
@@ -218,6 +221,7 @@ struct Capabilities
   bool multiRole = false;
   bool hierarchicalRole = false;
   bool reservationRefinement = false;
+  bool resourceProvider = false;
 
   google::protobuf::RepeatedPtrField<SlaveInfo::Capability>
   toRepeatedPtrField() const
@@ -232,6 +236,9 @@ struct Capabilities
     if (reservationRefinement) {
       result.Add()->set_type(SlaveInfo::Capability::RESERVATION_REFINEMENT);
     }
+    if (resourceProvider) {
+      result.Add()->set_type(SlaveInfo::Capability::RESOURCE_PROVIDER);
+    }
 
     return result;
   }

Reply via email to