You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/07/01 00:44:41 UTC

[1/5] mesos git commit: Implement fairness exclusion: Added tests.

Repository: mesos
Updated Branches:
  refs/heads/master 1f47583ad -> 97138fbb2


Implement fairness exclusion: Added tests.

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


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

Branch: refs/heads/master
Commit: 97138fbb2e7b11b3cf03a4b3b12536617b30f0fe
Parents: c67b2a1
Author: Guangya Liu <gy...@gmail.com>
Authored: Thu Jun 30 16:57:48 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Jun 30 17:44:21 2016 -0700

----------------------------------------------------------------------
 src/tests/hierarchical_allocator_tests.cpp | 192 +++++++++++++++++++++++-
 1 file changed, 191 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/97138fbb/src/tests/hierarchical_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp
index eb11ff6..0498cd5 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -16,6 +16,7 @@
 
 #include <atomic>
 #include <iostream>
+#include <set>
 #include <string>
 #include <utility>
 #include <vector>
@@ -64,6 +65,7 @@ using std::atomic;
 using std::cout;
 using std::endl;
 using std::map;
+using std::set;
 using std::string;
 using std::vector;
 
@@ -179,7 +181,8 @@ protected:
         flags.allocation_interval,
         offerCallback.get(),
         inverseOfferCallback.get(),
-        {});
+        {},
+        flags.fair_sharing_excluded_resource_names);
   }
 
   SlaveInfo createSlaveInfo(const string& resources)
@@ -481,6 +484,136 @@ TEST_F(HierarchicalAllocatorTest, ReservedDRF)
 }
 
 
+// Tests that the fairness exclusion list works as expected. The test
+// accomplishes this by adding frameworks and slaves one at a time to
+// the allocator with exclude resources, making sure that each time a
+// new slave is added all of its resources are offered to whichever
+// framework currently has the smallest share. Checking for proper DRF
+// logic when resources are returned, frameworks exit, etc, is handled
+// by SorterTest.DRFSorter.
+TEST_F(HierarchicalAllocatorTest, DRFWithFairnessExclusion)
+{
+  // Pausing the clock is not necessary, but ensures that the test
+  // doesn't rely on the batch allocation in the allocator, which
+  // would slow down the test.
+  Clock::pause();
+
+  // Specify that `gpus` should not be fairly shared.
+  master::Flags flags_;
+  flags_.fair_sharing_excluded_resource_names = set<string>({"gpus"});
+
+  initialize(flags_);
+
+  // Total cluster resources will become cpus=2, mem=1024, gpus=1.
+  SlaveInfo agent1 = createSlaveInfo("cpus:2;mem:1024;disk:0;gpus:1");
+  allocator->addSlave(agent1.id(), agent1, None(), agent1.resources(), {});
+
+  // framework1 will be offered all of agent1's resources since it is
+  // the only framework running so far.
+  FrameworkInfo framework1 = createFrameworkInfo(
+      "role1", {FrameworkInfo::Capability::GPU_RESOURCES});
+
+  allocator->addFramework(framework1.id(), framework1, {});
+
+  Future<Allocation> allocation = allocations.get();
+  AWAIT_READY(allocation);
+  EXPECT_EQ(framework1.id(), allocation->frameworkId);
+  EXPECT_EQ(agent1.resources(), Resources::sum(allocation->resources));
+
+  // role1 share = 1 (cpus=2, mem=1024, (ignored) gpus=1)
+  //   framework1 share = 1
+
+  FrameworkInfo framework2 = createFrameworkInfo("role2");
+  allocator->addFramework(framework2.id(), framework2, {});
+
+  // Total cluster resources will become cpus=3, mem=1536, (ignored) gpus=1
+  // role1 share = 0.66 (cpus=2, mem=1024, (ignored) gpus=1)
+  //   framework1 share = 1
+  // role2 share = 0
+  //   framework2 share = 0
+  SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:512;disk:0");
+  allocator->addSlave(agent2.id(), agent2, None(), agent2.resources(), {});
+
+  // framework2 will be offered all of agent2's resources since role2
+  // has the lowest user share, and framework2 is its only framework.
+  allocation = allocations.get();
+  AWAIT_READY(allocation);
+  EXPECT_EQ(framework2.id(), allocation->frameworkId);
+  EXPECT_EQ(agent2.resources(), Resources::sum(allocation->resources));
+
+  // role1 share = 0.67 (cpus=2, mem=1024, (ignored) gpus=1)
+  //   framework1 share = 1
+  // role2 share = 0.33 (cpus=1, mem=512)
+  //   framework2 share = 1
+
+  // Total cluster resources will become cpus=6, mem=3584, (ignored) gpus=1
+  // role1 share = 0.33 (cpus=2, mem=1024, (ignored) gpus=1)
+  //   framework1 share = 1
+  // role2 share = 0.16 (cpus=1, mem=512)
+  //   framework2 share = 1
+  SlaveInfo agent3 = createSlaveInfo("cpus:3;mem:2048;disk:0");
+  allocator->addSlave(agent3.id(), agent3, None(), agent3.resources(), {});
+
+  // framework2 will be offered all of agent3's resources since role2
+  // has the lowest share.
+  allocation = allocations.get();
+  AWAIT_READY(allocation);
+  EXPECT_EQ(framework2.id(), allocation->frameworkId);
+  EXPECT_EQ(agent3.resources(), Resources::sum(allocation->resources));
+
+  // role1 share = 0.33 (cpus=2, mem=1024, (ignored)gpus=1)
+  //   framework1 share = 1
+  // role2 share = 0.71 (cpus=4, mem=2560)
+  //   framework2 share = 1
+
+  FrameworkInfo framework3 = createFrameworkInfo("role1");
+  allocator->addFramework(framework3.id(), framework3, {});
+
+  // Total cluster resources will become cpus=10, mem=7680, (ignored) gpus=1
+  // role1 share = 0.2 (cpus=2, mem=1024, (ignored) gpus=1)
+  //   framework1 share = 1
+  //   framework3 share = 0
+  // role2 share = 0.4 (cpus=4, mem=2560)
+  //   framework2 share = 1
+  SlaveInfo agent4 = createSlaveInfo("cpus:4;mem:4096;disk:0");
+  allocator->addSlave(agent4.id(), agent4, None(), agent4.resources(), {});
+
+  // framework3 will be offered all of agent4's resources since role1
+  // has the lowest user share, and framework3 has the lowest share of
+  // role1's frameworks.
+  allocation = allocations.get();
+  AWAIT_READY(allocation);
+  EXPECT_EQ(framework3.id(), allocation->frameworkId);
+  EXPECT_EQ(agent4.resources(), Resources::sum(allocation->resources));
+
+  // role1 share = 0.67 (cpus=6, mem=5120, (ignored) gpus=1)
+  //   framework1 share = 0.33 (cpus=2, mem=1024, (ignored) gpus=1)
+  //   framework3 share = 0.8 (cpus=4, mem=4096)
+  // role2 share = 0.4 (cpus=4, mem=2560)
+  //   framework2 share = 1
+
+  FrameworkInfo framework4 = createFrameworkInfo("role1");
+  allocator->addFramework(framework4.id(), framework4, {});
+
+  // Total cluster resources will become cpus=11, mem=8192, (ignored) gpus=1
+  // role1 share = 0.63 (cpus=6, mem=5120, (ignored) gpus=1)
+  //   framework1 share = 0.33 (cpus=2, mem=1024, (ignored) gpus=1)
+  //   framework3 share = 0.8 (cpus=4, mem=4096)
+  //   framework4 share = 0
+  // role2 share = 0.36 (cpus=4, mem=2560)
+  //   framework2 share = 1
+  SlaveInfo agent5 = createSlaveInfo("cpus:1;mem:512;disk:0");
+  allocator->addSlave(agent5.id(), agent5, None(), agent5.resources(), {});
+
+  // Even though framework4 doesn't have any resources, role2 has a
+  // lower share than role1, so framework2 receives agent5's resources.
+  allocation = allocations.get();
+  AWAIT_READY(allocation);
+  EXPECT_EQ(framework2.id(), allocation->frameworkId);
+  EXPECT_EQ(agent5.resources(), Resources::sum(allocation->resources));
+}
+
+
 // This test ensures that an offer filter larger than the
 // allocation interval effectively filters out resources.
 TEST_F(HierarchicalAllocatorTest, OfferFilter)
