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 2017/12/19 05:40:54 UTC

[1/3] mesos git commit: Added a test to ensure the amount of quota headroom is sufficient.

Repository: mesos
Updated Branches:
  refs/heads/master 454e7f2b7 -> cc3ee7aad


Added a test to ensure the amount of quota headroom is sufficient.

This test verifies that quota headroom is correctly maintained
when some roles have more reservations than their quota. We need
to ensure that one role's excessive reservation is not counted
towards another role's quota headroom.

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


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

Branch: refs/heads/master
Commit: 044fce508993c118c3fd52e9b8bc3a5472ea7734
Parents: c9933c5
Author: Meng Zhu <mz...@mesosphere.io>
Authored: Mon Dec 18 20:24:49 2017 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Dec 18 21:15:30 2017 -0800

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/044fce50/src/tests/hierarchical_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp
index 4127d05..173e4fb 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -1757,6 +1757,100 @@ TEST_F(HierarchicalAllocatorTest, Reservations)
 }
 
 
+// This test verifies that quota headroom is correctly maintained when some
+// roles have more reservations than their quotas.
+TEST_P(HierarchicalAllocatorTestWithReservations,
+  QuotaHeadroomWhenReservationsExceedQuota)
+{
+  Clock::pause();
+  initialize();
+
+  // We start with two roles `QUOTA_ROLE_W_RESERVATION` and
+  // `QUOTA_ROLE_NO_RESERVATION` with the same quota (cpus:1;mem:1024) set.
+  // `QUOTA_ROLE_W_RESERVATION` will also have reservations twice of its quota.
+  // Thus we have its reservation amount equals to the combined quota of both
+  // roles.
+  const string QUOTA_ROLE_W_RESERVATION{"quota-role-w-reservation"};
+  const string QUOTA_ROLE_NO_RESERVATION{"quota-role-no-reservation"};
+  const string NON_QUOTA_ROLE{"non-quota-role"};
+
+  const Quota quota1 =
+    createQuota(QUOTA_ROLE_W_RESERVATION, "cpus:1;mem:1024");
+  allocator->setQuota(QUOTA_ROLE_W_RESERVATION, quota1);
+
+  const Quota quota2 =
+    createQuota(QUOTA_ROLE_NO_RESERVATION, "cpus:1;mem:1024");
+  allocator->setQuota(QUOTA_ROLE_NO_RESERVATION, quota2);
+
+  // Add `agent1` with reserved resources for `QUOTA_ROLE_W_RESERVATION`.
+  Resource::ReservationInfo reservation;
+  reservation.set_type(GetParam());
+  reservation.set_role(QUOTA_ROLE_W_RESERVATION);
+
+  Resources reserved = Resources::parse("cpus:2;mem:2048").get();
+  reserved = reserved.pushReservation(reservation);
+
+  SlaveInfo agent1 = createSlaveInfo(reserved);
+  allocator->addSlave(
+      agent1.id(),
+      agent1,
+      AGENT_CAPABILITIES(),
+      None(),
+      agent1.resources(),
+      {});
+
+  // No quota headroom needed for `QUOTA_ROLE_W_RESERVATION`.
+  // (cpus:1;mem:1024) quota headroom needed for `QUOTA_ROLE_NO_RESERVATION`.
+  // Combined quota headroom: (cpus:1;mem:1024)
+
+  // No allocation will happen because there are no frameworks.
+
+  // Add `agent2` with unreserved resources.
+  SlaveInfo agent2 = createSlaveInfo("cpus:1;mem:1024");
+  allocator->addSlave(
+      agent2.id(),
+      agent2,
+      AGENT_CAPABILITIES(),
+      None(),
+      agent2.resources(),
+      {});
+
+  // Add `framework` under `NON_QUOTA_ROLE`.
+  // This will trigger a batch allocation.
+  FrameworkInfo framework = createFrameworkInfo({NON_QUOTA_ROLE});
+  allocator->addFramework(framework.id(), framework, {}, true, {});
+
+  Clock::settle();
+
+  // No allocation should happen because resources on agent2 are
+  // set aside for the quota headroom.
+  Future<Allocation> allocation = allocations.get();
+  EXPECT_TRUE(allocation.isPending());
+
+  // Add `agent3` with unreserved resources.
+  // This will trigger an event-driven allocation loop for agent3.
+  SlaveInfo agent3 = createSlaveInfo("cpus:1;mem:1024");
+  allocator->addSlave(
+      agent3.id(),
+      agent3,
+      AGENT_CAPABILITIES(),
+      None(),
+      agent3.resources(),
+      {});
+
+  Clock::settle();
+
+  // All resources on `agent3` are allocated to `framework` because
+  // it is the only framework and quota headroom has been met by `agent1`
+  // and `agent2`.
+  Allocation expected = Allocation(
+      framework.id(),
+      {{NON_QUOTA_ROLE, {{agent3.id(), agent3.resources()}}}});
+
+  AWAIT_EXPECT_EQ(expected, allocation);
+}
+
+
 // Checks that recovered resources are re-allocated correctly.
 TEST_F(HierarchicalAllocatorTest, RecoverResources)
 {


[2/3] mesos git commit: Fixed a bug where insufficient headroom is held for quota.

Posted by bm...@apache.org.
Fixed a bug where insufficient headroom is held for quota.

If a role has more reservation than its quota, the current quota
headroom calculation is insufficient in guaranteeing quota
allocation. See MESOS-8339.

This patch fixes the issue by computing the amount of unreserved
resources we need to hold back such that each quota role can have
its quota satisfied. Previously, we included the quota role
unallocated reservations as part of the headroom since we knew it
would be held back, but we didn't handle the case that a quota role
had more reservations than quota.

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


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

Branch: refs/heads/master
Commit: c9933c5a5efc2202bd2f346f2b0861aa02853922
Parents: 454e7f2
Author: Meng Zhu <mz...@mesosphere.io>
Authored: Mon Dec 18 19:40:59 2017 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Dec 18 21:15:30 2017 -0800

----------------------------------------------------------------------
 src/master/allocator/mesos/hierarchical.cpp | 79 +++++++++++++-----------
 1 file changed, 43 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c9933c5a/src/master/allocator/mesos/hierarchical.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index 2cabafe..1c767f7 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -1821,41 +1821,51 @@ void HierarchicalAllocatorProcess::__allocate()
 
   // Frameworks in a quota'ed role may temporarily reject resources by
   // filtering or suppressing offers. Hence, quotas may not be fully
-  // allocated and if so we need to hold back some headroom to ensure
-  // the quota can later be satisfied when needed.
+  // allocated and if so we need to hold back enough unreserved
+  // resources to ensure the quota can later be satisfied when needed:
+  //
+  //   Required unreserved headroom =
+  //     sum (unsatisfied quota(r) - unallocated reservations(r))
+  //       for each quota role r
+  //
+  // Given the above, if a role has more reservations than quota,
+  // we don't need to hold back any unreserved headroom for it.
   Resources requiredHeadroom;
   foreachpair (const string& role, const Quota& quota, quotas) {
-    // Compute the amount of quota that the role does not have allocated.
-    //
     // NOTE: Revocable resources are excluded in `quotaRoleSorter`.
     // NOTE: Only scalars are considered for quota.
+    // NOTE: The following should all be quantities with no meta-data!
     Resources allocated = getQuotaRoleAllocatedResources(role);
-    const Resources required = quota.info.guarantee();
-    requiredHeadroom += (required - allocated);
+    const Resources guarantee = quota.info.guarantee();
+
+    if (allocated.contains(guarantee)) {
+      continue; // Quota already satisifed.
+    }
+
+    Resources unallocated = guarantee - allocated;
+
+    Resources unallocatedReservations =
+      reservationScalarQuantities.get(role).getOrElse(Resources()) -
+      allocatedReservationScalarQuantities.get(role).getOrElse(Resources());
+
+    requiredHeadroom += unallocated - unallocatedReservations;
   }
 
-  // The amount of headroom currently available consists of
-  // unallocated resources that can be allocated to satisfy quota.
-  // What that means is that the resources need to be:
-  //
-  //   (1) Non-revocable
-  //   (2) Unreserved, or reserved to a quota role.
+  // We will allocate resources while ensuring that the required
+  // unreserved non-revocable headroom is still available. Otherwise,
+  // we will not be able to satisfy quota later. Reservations to
+  // non-quota roles and revocable resources will always be included
+  // in the offers since these are not part of the headroom (and
+  // therefore can't be used to satisfy quota).
   //
-  // TODO(bmahler): Note that we currently do not consider quota
-  // headroom on an per-role basis, which means we may not hold
-  // back sufficient headroom for a particular quota role if some
-  // other quota roles have more reservations than quota.
-  // See MESOS-8339.
+  //   available headroom = unallocated unreserved non-revocable resources
   //
-  // We will allocate resources while ensuring that the required
-  // headroom is still available. Otherwise we will not be able
-  // to satisfy quota later. Reservations to non-quota roles and
-  // revocable resources will always be included in the offers
-  // since these are not part of the available headroom for quota.
+  // We compute this as:
   //
-  //  available headroom = unallocated resources -
-  //                       unallocated non-quota role reservations -
-  //                       unallocated revocable resources
+  //   available headroom = total resources -
+  //                        allocated resources -
+  //                        unallocated reservations -
+  //                        unallocated revocable resources
 
   // NOTE: `totalScalarQuantities` omits dynamic reservation,
   // persistent volume info, and allocation info. We additionally
@@ -1872,31 +1882,28 @@ void HierarchicalAllocatorProcess::__allocate()
       roleSorter->allocationScalarQuantities(role).toUnreserved();
   }
 
