Repository: mesos
Updated Branches:
  refs/heads/master f5cb86db5 -> 8a75dd226


Removed unnecessary 'whitelisted' variable in the allocator.

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


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

Branch: refs/heads/master
Commit: f575ae43ec7c6b28f5e5ba240e219814274cb8c4
Parents: f5cb86d
Author: Benjamin Mahler <[email protected]>
Authored: Tue Dec 2 17:46:37 2014 -0800
Committer: Benjamin Mahler <[email protected]>
Committed: Wed Dec 3 14:59:03 2014 -0800

----------------------------------------------------------------------
 src/master/hierarchical_allocator_process.hpp | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f575ae43/src/master/hierarchical_allocator_process.hpp
----------------------------------------------------------------------
diff --git a/src/master/hierarchical_allocator_process.hpp 
b/src/master/hierarchical_allocator_process.hpp
index fbaa23f..4f284ce 100644
--- a/src/master/hierarchical_allocator_process.hpp
+++ b/src/master/hierarchical_allocator_process.hpp
@@ -64,7 +64,6 @@ struct Slave
   explicit Slave(const SlaveInfo& _info)
     : available(_info.resources()),
       activated(true),
-      whitelisted(false),
       checkpoint(_info.checkpoint()),
       info(_info) {}
 
@@ -79,10 +78,6 @@ struct Slave
   // deactivated slaves until they are reactivated.
   bool activated;
 
-  // Indicates if the resources on this slave should be offered to
-  // frameworks.
-  bool whitelisted;
-
   bool checkpoint;
 private:
   SlaveInfo info;
@@ -191,7 +186,7 @@ protected:
   void expire(const FrameworkID& frameworkId, Filter* filter);
 
   // Checks whether the slave is whitelisted.
-  bool isWhitelisted(const SlaveID& slave);
+  bool isWhitelisted(const SlaveID& slaveId);
 
   // Returns true if there is a filter for this framework
   // on this slave.
@@ -418,7 +413,6 @@ HierarchicalAllocatorProcess<RoleSorter, 
FrameworkSorter>::slaveAdded(
   CHECK(!slaves.contains(slaveId));
 
   slaves[slaveId] = Slave(slaveInfo);
-  slaves[slaveId].whitelisted = isWhitelisted(slaveId);
 
   roleSorter->add(slaveInfo.resources());
 
@@ -511,10 +505,6 @@ HierarchicalAllocatorProcess<RoleSorter, 
FrameworkSorter>::updateWhitelist(
     if (whitelist.get().empty()) {
       LOG(WARNING) << "Whitelist is empty, no offers will be made!";
     }
-
-    foreachkey (const SlaveID& slaveId, slaves) {
-      slaves[slaveId].whitelisted = isWhitelisted(slaveId);
-    }
   } else {
     LOG(INFO) << "Advertising offers for all slaves";
   }
@@ -711,8 +701,8 @@ HierarchicalAllocatorProcess<RoleSorter, 
FrameworkSorter>::allocate(
 
   hashmap<FrameworkID, hashmap<SlaveID, Resources> > offerable;
   foreach (const SlaveID& slaveId, slaveIds) {
-    // If the slave is not activated or whitelisted, ignore it.
-    if (!slaves[slaveId].activated || !slaves[slaveId].whitelisted) {
+    // Don't send offers for non-whitelisted and deactivated slaves.
+    if (!isWhitelisted(slaveId) || !slaves[slaveId].activated) {
       continue;
     }
 

Reply via email to