@@ -2742,6 +2875,63 @@ TEST_F(HierarchicalAllocatorTest, DominantShareMetrics)
 }
 
 
+// Verifies that per-role dominant share metrics are correctly
+// reported when resources are excluded from fair sharing.
+TEST_F(HierarchicalAllocatorTest, DominantShareMetricsWithFairnessExclusion)
+{
+  // Pausing the clock is not necessary, but ensures that the test
+  // doesn't rely on the batch allocation in the allocator, which
+  // would slow down the test.
+  Clock::pause();
+
+  // Specify that `gpus` should not be fairly shared.
+  master::Flags flags_;
+  flags_.fair_sharing_excluded_resource_names = set<string>({"gpus"});
+
+  initialize(flags_);
+
+  // Register one agent and one framework. The framework will
+  // immediately receive receive an offer and make it have the
+  // maximum possible dominant share.
+  SlaveInfo agent1 = createSlaveInfo("cpus:1;mem:1024;gpus:1");
+  allocator->addSlave(agent1.id(), agent1, None(), agent1.resources(), {});
+
+  FrameworkInfo framework1 = createFrameworkInfo(
+      "roleA", {FrameworkInfo::Capability::GPU_RESOURCES});
+
+  allocator->addFramework(framework1.id(), framework1, {});
+  Clock::settle();
+
+  JSON::Object expected;
+
+  expected.values = {
+      {"allocator/mesos/roles/roleA/shares/dominant", 1},
+  };
+
+  JSON::Value metrics = Metrics();
+  EXPECT_TRUE(metrics.contains(expected));
+
+  FrameworkInfo framework2 = createFrameworkInfo("roleB");
+  allocator->addFramework(framework2.id(), framework2, {});
+  Clock::settle();
+
+  // Add a second, identical agent. Now `framework2` will
+  // receive an offer since it has the lowest dominant share:
+  // the 100% of `gpus` allocated to framework1 are excluded!
+  SlaveInfo agent2 = createSlaveInfo("cpus:3;mem:3072");
+  allocator->addSlave(agent2.id(), agent2, None(), agent2.resources(), {});
+  Clock::settle();
+
+  expected.values = {
+      {"allocator/mesos/roles/roleA/shares/dominant", 0.25},
+      {"allocator/mesos/roles/roleB/shares/dominant", 0.75},
+  };
+
+  metrics = Metrics();
+  EXPECT_TRUE(metrics.contains(expected));
+}
+
+
 // This test ensures that resource allocation is done according to each role's
 // weight. This is done by having six agents and three frameworks and making
 // sure each framework gets the appropriate number of resources.


[5/5] mesos git commit: Implement fairness exclusion: Updated allocator initialization.

Posted by bm...@apache.org.
Implement fairness exclusion: Updated allocator initialization.

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


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

Branch: refs/heads/master
Commit: 32c7bb5300a8fc5ce54bb82c96da95a34bc3d68c
Parents: c9f59ae
Author: Guangya Liu <gy...@gmail.com>
Authored: Thu Jun 30 16:17:38 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Jun 30 17:44:21 2016 -0700