-  // Subtract non quota role reservations.
+  // Subtract all unallocated reservations.
   foreachkey (const string& role, reservationScalarQuantities) {
-    if (quotas.contains(role)) {
-      continue; // Skip quota roles.
-    }
-
     hashmap<SlaveID, Resources> allocations;
-    if (roleSorter->contains(role)) {
+    if (quotaRoleSorter->contains(role)) {
+      allocations = quotaRoleSorter->allocation(role);
+    } else if (roleSorter->contains(role)) {
       allocations = roleSorter->allocation(role);
     }
 
-    Resources unallocatedNonQuotaRoleReservations =
+    Resources unallocatedReservations =
       reservationScalarQuantities.get(role).getOrElse(Resources());
 
     foreachvalue (const Resources& resources, allocations) {
       // NOTE: `totalScalarQuantities` omits dynamic reservation,
       // persistent volume info, and allocation info. We additionally
       // remove the static reservations here via `toUnreserved()`.
-      unallocatedNonQuotaRoleReservations -=
+      unallocatedReservations -=
         resources.reserved().createStrippedScalarQuantity().toUnreserved();
     }
 
-    // Subtract the unallocated reservations for this non quota
-    // role from the headroom.
-    availableHeadroom -= unallocatedNonQuotaRoleReservations;
+    // Subtract the unallocated reservations for this role from the headroom.
+    availableHeadroom -= unallocatedReservations;
   }
 
   // Subtract revocable resources.


Re: [3/3] mesos git commit: Fixed the volume profile related build breakage.

Posted by Jie Yu <yu...@gmail.com>.
Chun is working on a cleanup, see my comments in this review:
https://reviews.apache.org/r/64659/

- Jie

On Tue, Dec 19, 2017 at 11:16 AM, Benjamin Mahler <bm...@apache.org>
wrote:

> +joseph
>
> Chun and I wrote a fix for this last night to unbreak the build, please
> take a look and adjust if this isn't the right approach. One thing I
> noticed was that slave.hpp doesn't need to include the volume_profile.hpp
> header (it can forward declare), might want to move the include to .cpp to
> help compile times?
>
> On Mon, Dec 18, 2017 at 9:40 PM, <bm...@apache.org> wrote:
>
>> Fixed the volume profile related build breakage.
>>
>> Due to some lacking ifdef guards around GRPC being enabled,
>> the build broke for those that don't enable GRPC.
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/cc3ee7aa
>> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/cc3ee7aa
>> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/cc3ee7aa
>>
>> Branch: refs/heads/master
>> Commit: cc3ee7aad3bee10dc4130ab2b39b89dddea8f4bb
>> Parents: 044fce5
>> Author: Benjamin Mahler <bm...@apache.org>
>> Authored: Mon Dec 18 21:40:03 2017 -0800
>> Committer: Benjamin Mahler <bm...@apache.org>
>> Committed: Mon Dec 18 21:40:03 2017 -0800
>>
>> ----------------------------------------------------------------------
>>  src/Makefile.am     | 8 ++++----
>>  src/slave/slave.cpp | 2 ++
>>  src/slave/slave.hpp | 4 ++++
>>  3 files changed, 10 insertions(+), 4 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/s
>> rc/Makefile.am
>> ----------------------------------------------------------------------
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index c004004..4623cfc 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -2447,8 +2447,6 @@ noinst_LTLIBRARIES += $(MESOS_TEST_MODULES)
>>  endif
>>
>>  mesos_tests_SOURCES =                                          \
>> -  csi/uri_volume_profile.pb.cc                                 \
>> -  resource_provider/uri_volume_profile.cpp                     \
>>    slave/qos_controllers/load.cpp                               \
>>    tests/active_user_test_helper.cpp                            \
>>    tests/agent_container_api_tests.cpp                          \
>> @@ -2545,7 +2543,6 @@ mesos_tests_SOURCES =
>>                \
>>    tests/uri_fetcher_tests.cpp                                  \
>>    tests/utils.cpp                                              \
>>    tests/values_tests.cpp                                       \
>> -  tests/volume_profile_tests.cpp                               \
>>    tests/zookeeper_url_tests.cpp                                        \
>>    tests/common/command_utils_tests.cpp                         \
>>    tests/common/http_tests.cpp                                  \
>> @@ -2647,9 +2644,12 @@ endif
>>
>>  if ENABLE_GRPC
>>  mesos_tests_SOURCES +=                                         \
>> +  csi/uri_volume_profile.pb.cc                                 \
>> +  resource_provider/uri_volume_profile.cpp                     \
>>    tests/csi_client_tests.cpp                                   \
>>    tests/mock_csi_plugin.cpp                                    \
>> -  tests/mock_csi_plugin.hpp
>> +  tests/mock_csi_plugin.hpp                                    \
>> +  tests/volume_profile_tests.cpp
>>
>>  if OS_LINUX
>>  mesos_tests_SOURCES +=                                         \
>>
>> http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/s
>> rc/slave/slave.cpp
>> ----------------------------------------------------------------------
>> diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
>> index 2dfbdeb..580ad19 100644
>> --- a/src/slave/slave.cpp
>> +++ b/src/slave/slave.cpp
>> @@ -419,6 +419,7 @@ void Slave::initialize()
>>        << mkdir.error();
>>    }
>>
>> +#ifdef ENABLE_GRPC
>>    // Create the VolumeProfileAdaptor module and set it globally so
>>    // any component that needs the module can share this instance.
>>    Try<VolumeProfileAdaptor*> _volumeProfileAdaptor =
>> @@ -434,6 +435,7 @@ void Slave::initialize()
>>      shared_ptr<VolumeProfileAdaptor>(_volumeProfileAdaptor.get());
>>
>>    VolumeProfileAdaptor::setAdaptor(volumeProfileAdaptor);
>> +#endif
>>
>>    string scheme = "http";
>>
>>
>> http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/s
>> rc/slave/slave.hpp
>> ----------------------------------------------------------------------
>> diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
>> index 52759b1..c1322a3 100644
>> --- a/src/slave/slave.hpp
>> +++ b/src/slave/slave.hpp
>> @@ -40,7 +40,9 @@
>>
>>  #include <mesos/module/authenticatee.hpp>
>>
>> +#ifdef ENABLE_GRPC
>>  #include <mesos/resource_provider/volume_profile.hpp>
>> +#endif
>>
>>  #include <mesos/slave/containerizer.hpp>
>>  #include <mesos/slave/qos_controller.hpp>
>> @@ -726,7 +728,9 @@ private:
>>
>>    mesos::slave::QoSController* qosController;
>>
>> +#ifdef ENABLE_GRPC
>>    std::shared_ptr<VolumeProfileAdaptor> volumeProfileAdaptor;
>> +#endif
>>
>>    mesos::SecretGenerator* secretGenerator;
>>
>>
>>
>

