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 2018/10/12 00:51:20 UTC

[mesos] 03/06: Disallow limit in /quota requests and SET_QUOTA calls.

This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 8eb366335b0381897c536522ad607b8292514ce2
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Wed Feb 28 18:27:51 2018 -0800

    Disallow limit in /quota requests and SET_QUOTA calls.
    
    This ensures that after the protobuf changes to introduce limit
    are committed, users cannot set limit in the existing API.
    
    Review: https://reviews.apache.org/r/65851
---
 src/master/quota.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/master/quota.cpp b/src/master/quota.cpp
index ef740ca..bef18c0 100644
--- a/src/master/quota.cpp
+++ b/src/master/quota.cpp
@@ -169,6 +169,20 @@ Option<Error> quotaInfo(const QuotaInfo& quotaInfo)
     names.insert(resource.name());
   }
 
+  // TODO(bmahler): We ensure the limit is not set here to enforce
+  // that the v0 API and v1 SET_QUOTA Call cannot set an explicit
+  // limit. Ideally this check would be done during call validation
+  // but, at the time of writing this comment, call validation does
+  // not validate the call type specific messages within `Call`.
+  // Once we start to allow limit to be set via UPDATE_QUOTA, this
+  // check will have to be moved into a SET_QUOTA validator and
+  // a v0 /quota validator.
+  if (quotaInfo.limit_size() > 0) {
+    return Error("Setting QuotaInfo.limit is not supported via"
+                 " /quota and the SET_QUOTA Call,"
+                 "please use the UPDATE_QUOTA Call");
+  }
+
   return None();
 }