----------------------------------------------------------------------
 include/mesos/allocator/allocator.hpp           |  4 ++-
 src/master/allocator/mesos/allocator.hpp        | 14 +++++---
 src/master/allocator/mesos/hierarchical.cpp     |  7 +++-
 src/master/allocator/mesos/hierarchical.hpp     |  8 ++++-
 src/master/master.cpp                           |  3 +-
 src/tests/allocator.hpp                         | 11 +++---
 src/tests/api_tests.cpp                         |  4 +--
 src/tests/master_allocator_tests.cpp            | 34 +++++++++---------
 src/tests/master_quota_tests.cpp                | 18 +++++-----
 src/tests/persistent_volume_endpoints_tests.cpp | 36 +++++++++----------
 src/tests/reservation_endpoints_tests.cpp       | 38 ++++++++++----------
 src/tests/reservation_tests.cpp                 |  4 +--
 src/tests/resource_offers_tests.cpp             |  2 +-
 src/tests/slave_recovery_tests.cpp              |  2 +-
 14 files changed, 103 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/include/mesos/allocator/allocator.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/allocator/allocator.hpp b/include/mesos/allocator/allocator.hpp
index 98025bc..41a9d45 100644
--- a/include/mesos/allocator/allocator.hpp
+++ b/include/mesos/allocator/allocator.hpp
@@ -93,7 +93,9 @@ public:
           void(const FrameworkID&,
                const hashmap<SlaveID, UnavailableResources>&)>&
         inverseOfferCallback,
