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 2017/11/06 23:07:04 UTC

[14/14] mesos git commit: Added agent ID to offer operation protobuf helper.

Added agent ID to offer operation protobuf helper.

The current code expects an agent ID to be set for every instance of
'OfferOperation'. The absence of an agent ID would indicate an operation
meant for an external resource provider which isn't supported yet.

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


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

Branch: refs/heads/master
Commit: 2619824c9c4157b254157eff76c98fce63d36e71
Parents: 0a30e9e
Author: Jan Schlicht <ja...@mesosphere.io>
Authored: Mon Nov 6 14:38:02 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Nov 6 14:49:07 2017 -0800

----------------------------------------------------------------------
 src/common/protobuf_utils.cpp |  4 +++-
 src/common/protobuf_utils.hpp |  3 ++-
 src/master/master.cpp         | 15 ++++++++++-----
 3 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2619824c/src/common/protobuf_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp
index de18cea..7a4b87b 100644
--- a/src/common/protobuf_utils.cpp
+++ b/src/common/protobuf_utils.cpp
@@ -443,10 +443,12 @@ OfferOperationStatus createOfferOperationStatus(
 OfferOperation createOfferOperation(
     const Offer::Operation& info,
     const OfferOperationStatus& latestStatus,
-    const FrameworkID& frameworkId)
+    const FrameworkID& frameworkId,
+    const SlaveID& slaveId)
 {
   OfferOperation operation;
   operation.mutable_framework_id()->CopyFrom(frameworkId);
+  operation.mutable_slave_id()->CopyFrom(slaveId);
   operation.mutable_info()->CopyFrom(info);
   operation.mutable_latest_status()->CopyFrom(latestStatus);
   operation.set_operation_uuid(UUID::random().toBytes());

http://git-wip-us.apache.org/repos/asf/mesos/blob/2619824c/src/common/protobuf_utils.hpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.hpp b/src/common/protobuf_utils.hpp
index 5e476be..95f57da 100644
--- a/src/common/protobuf_utils.hpp
+++ b/src/common/protobuf_utils.hpp
@@ -163,7 +163,8 @@ OfferOperationStatus createOfferOperationStatus(
 OfferOperation createOfferOperation(
     const Offer::Operation& info,
     const OfferOperationStatus& latestStatus,
-    const FrameworkID& frameworkId);
+    const FrameworkID& frameworkId,
+    const SlaveID& slaveId);
 
 
 // Helper function that creates a MasterInfo from UPID.

http://git-wip-us.apache.org/repos/asf/mesos/blob/2619824c/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index c7aadb1..50f2592 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -5210,7 +5210,8 @@ void Master::_accept(
             protobuf::createOfferOperation(
                 operation,
                 protobuf::createOfferOperationStatus(OFFER_OPERATION_PENDING),
-                frameworkId));
+                frameworkId,
+                slaveId));
 
         addOfferOperation(framework, slave, offerOperation);
 
@@ -5253,7 +5254,8 @@ void Master::_accept(
             protobuf::createOfferOperation(
                 operation,
                 protobuf::createOfferOperationStatus(OFFER_OPERATION_PENDING),
-                frameworkId));
+                frameworkId,
+                slaveId));
 
         addOfferOperation(framework, slave, offerOperation);
 
@@ -5296,7 +5298,8 @@ void Master::_accept(
             protobuf::createOfferOperation(
                 operation,
                 protobuf::createOfferOperationStatus(OFFER_OPERATION_PENDING),
-                frameworkId));
+                frameworkId,
+                slaveId));
 
         addOfferOperation(framework, slave, offerOperation);
 
@@ -5339,7 +5342,8 @@ void Master::_accept(
             protobuf::createOfferOperation(
                 operation,
                 protobuf::createOfferOperationStatus(OFFER_OPERATION_PENDING),
-                frameworkId));
+                frameworkId,
+                slaveId));
 
         addOfferOperation(framework, slave, offerOperation);
 
@@ -9868,7 +9872,8 @@ void Master::_apply(
         protobuf::createOfferOperation(
             operation,
             protobuf::createOfferOperationStatus(OFFER_OPERATION_PENDING),
-            framework->id()));
+            framework->id(),
+            slave->id));
 
     addOfferOperation(framework, slave, offerOperation);