Merge "Update documentation for account_quota middleware"
This commit is contained in:
commit
2927dcc967
@ -194,6 +194,13 @@ Container Quotas
|
|||||||
:members:
|
:members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
|
Account Quotas
|
||||||
|
==============
|
||||||
|
|
||||||
|
.. automodule:: swift.common.middleware.account_quotas
|
||||||
|
:members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
.. _slo-doc:
|
.. _slo-doc:
|
||||||
|
|
||||||
Static Large Objects
|
Static Large Objects
|
||||||
@ -209,10 +216,3 @@ List Endpoints
|
|||||||
.. automodule:: swift.common.middleware.list_endpoints
|
.. automodule:: swift.common.middleware.list_endpoints
|
||||||
:members:
|
:members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
Account Quotas
|
|
||||||
================
|
|
||||||
|
|
||||||
.. automodule:: swift.common.middleware.account_quotas
|
|
||||||
:members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
@ -13,7 +13,38 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
""" Account quota middleware for Openstack Swift Proxy """
|
"""
|
||||||
|
``account_quotas`` is a middleware which blocks write requests (PUT, POST) if a
|
||||||
|
given account quota (in bytes) is exceeded while DELETE requests are still
|
||||||
|
allowed.
|
||||||
|
|
||||||
|
``account_quotas`` uses the ``x-account-meta-quota-bytes`` metadata entry to
|
||||||
|
store the quota. Write requests to this metadata entry are only permitted for
|
||||||
|
resellers. There is no quota limit if ``x-account-meta-quota-bytes`` is not
|
||||||
|
set.
|
||||||
|
|
||||||
|
The ``account_quotas`` middleware should be added to the pipeline in your
|
||||||
|
``/etc/swift/proxy-server.conf`` file just after any auth middleware.
|
||||||
|
For example::
|
||||||
|
|
||||||
|
[pipeline:main]
|
||||||
|
pipeline = catch_errors cache tempauth account_quotas proxy-server
|
||||||
|
|
||||||
|
[filter:account_quotas]
|
||||||
|
use = egg:swift#account_quotas
|
||||||
|
|
||||||
|
To set the quota on an account::
|
||||||
|
|
||||||
|
swift -A http://127.0.0.1:8080/auth/v1.0 -U account:reseller -K secret \
|
||||||
|
post -m quota-bytes:10000
|
||||||
|
|
||||||
|
Remove the quota::
|
||||||
|
|
||||||
|
swift -A http://127.0.0.1:8080/auth/v1.0 -U account:reseller -K secret \
|
||||||
|
post -m quota-bytes:
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
from swift.common.swob import HTTPForbidden, HTTPRequestEntityTooLarge, \
|
from swift.common.swob import HTTPForbidden, HTTPRequestEntityTooLarge, \
|
||||||
HTTPBadRequest, wsgify
|
HTTPBadRequest, wsgify
|
||||||
@ -22,25 +53,11 @@ from swift.proxy.controllers.base import get_account_info
|
|||||||
|
|
||||||
|
|
||||||
class AccountQuotaMiddleware(object):
|
class AccountQuotaMiddleware(object):
|
||||||
"""
|
""" Account quota middleware
|
||||||
account_quotas is a middleware which blocks write requests (PUT, POST) if a
|
|
||||||
given quota (in bytes) is exceeded while DELETE requests are still allowed.
|
|
||||||
|
|
||||||
account_quotas uses the x-account-meta-quota-bytes metadata to store the
|
See above for a full description.
|
||||||
quota. Write requests to this metadata setting are only allowed for
|
|
||||||
resellers. There is no quota limit if x-account-meta-quota-bytes is not
|
|
||||||
set.
|
|
||||||
|
|
||||||
The following shows an example proxy-server.conf:
|
|
||||||
|
|
||||||
[pipeline:main]
|
|
||||||
pipeline = catch_errors cache tempauth account-quotas proxy-server
|
|
||||||
|
|
||||||
[filter:account-quotas]
|
|
||||||
use = egg:swift#account_quotas
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, app, *args, **kwargs):
|
def __init__(self, app, *args, **kwargs):
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user