Container Quotas

Click on the Container Quotas link on the Manage Cluster page Middleware tab to enable and configure the Container Quotas middleware.

../../_images/container-quotas.png

Setting the limit in bytes

You will need the AUTH_TOKEN and STORAGE_URL, more information on those can be found on the Authentication and Authorization page.

Using swift:

swift -A <auth_url> -U <user> -K <password> post <container> -m quota-bytes:<value>

Or using curl to set the container's quota create time:

curl -i -H "X-Auth-Token: <token>" -H "X-Container-Meta-Quota-Bytes: <value>" -X PUT <storage_url>/<container>

curl -i -H "X-Auth-Token: AUTH_tk19023523c67c442ea9650d2813c627b4" -X PUT \
    https://swift.example.com/v1/AUTH_bob/cont2 -H "X-Container-Meta-Quota-Bytes: 307200"
HTTP/1.1 201 Created
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txd4ea7d2b677946b3a889d-00520aba6c
Date: Tue, 13 Aug 2013 22:59:56 GMT

Setting the limit in count

Using swift:

swift -A <auth_url> -U <user> -K <password> post <container> -m quota-count:<value>

Or using curl to modify quota of existing container:

curl -i -H "X-Auth-Token: <token>" -H "X-Container-Meta-Quota-Count: <value>" -X POST <storage_url>/<container>

curl -i -H "X-Auth-Token: AUTH_tk19023523c67c442ea9650d2813c627b4" -X PUT \
    https://swift.example.com/v1/AUTH_bob/cont2 -H "X-Container-Meta-Quota-Count: 3"
HTTP/1.1 201 Created
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txd4ea7d2b677946b3a889d-00520aba6c
Date: Tue, 13 Aug 2013 22:59:56 GMT

Exceeding the limit(s)

Using the swift command line client:

$ swift -A https://swift.example.com/auth/v1.0 -U bob -K bob upload cont2 one-hundred-k-file
Object PUT failed: https://swift.example.com:443/v1/AUTH_bob/cont2/one-hundred-k-file
413 Request Entity Too Large   Upload exceeds quota.

Or using curl:

$ curl -i -H "X-Auth-Token4e9eb5a6f00130febed3" -X PUT \
    http://swift.example.com/v1/AUTH_bob/by_bytes/18.txt \
    --data-binary @one-hundred-k-file
HTTP/1.1 413 Request Entity Too Large
Content-Length: 21
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txc7025b39394d43a682325-00520a968c
Date: Tue, 13 Aug 2013 20:26:52 GMT

Upload exceeds quota.