Re: [3/3] mesos git commit: Fixed the volume profile related build breakage.

Posted by Benjamin Mahler <bm...@apache.org>.
+joseph

Chun and I wrote a fix for this last night to unbreak the build, please
take a look and adjust if this isn't the right approach. One thing I
noticed was that slave.hpp doesn't need to include the volume_profile.hpp
header (it can forward declare), might want to move the include to .cpp to
help compile times?

On Mon, Dec 18, 2017 at 9:40 PM, <bm...@apache.org> wrote:

> Fixed the volume profile related build breakage.
>
> Due to some lacking ifdef guards around GRPC being enabled,
> the build broke for those that don't enable GRPC.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
> Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/cc3ee7aa
> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/cc3ee7aa
> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/cc3ee7aa
>
> Branch: refs/heads/master
> Commit: cc3ee7aad3bee10dc4130ab2b39b89dddea8f4bb
> Parents: 044fce5
> Author: Benjamin Mahler <bm...@apache.org>
> Authored: Mon Dec 18 21:40:03 2017 -0800
> Committer: Benjamin Mahler <bm...@apache.org>
> Committed: Mon Dec 18 21:40:03 2017 -0800
>
> ----------------------------------------------------------------------
>  src/Makefile.am     | 8 ++++----
>  src/slave/slave.cpp | 2 ++
>  src/slave/slave.hpp | 4 ++++
>  3 files changed, 10 insertions(+), 4 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/src/Makefile.am
> ----------------------------------------------------------------------
> diff --git a/src/Makefile.am b/src/Makefile.am
> index c004004..4623cfc 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -2447,8 +2447,6 @@ noinst_LTLIBRARIES += $(MESOS_TEST_MODULES)
>  endif
>
>  mesos_tests_SOURCES =                                          \
> -  csi/uri_volume_profile.pb.cc                                 \
> -  resource_provider/uri_volume_profile.cpp                     \
>    slave/qos_controllers/load.cpp                               \
>    tests/active_user_test_helper.cpp                            \
>    tests/agent_container_api_tests.cpp                          \
> @@ -2545,7 +2543,6 @@ mesos_tests_SOURCES =
>              \
>    tests/uri_fetcher_tests.cpp                                  \
>    tests/utils.cpp                                              \
>    tests/values_tests.cpp                                       \
> -  tests/volume_profile_tests.cpp                               \
>    tests/zookeeper_url_tests.cpp                                        \
>    tests/common/command_utils_tests.cpp                         \
>    tests/common/http_tests.cpp                                  \
> @@ -2647,9 +2644,12 @@ endif
>
>  if ENABLE_GRPC
>  mesos_tests_SOURCES +=                                         \
> +  csi/uri_volume_profile.pb.cc                                 \
> +  resource_provider/uri_volume_profile.cpp                     \
>    tests/csi_client_tests.cpp                                   \
>    tests/mock_csi_plugin.cpp                                    \
> -  tests/mock_csi_plugin.hpp
> +  tests/mock_csi_plugin.hpp                                    \
> +  tests/volume_profile_tests.cpp
>
>  if OS_LINUX
>  mesos_tests_SOURCES +=                                         \
>
> http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/
> src/slave/slave.cpp
> ----------------------------------------------------------------------
> diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
> index 2dfbdeb..580ad19 100644
> --- a/src/slave/slave.cpp
> +++ b/src/slave/slave.cpp
> @@ -419,6 +419,7 @@ void Slave::initialize()
>        << mkdir.error();
>    }
>
> +#ifdef ENABLE_GRPC
>    // Create the VolumeProfileAdaptor module and set it globally so
>    // any component that needs the module can share this instance.
>    Try<VolumeProfileAdaptor*> _volumeProfileAdaptor =
> @@ -434,6 +435,7 @@ void Slave::initialize()
>      shared_ptr<VolumeProfileAdaptor>(_volumeProfileAdaptor.get());
>
>    VolumeProfileAdaptor::setAdaptor(volumeProfileAdaptor);
> +#endif
>
>    string scheme = "http";
>
>
> http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/
> src/slave/slave.hpp
> ----------------------------------------------------------------------
> diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
> index 52759b1..c1322a3 100644
> --- a/src/slave/slave.hpp
> +++ b/src/slave/slave.hpp
> @@ -40,7 +40,9 @@
>
>  #include <mesos/module/authenticatee.hpp>
>
> +#ifdef ENABLE_GRPC
>  #include <mesos/resource_provider/volume_profile.hpp>
> +#endif
>
>  #include <mesos/slave/containerizer.hpp>
>  #include <mesos/slave/qos_controller.hpp>
> @@ -726,7 +728,9 @@ private:
>
>    mesos::slave::QoSController* qosController;
>
> +#ifdef ENABLE_GRPC
>    std::shared_ptr<VolumeProfileAdaptor> volumeProfileAdaptor;
> +#endif
>
>    mesos::SecretGenerator* secretGenerator;
>
>
>