-      const hashmap<std::string, double>& weights) = 0;
+      const hashmap<std::string, double>& weights,
+      const Option<std::set<std::string>>&
+        fairnessExcludeResourceNames = None()) = 0;
 
   /**
    * Informs the allocator of the recovered state from the master.

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/master/allocator/mesos/allocator.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/allocator.hpp b/src/master/allocator/mesos/allocator.hpp
index f096d2b..69639be 100644
--- a/src/master/allocator/mesos/allocator.hpp
+++ b/src/master/allocator/mesos/allocator.hpp
@@ -55,7 +55,9 @@ public:
           void(const FrameworkID&,
                const hashmap<SlaveID, UnavailableResources>&)>&
         inverseOfferCallback,
-      const hashmap<std::string, double>& weights);
+      const hashmap<std::string, double>& weights,
+      const Option<std::set<std::string>>&
+        fairnessExcludeResourceNames = None());
 
   void recover(
       const int expectedAgentCount,
@@ -183,7 +185,9 @@ public:
           void(const FrameworkID&,
                const hashmap<SlaveID, UnavailableResources>&)>&
         inverseOfferCallback,
-      const hashmap<std::string, double>& weights) = 0;
+      const hashmap<std::string, double>& weights,
+      const Option<std::set<std::string>>&
+        fairnessExcludeResourceNames = None()) = 0;
 
   virtual void recover(
       const int expectedAgentCount,
@@ -319,7 +323,8 @@ inline void MesosAllocator<AllocatorProcess>::initialize(
         void(const FrameworkID&,
               const hashmap<SlaveID, UnavailableResources>&)>&
       inverseOfferCallback,
-    const hashmap<std::string, double>& weights)
+    const hashmap<std::string, double>& weights,
+    const Option<std::set<std::string>>& fairnessExcludeResourceNames)
 {
   process::dispatch(
       process,
@@ -327,7 +332,8 @@ inline void MesosAllocator<AllocatorProcess>::initialize(
       allocationInterval,
       offerCallback,
       inverseOfferCallback,
-      weights);
+      weights,
+      fairnessExcludeResourceNames);
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/master/allocator/mesos/hierarchical.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index c363934..20f9e72 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -17,6 +17,8 @@
 #include "master/allocator/mesos/hierarchical.hpp"
 
 #include <algorithm>
+#include <set>
+#include <string>
 #include <vector>
 
 #include <mesos/resources.hpp>
@@ -32,6 +34,7 @@
 #include <stout/stopwatch.hpp>
 #include <stout/stringify.hpp>
 
+using std::set;
 using std::string;
 using std::vector;
 
@@ -124,12 +127,14 @@ void HierarchicalAllocatorProcess::initialize(
         void(const FrameworkID&,
              const hashmap<SlaveID, UnavailableResources>&)>&
       _inverseOfferCallback,
-    const hashmap<string, double>& _weights)
+    const hashmap<string, double>& _weights,
+    const Option<set<std::string>>& _fairnessExcludeResourceNames)
 {
   allocationInterval = _allocationInterval;
   offerCallback = _offerCallback;
   inverseOfferCallback = _inverseOfferCallback;
   weights = _weights;
+  fairnessExcludeResourceNames = _fairnessExcludeResourceNames;
   initialized = true;
   paused = false;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/master/allocator/mesos/hierarchical.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.hpp b/src/master/allocator/mesos/hierarchical.hpp
index 926e501..b72ba16 100644
--- a/src/master/allocator/mesos/hierarchical.hpp
+++ b/src/master/allocator/mesos/hierarchical.hpp
@@ -17,6 +17,7 @@
 #ifndef __MASTER_ALLOCATOR_MESOS_HIERARCHICAL_HPP__
 #define __MASTER_ALLOCATOR_MESOS_HIERARCHICAL_HPP__
 
+#include <set>
 #include <string>
 
 #include <mesos/mesos.hpp>
@@ -100,7 +101,9 @@ public:
           void(const FrameworkID&,
                const hashmap<SlaveID, UnavailableResources>&)>&
         inverseOfferCallback,
-      const hashmap<std::string, double>& weights);
+      const hashmap<std::string, double>& weights,
+      const Option<std::set<std::string>>&
+        fairnessExcludeResourceNames = None());
 
   void recover(
       const int _expectedAgentCount,
@@ -398,6 +401,9 @@ protected:
   // Slaves to send offers for.
   Option<hashset<std::string>> whitelist;
 
+  // Resources (by name) that will be excluded from a role's fair share.
+  Option<std::set<std::string>> fairnessExcludeResourceNames;
+
   // There are two stages of allocation. During the first stage resources
   // are allocated only to frameworks in roles with quota set. During the
   // second stage remaining resources that would not be required to satisfy

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 907233b..78a8889 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -826,7 +826,8 @@ void Master::initialize()
       flags.allocation_interval,
       defer(self(), &Master::offer, lambda::_1, lambda::_2),
       defer(self(), &Master::inverseOffer, lambda::_1, lambda::_2),
-      weights);
+      weights,
+      flags.fair_sharing_excluded_resource_names);
 
   // Parse the whitelist. Passing Allocator::updateWhitelist()
   // callback is safe because we shut down the whitelistWatcher in

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/allocator.hpp
----------------------------------------------------------------------
diff --git a/src/tests/allocator.hpp b/src/tests/allocator.hpp
index 41a31ae..c4d835a 100644
--- a/src/tests/allocator.hpp
+++ b/src/tests/allocator.hpp
@@ -45,7 +45,7 @@ namespace tests {
 
 ACTION_P(InvokeInitialize, allocator)
 {
-  allocator->real->initialize(arg0, arg1, arg2, arg3);
+  allocator->real->initialize(arg0, arg1, arg2, arg3, arg4);
 }
 
 
@@ -229,9 +229,9 @@ public:
     // to get the best of both worlds: the ability to use 'DoDefault'
     // and no warnings when expectations are not explicit.
 
-    ON_CALL(*this, initialize(_, _, _, _))
+    ON_CALL(*this, initialize(_, _, _, _, _))
       .WillByDefault(InvokeInitialize(this));
-    EXPECT_CALL(*this, initialize(_, _, _, _))
+    EXPECT_CALL(*this, initialize(_, _, _, _, _))
       .WillRepeatedly(DoDefault());
 
     ON_CALL(*this, recover(_, _))
@@ -357,7 +357,7 @@ public:
 
   virtual ~TestAllocator() {}
 
-  MOCK_METHOD4(initialize, void(
+  MOCK_METHOD5(initialize, void(
       const Duration&,
       const lambda::function<
           void(const FrameworkID&,
@@ -365,7 +365,8 @@ public:
       const lambda::function<
           void(const FrameworkID&,
                const hashmap<SlaveID, UnavailableResources>&)>&,
-      const hashmap<std::string, double>&));
+      const hashmap<std::string, double>&,
+      const Option<std::set<std::string>>&));
 
   MOCK_METHOD2(recover, void(
       const int expectedAgentCount,

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index e53c5a8..a7f0751 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -643,7 +643,7 @@ TEST_P(MasterAPITest, ReserveResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -733,7 +733,7 @@ TEST_P(MasterAPITest, UnreserveResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/master_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_allocator_tests.cpp b/src/tests/master_allocator_tests.cpp
index 7910f55..4beebff 100644
--- a/src/tests/master_allocator_tests.cpp
+++ b/src/tests/master_allocator_tests.cpp
@@ -105,7 +105,7 @@ TYPED_TEST(MasterAllocatorTest, SingleFramework)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = this->StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -150,7 +150,7 @@ TYPED_TEST(MasterAllocatorTest, ResourcesUnused)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = this->StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -257,7 +257,7 @@ TYPED_TEST(MasterAllocatorTest, OutOfOrderDispatch)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = this->StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -385,7 +385,7 @@ TYPED_TEST(MasterAllocatorTest, SchedulerFailover)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = this->StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -509,7 +509,7 @@ TYPED_TEST(MasterAllocatorTest, FrameworkExited)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   master::Flags masterFlags = this->CreateMasterFlags();
   masterFlags.allocation_interval = Milliseconds(50);
@@ -657,7 +657,7 @@ TYPED_TEST(MasterAllocatorTest, SlaveLost)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = this->StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -779,7 +779,7 @@ TYPED_TEST(MasterAllocatorTest, SlaveAdded)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   master::Flags masterFlags = this->CreateMasterFlags();
   masterFlags.allocation_interval = Milliseconds(50);
@@ -875,7 +875,7 @@ TYPED_TEST(MasterAllocatorTest, TaskFinished)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   master::Flags masterFlags = this->CreateMasterFlags();
   masterFlags.allocation_interval = Milliseconds(50);
@@ -979,7 +979,7 @@ TYPED_TEST(MasterAllocatorTest, CpusOnlyOfferedAndTaskLaunched)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   master::Flags masterFlags = this->CreateMasterFlags();
   masterFlags.allocation_interval = Milliseconds(50);
@@ -1060,7 +1060,7 @@ TYPED_TEST(MasterAllocatorTest, MemoryOnlyOfferedAndTaskLaunched)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   master::Flags masterFlags = this->CreateMasterFlags();
   masterFlags.allocation_interval = Milliseconds(50);
@@ -1154,7 +1154,7 @@ TYPED_TEST(MasterAllocatorTest, Whitelist)
 
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Future<Nothing> updateWhitelist1;
   EXPECT_CALL(allocator, updateWhitelist(Option<hashset<string>>(hosts)))
@@ -1193,7 +1193,7 @@ TYPED_TEST(MasterAllocatorTest, RoleTest)
 {
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   master::Flags masterFlags = this->CreateMasterFlags();
   masterFlags.roles = Some("role2");
@@ -1286,7 +1286,7 @@ TYPED_TEST(MasterAllocatorTest, FrameworkReregistersFirst)
   {
     TestAllocator<TypeParam> allocator;
 
-    EXPECT_CALL(allocator, initialize(_, _, _, _));
+    EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
     Try<Owned<cluster::Master>> master = this->StartMaster(&allocator);
     ASSERT_SOME(master);
@@ -1343,7 +1343,7 @@ TYPED_TEST(MasterAllocatorTest, FrameworkReregistersFirst)
   {
     TestAllocator<TypeParam> allocator2;
 
-    EXPECT_CALL(allocator2, initialize(_, _, _, _));
+    EXPECT_CALL(allocator2, initialize(_, _, _, _, _));
 
     Future<Nothing> addFramework;
     EXPECT_CALL(allocator2, addFramework(_, _, _))
@@ -1410,7 +1410,7 @@ TYPED_TEST(MasterAllocatorTest, SlaveReregistersFirst)
   {
     TestAllocator<TypeParam> allocator;
 
-    EXPECT_CALL(allocator, initialize(_, _, _, _));
+    EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
     Try<Owned<cluster::Master>> master = this->StartMaster(&allocator);
     ASSERT_SOME(master);
@@ -1466,7 +1466,7 @@ TYPED_TEST(MasterAllocatorTest, SlaveReregistersFirst)
   {
     TestAllocator<TypeParam> allocator2;
 
-    EXPECT_CALL(allocator2, initialize(_, _, _, _));
+    EXPECT_CALL(allocator2, initialize(_, _, _, _, _));
 
     Future<Nothing> addSlave;
     EXPECT_CALL(allocator2, addSlave(_, _, _, _, _))
@@ -1519,7 +1519,7 @@ TYPED_TEST(MasterAllocatorTest, RebalancedForUpdatedWeights)
 
   TestAllocator<TypeParam> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   // Start Mesos master.
   master::Flags masterFlags = this->CreateMasterFlags();

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/master_quota_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_quota_tests.cpp b/src/tests/master_quota_tests.cpp
index b9bc49b..639f4c4 100644
--- a/src/tests/master_quota_tests.cpp
+++ b/src/tests/master_quota_tests.cpp
@@ -399,7 +399,7 @@ TEST_F(MasterQuotaTest, SetExistingQuota)
 TEST_F(MasterQuotaTest, RemoveSingleQuota)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -568,7 +568,7 @@ TEST_F(MasterQuotaTest, Status)
 TEST_F(MasterQuotaTest, InsufficientResourcesSingleAgent)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -630,7 +630,7 @@ TEST_F(MasterQuotaTest, InsufficientResourcesSingleAgent)
 TEST_F(MasterQuotaTest, InsufficientResourcesMultipleAgents)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -707,7 +707,7 @@ TEST_F(MasterQuotaTest, InsufficientResourcesMultipleAgents)
 TEST_F(MasterQuotaTest, AvailableResourcesSingleAgent)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -757,7 +757,7 @@ TEST_F(MasterQuotaTest, AvailableResourcesSingleAgent)
 TEST_F(MasterQuotaTest, AvailableResourcesMultipleAgents)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -826,7 +826,7 @@ TEST_F(MasterQuotaTest, AvailableResourcesMultipleAgents)
 TEST_F(MasterQuotaTest, AvailableResourcesAfterRescinding)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -1041,7 +1041,7 @@ TEST_F(MasterQuotaTest, AvailableResourcesAfterRescinding)
 TEST_F(MasterQuotaTest, NoAuthenticationNoAuthorization)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   // Disable authentication and authorization.
   // TODO(alexr): Setting master `--acls` flag to `ACLs()` or `None()` seems
@@ -1153,7 +1153,7 @@ TEST_F(MasterQuotaTest, UnauthenticatedQuotaRequest)
 TEST_F(MasterQuotaTest, AuthorizeGetUpdateQuotaRequests)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   // Setup ACLs so that only the default principal can modify quotas
   // for `ROLE1` and read status.
@@ -1336,7 +1336,7 @@ TEST_F(MasterQuotaTest, AuthorizeGetUpdateQuotaRequests)
 TEST_F(MasterQuotaTest, AuthorizeSetAndRemoveQuotaRequests)
 {
   TestAllocator<> allocator;
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   // Setup ACLs so that only the default principal can set and see
   // quotas for `ROLE1` and can remove its own quotas.

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/persistent_volume_endpoints_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/persistent_volume_endpoints_tests.cpp b/src/tests/persistent_volume_endpoints_tests.cpp
index 6c85e19..971a7b3 100644
--- a/src/tests/persistent_volume_endpoints_tests.cpp
+++ b/src/tests/persistent_volume_endpoints_tests.cpp
@@ -115,7 +115,7 @@ TEST_F(PersistentVolumeEndpointsTest, StaticReservation)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -209,7 +209,7 @@ TEST_F(PersistentVolumeEndpointsTest, DynamicReservation)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -329,7 +329,7 @@ TEST_F(PersistentVolumeEndpointsTest, DynamicReservationRoleMismatch)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -410,7 +410,7 @@ TEST_F(PersistentVolumeEndpointsTest, UnreserveVolumeResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -475,7 +475,7 @@ TEST_F(PersistentVolumeEndpointsTest, InvalidVolume)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -543,7 +543,7 @@ TEST_F(PersistentVolumeEndpointsTest, VolumeExceedsReservedSize)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -585,7 +585,7 @@ TEST_F(PersistentVolumeEndpointsTest, DeleteNonExistentVolume)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -701,7 +701,7 @@ TEST_F(PersistentVolumeEndpointsTest, NoHeader)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -757,7 +757,7 @@ TEST_F(PersistentVolumeEndpointsTest, BadCredentials)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -833,7 +833,7 @@ TEST_F(PersistentVolumeEndpointsTest, GoodCreateAndDestroyACL)
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -951,7 +951,7 @@ TEST_F(PersistentVolumeEndpointsTest, GoodCreateACLMultipleRoles)
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1036,7 +1036,7 @@ TEST_F(PersistentVolumeEndpointsTest, BadCreateAndDestroyACL)
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1161,7 +1161,7 @@ TEST_F(PersistentVolumeEndpointsTest, BadCreateACLMultipleRoles)
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1251,7 +1251,7 @@ TEST_F(PersistentVolumeEndpointsTest, GoodCreateAndDestroyACLBadCredential)
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1355,7 +1355,7 @@ TEST_F(PersistentVolumeEndpointsTest, NoAuthentication)
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.authenticate_http = false;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1414,7 +1414,7 @@ TEST_F(PersistentVolumeEndpointsTest, NoSlaveId)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -1473,7 +1473,7 @@ TEST_F(PersistentVolumeEndpointsTest, NoVolumes)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -1529,7 +1529,7 @@ TEST_F(PersistentVolumeEndpointsTest, SlavesEndpointFullResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/reservation_endpoints_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_endpoints_tests.cpp b/src/tests/reservation_endpoints_tests.cpp
index 3ee59d5..48c002d 100644
--- a/src/tests/reservation_endpoints_tests.cpp
+++ b/src/tests/reservation_endpoints_tests.cpp
@@ -106,7 +106,7 @@ TEST_F(ReservationEndpointsTest, AvailableResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -203,7 +203,7 @@ TEST_F(ReservationEndpointsTest, ReserveOfferedResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -276,7 +276,7 @@ TEST_F(ReservationEndpointsTest, UnreserveOfferedResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -357,7 +357,7 @@ TEST_F(ReservationEndpointsTest, ReserveAvailableAndOfferedResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   master::Flags masterFlags = CreateMasterFlags();
   // Turn off allocation. We're doing it manually.
@@ -511,7 +511,7 @@ TEST_F(ReservationEndpointsTest, UnreserveAvailableAndOfferedResources)
   // Turn off allocation. We're doing it manually.
   masterFlags.allocation_interval = Seconds(1000);
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -670,7 +670,7 @@ TEST_F(ReservationEndpointsTest, LabeledResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -822,7 +822,7 @@ TEST_F(ReservationEndpointsTest, InvalidResource)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -881,7 +881,7 @@ TEST_F(ReservationEndpointsTest, InsufficientResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -922,7 +922,7 @@ TEST_F(ReservationEndpointsTest, NoHeader)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -971,7 +971,7 @@ TEST_F(ReservationEndpointsTest, BadCredentials)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -1040,7 +1040,7 @@ TEST_F(ReservationEndpointsTest, GoodReserveAndUnreserveACL)
   masterFlags.allocation_interval = Milliseconds(50);
   masterFlags.roles = frameworkInfo.role();
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1102,7 +1102,7 @@ TEST_F(ReservationEndpointsTest, GoodReserveACLMultipleRoles)
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1163,7 +1163,7 @@ TEST_F(ReservationEndpointsTest, BadReserveACL)
   masterFlags.allocation_interval = Milliseconds(50);
   masterFlags.roles = frameworkInfo.role();
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1222,7 +1222,7 @@ TEST_F(ReservationEndpointsTest, BadUnreserveACL)
   masterFlags.allocation_interval = Milliseconds(50);
   masterFlags.roles = frameworkInfo.role();
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1295,7 +1295,7 @@ TEST_F(ReservationEndpointsTest, BadReserveACLMultipleRoles)
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.acls = acls;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1372,7 +1372,7 @@ TEST_F(ReservationEndpointsTest, NoResources)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -1406,7 +1406,7 @@ TEST_F(ReservationEndpointsTest, NonMatchingPrincipal)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);
@@ -1452,7 +1452,7 @@ TEST_F(ReservationEndpointsTest, ReserveAndUnreserveNoAuthentication)
   masterFlags.authenticate_frameworks = false;
   masterFlags.authenticate_http = false;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -1529,7 +1529,7 @@ TEST_F(ReservationEndpointsTest, DifferentPrincipalsSameRole)
 {
   TestAllocator<> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);
   ASSERT_SOME(master);

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/reservation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reservation_tests.cpp b/src/tests/reservation_tests.cpp
index d7e90bc..26bd762 100644
--- a/src/tests/reservation_tests.cpp
+++ b/src/tests/reservation_tests.cpp
@@ -517,7 +517,7 @@ TEST_F(ReservationTest, DropReserveTooLarge)
   masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);
@@ -607,7 +607,7 @@ TEST_F(ReservationTest, DropReserveStaticReservation)
   masterFlags.allocation_interval = Milliseconds(5);
   masterFlags.roles = frameworkInfo.role();
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator, masterFlags);
   ASSERT_SOME(master);

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/resource_offers_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/resource_offers_tests.cpp b/src/tests/resource_offers_tests.cpp
index 046adae..6f93cb6 100644
--- a/src/tests/resource_offers_tests.cpp
+++ b/src/tests/resource_offers_tests.cpp
@@ -288,7 +288,7 @@ TEST_F(ResourceOffersTest, Request)
 {
   TestAllocator<master::allocator::HierarchicalDRFAllocator> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _))
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _))
     .Times(1);
 
   Try<Owned<cluster::Master>> master = StartMaster(&allocator);

http://git-wip-us.apache.org/repos/asf/mesos/blob/32c7bb53/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index e6e7b8e..8e9254a 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -2849,7 +2849,7 @@ TYPED_TEST(SlaveRecoveryTest, ReconcileTasksMissingFromSlave)
 {
   TestAllocator<master::allocator::HierarchicalDRFAllocator> allocator;
 
-  EXPECT_CALL(allocator, initialize(_, _, _, _));
+  EXPECT_CALL(allocator, initialize(_, _, _, _, _));
 
   Try<Owned<cluster::Master>> master = this->StartMaster(&allocator);
   ASSERT_SOME(master);


[4/5] mesos git commit: Implement fairness exclusion: initialize the sorter.

Posted by bm...@apache.org.
Implement fairness exclusion: initialize the sorter.

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


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

Branch: refs/heads/master
Commit: c67b2a1721d0ac3c2b90791e5450806b37c598b2
Parents: 38618b0
Author: Guangya Liu <gy...@gmail.com>
Authored: Thu Jun 30 16:39:41 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Jun 30 17:44:21 2016 -0700

----------------------------------------------------------------------
 src/master/allocator/mesos/hierarchical.cpp |  3 +++
 src/master/allocator/sorter/drf/sorter.cpp  | 17 +++++++++--------
 src/master/allocator/sorter/drf/sorter.hpp  |  8 ++++----
 src/master/allocator/sorter/sorter.hpp      |  9 ++++-----
 4 files changed, 20 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c67b2a17/src/master/allocator/mesos/hierarchical.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index 20f9e72..3838123 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -142,7 +142,9 @@ void HierarchicalAllocatorProcess::initialize(
   // non-quota'ed roles, hence a dedicated sorter for quota'ed roles is
   // necessary.
   roleSorter.reset(roleSorterFactory());
+  roleSorter->initialize(fairnessExcludeResourceNames);
   quotaRoleSorter.reset(quotaRoleSorterFactory());
+  quotaRoleSorter->initialize(fairnessExcludeResourceNames);
 
   VLOG(1) << "Initialized hierarchical allocator process";
 
@@ -229,6 +231,7 @@ void HierarchicalAllocatorProcess::addFramework(
     activeRoles[role] = 1;
     roleSorter->add(role, roleWeight(role));
     frameworkSorters[role].reset(frameworkSorterFactory());
+    frameworkSorters[role]->initialize(fairnessExcludeResourceNames);
     metrics.addRole(role);
   } else {
     activeRoles[role]++;

http://git-wip-us.apache.org/repos/asf/mesos/blob/c67b2a17/src/master/allocator/sorter/drf/sorter.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/sorter/drf/sorter.cpp b/src/master/allocator/sorter/drf/sorter.cpp
index c5a7ec1..967290d 100644
--- a/src/master/allocator/sorter/drf/sorter.cpp
+++ b/src/master/allocator/sorter/drf/sorter.cpp
@@ -61,6 +61,13 @@ DRFSorter::DRFSorter(
   : metrics(Metrics(allocator, *this, metricsPrefix)) {}
 
 
+void DRFSorter::initialize(
+    const Option<set<string>>& _fairnessExcludeResourceNames)
+{
+  fairnessExcludeResourceNames = _fairnessExcludeResourceNames;
+}
+
+
 void DRFSorter::add(const string& name, double weight)
 {
   CHECK(!contains(name));
@@ -409,9 +416,9 @@ double DRFSorter::calculateShare(const string& name)
   // scalars.
 
   foreach (const string& scalar, total_.scalarQuantities.names()) {
-    // Filter out the exclude resource names.
+    // Filter out the resources excluded from fair sharing.
     if (fairnessExcludeResourceNames.isSome() &&
-        fairnessExcludeResourceNames.get().count(scalar)) {
+        fairnessExcludeResourceNames->count(scalar) > 0) {
       continue;
     }
 
@@ -453,12 +460,6 @@ double DRFSorter::calculateShare(const string& name)
 }
 
 
-void DRFSorter::initialize(
-    const Option<set<std::string>>& _fairnessExcludeResourceNames) {
-  fairnessExcludeResourceNames = _fairnessExcludeResourceNames;
-}
-
-
 set<Client, DRFComparator>::iterator DRFSorter::find(const string& name)
 {
   set<Client, DRFComparator>::iterator it;

http://git-wip-us.apache.org/repos/asf/mesos/blob/c67b2a17/src/master/allocator/sorter/drf/sorter.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/sorter/drf/sorter.hpp b/src/master/allocator/sorter/drf/sorter.hpp
index a40a995..0aa1a71 100644
--- a/src/master/allocator/sorter/drf/sorter.hpp
+++ b/src/master/allocator/sorter/drf/sorter.hpp
@@ -73,6 +73,9 @@ public:
 
   virtual ~DRFSorter() {}
 
+  virtual void initialize(
+      const Option<std::set<std::string>>& fairnessExcludeResourceNames);
+
   virtual void add(const std::string& name, double weight = 1);
 
   virtual void update(const std::string& name, double weight);
@@ -124,9 +127,6 @@ public:
 
   virtual int count();
 
-  virtual void initialize(
-      const Option<std::set<std::string>>& fairnessExcludeResourceNames);
-
 private:
   // Recalculates the share for the client and moves
   // it in 'clients' accordingly.
@@ -135,7 +135,7 @@ private:
   // Returns the dominant resource share for the client.
   double calculateShare(const std::string& name);
 
-  // Resource names that will be ignored by `calculateShare()`.
+  // Resources (by name) that will be excluded from fair sharing.
   Option<std::set<std::string>> fairnessExcludeResourceNames;
 
   // Returns an iterator to the specified client, if

http://git-wip-us.apache.org/repos/asf/mesos/blob/c67b2a17/src/master/allocator/sorter/sorter.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/sorter/sorter.hpp b/src/master/allocator/sorter/sorter.hpp
index a2a053b..5ce6bb8 100644
--- a/src/master/allocator/sorter/sorter.hpp
+++ b/src/master/allocator/sorter/sorter.hpp
@@ -52,6 +52,10 @@ public:
 
   virtual ~Sorter() = default;
 
+  // Initialize the sorter.
+  virtual void initialize(
+      const Option<std::set<std::string>>& fairnessExcludeResourceNames) = 0;
+
   // Adds a client to allocate resources to. A client
   // may be a user or a framework.
   virtual void add(const std::string& client, double weight = 1) = 0;
@@ -141,11 +145,6 @@ public:
   // Returns the number of clients this Sorter contains,
   // either active or deactivated.
   virtual int count() = 0;
-
-  // Initialize resource names that will be ignored by sorter when
-  // calculating dominant share for frameworks or roles.
-  virtual void initialize(
-      const Option<std::set<std::string>>& fairnessExcludeResourceNames) = 0;
 };
 
 } // namespace allocator {


[3/5] mesos git commit: Added a flag for excluding resources from fair sharing.

Posted by bm...@apache.org.
Added a flag for excluding resources from fair sharing.

The intention of this flag is for the operator to specify
resources types (e.g. "cpus", "mem", "gpus", etc) that should
not be fairly shared.

The implementation of will not count the specified resources
towards a role's share of the cluster. This may be useful in
cases where our fair sharing implementation currently has
limitations. E.g. See the problem of "scarce" resources:

http://www.mail-archive.com/dev@mesos.apache.org/msg35631.html
https://issues.apache.org/jira/browse/MESOS-5377

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


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

Branch: refs/heads/master
Commit: c9f59ae6c354d67b3a44dd875b3ca2cf6eb6b4be
Parents: 1f47583
Author: Guangya Liu <gy...@gmail.com>
Authored: Thu Jun 30 13:51:24 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Jun 30 17:44:21 2016 -0700

----------------------------------------------------------------------
 src/master/flags.cpp | 10 ++++++++++
 src/master/flags.hpp |  1 +
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c9f59ae6/src/master/flags.cpp
----------------------------------------------------------------------
diff --git a/src/master/flags.cpp b/src/master/flags.cpp
index b6b1603..ca3e80b 100644
--- a/src/master/flags.cpp
+++ b/src/master/flags.cpp
@@ -431,6 +431,16 @@ mesos::internal::master::Flags::Flags()
       "load an alternate allocator module using `--modules`.",
       DEFAULT_ALLOCATOR);
 
+  add(&Flags::fair_sharing_excluded_resource_names,
+      "fair_sharing_excluded_resource_names",
+      "A comma-separated list of the resource names (e.g. 'gpus')\n"
+      "that will be excluded from fair sharing constraints.\n"
+      "This may be useful in cases where the fair sharing\n"
+      "implementation currently has limitations. E.g. See the\n"
+      "problem of \"scarce\" resources:\n"
+      "  http://www.mail-archive.com/dev@mesos.apache.org/msg35631.html\n"
+      "  https://issues.apache.org/jira/browse/MESOS-5377");
+
   add(&Flags::hooks,
       "hooks",
       "A comma-separated list of hook modules to be\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/c9f59ae6/src/master/flags.hpp
----------------------------------------------------------------------
diff --git a/src/master/flags.hpp b/src/master/flags.hpp
index 735367f..a5dd11b 100644
--- a/src/master/flags.hpp
+++ b/src/master/flags.hpp
@@ -77,6 +77,7 @@ public:
   Option<std::string> modulesDir;
   std::string authenticators;
   std::string allocator;
+  Option<std::set<std::string>> fair_sharing_excluded_resource_names;
   Option<std::string> hooks;
   Duration agent_ping_timeout;
   size_t max_agent_ping_timeouts;


[2/5] mesos git commit: Implement fairness exclusion: Updated sorter.

Posted by bm...@apache.org.
Implement fairness exclusion: Updated sorter.

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


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

Branch: refs/heads/master
Commit: 38618b0c4f038b159e1963cfde5cf448d56806f7
Parents: 32c7bb5
Author: Guangya Liu <gy...@gmail.com>
Authored: Thu Jun 30 16:32:08 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Jun 30 17:44:21 2016 -0700

----------------------------------------------------------------------
 src/master/allocator/sorter/drf/sorter.cpp | 12 ++++++++++++
 src/master/allocator/sorter/drf/sorter.hpp |  6 ++++++
 src/master/allocator/sorter/sorter.hpp     |  5 +++++
 3 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/38618b0c/src/master/allocator/sorter/drf/sorter.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/sorter/drf/sorter.cpp b/src/master/allocator/sorter/drf/sorter.cpp
index 27d56f2..c5a7ec1 100644
--- a/src/master/allocator/sorter/drf/sorter.cpp
+++ b/src/master/allocator/sorter/drf/sorter.cpp
@@ -409,6 +409,12 @@ double DRFSorter::calculateShare(const string& name)
   // scalars.
 
   foreach (const string& scalar, total_.scalarQuantities.names()) {
+    // Filter out the exclude resource names.
+    if (fairnessExcludeResourceNames.isSome() &&
+        fairnessExcludeResourceNames.get().count(scalar)) {
+      continue;
+    }
+
     // We collect the scalar accumulated total value from the
     // `Resources` object.
     //
@@ -447,6 +453,12 @@ double DRFSorter::calculateShare(const string& name)
 }
 
 
+void DRFSorter::initialize(
+    const Option<set<std::string>>& _fairnessExcludeResourceNames) {
+  fairnessExcludeResourceNames = _fairnessExcludeResourceNames;
+}
+
+
 set<Client, DRFComparator>::iterator DRFSorter::find(const string& name)
 {
   set<Client, DRFComparator>::iterator it;

http://git-wip-us.apache.org/repos/asf/mesos/blob/38618b0c/src/master/allocator/sorter/drf/sorter.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/sorter/drf/sorter.hpp b/src/master/allocator/sorter/drf/sorter.hpp
index 35273b5..a40a995 100644
--- a/src/master/allocator/sorter/drf/sorter.hpp
+++ b/src/master/allocator/sorter/drf/sorter.hpp
@@ -124,6 +124,9 @@ public:
 
   virtual int count();
 
+  virtual void initialize(
+      const Option<std::set<std::string>>& fairnessExcludeResourceNames);
+
 private:
   // Recalculates the share for the client and moves
   // it in 'clients' accordingly.
@@ -132,6 +135,9 @@ private:
   // Returns the dominant resource share for the client.
   double calculateShare(const std::string& name);
 
+  // Resource names that will be ignored by `calculateShare()`.
+  Option<std::set<std::string>> fairnessExcludeResourceNames;
+
   // Returns an iterator to the specified client, if
   // it exists in this Sorter.
   std::set<Client, DRFComparator>::iterator find(const std::string& name);

http://git-wip-us.apache.org/repos/asf/mesos/blob/38618b0c/src/master/allocator/sorter/sorter.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/sorter/sorter.hpp b/src/master/allocator/sorter/sorter.hpp
index 68a2f56..a2a053b 100644
--- a/src/master/allocator/sorter/sorter.hpp
+++ b/src/master/allocator/sorter/sorter.hpp
@@ -141,6 +141,11 @@ public:
   // Returns the number of clients this Sorter contains,
   // either active or deactivated.
   virtual int count() = 0;
+
+  // Initialize resource names that will be ignored by sorter when
+  // calculating dominant share for frameworks or roles.
+  virtual void initialize(
+      const Option<std::set<std::string>>& fairnessExcludeResourceNames) = 0;
 };
 
 } // namespace allocator {