[3/3] mesos git commit: Fixed the volume profile related build breakage.

Posted by bm...@apache.org.
Fixed the volume profile related build breakage.

Due to some lacking ifdef guards around GRPC being enabled,
the build broke for those that don't enable GRPC.


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

Branch: refs/heads/master
Commit: cc3ee7aad3bee10dc4130ab2b39b89dddea8f4bb
Parents: 044fce5
Author: Benjamin Mahler <bm...@apache.org>
Authored: Mon Dec 18 21:40:03 2017 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Dec 18 21:40:03 2017 -0800

----------------------------------------------------------------------
 src/Makefile.am     | 8 ++++----
 src/slave/slave.cpp | 2 ++
 src/slave/slave.hpp | 4 ++++
 3 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index c004004..4623cfc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2447,8 +2447,6 @@ noinst_LTLIBRARIES += $(MESOS_TEST_MODULES)
 endif
 
 mesos_tests_SOURCES =						\
-  csi/uri_volume_profile.pb.cc					\
-  resource_provider/uri_volume_profile.cpp			\
   slave/qos_controllers/load.cpp				\
   tests/active_user_test_helper.cpp				\
   tests/agent_container_api_tests.cpp				\
@@ -2545,7 +2543,6 @@ mesos_tests_SOURCES =						\
   tests/uri_fetcher_tests.cpp					\
   tests/utils.cpp						\
   tests/values_tests.cpp					\
-  tests/volume_profile_tests.cpp				\
   tests/zookeeper_url_tests.cpp					\
   tests/common/command_utils_tests.cpp				\
   tests/common/http_tests.cpp					\
@@ -2647,9 +2644,12 @@ endif
 
 if ENABLE_GRPC
 mesos_tests_SOURCES +=						\
+  csi/uri_volume_profile.pb.cc					\
+  resource_provider/uri_volume_profile.cpp			\
   tests/csi_client_tests.cpp					\
   tests/mock_csi_plugin.cpp					\
-  tests/mock_csi_plugin.hpp
+  tests/mock_csi_plugin.hpp					\
+  tests/volume_profile_tests.cpp
 
 if OS_LINUX
 mesos_tests_SOURCES +=						\

http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 2dfbdeb..580ad19 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -419,6 +419,7 @@ void Slave::initialize()
       << mkdir.error();
   }
 
+#ifdef ENABLE_GRPC
   // Create the VolumeProfileAdaptor module and set it globally so
   // any component that needs the module can share this instance.
   Try<VolumeProfileAdaptor*> _volumeProfileAdaptor =
@@ -434,6 +435,7 @@ void Slave::initialize()
     shared_ptr<VolumeProfileAdaptor>(_volumeProfileAdaptor.get());
 
   VolumeProfileAdaptor::setAdaptor(volumeProfileAdaptor);
+#endif
 
   string scheme = "http";
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/cc3ee7aa/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 52759b1..c1322a3 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -40,7 +40,9 @@
 
 #include <mesos/module/authenticatee.hpp>
 
+#ifdef ENABLE_GRPC
 #include <mesos/resource_provider/volume_profile.hpp>
+#endif
 
 #include <mesos/slave/containerizer.hpp>
 #include <mesos/slave/qos_controller.hpp>
@@ -726,7 +728,9 @@ private:
 
   mesos::slave::QoSController* qosController;
 
+#ifdef ENABLE_GRPC
   std::shared_ptr<VolumeProfileAdaptor> volumeProfileAdaptor;
+#endif
 
   mesos::SecretGenerator* secretGenerator;