Our swift API is served by our ceph radosgw's. These are gateways providing the swift API as a frontend and uses the ceph cluster as a backend. Then integrate with keystone for auth, and are registered in keystone as an endpoint. This results in the swift API being visible in horizon.

This page documents some administratvie commands which might be useful when interacting with swift as an administrator.

Quotas

The radosgw's does not interact with the quotas defined in keystone. They have quotas set directly to the ceph cluster through the radosgw's.

Ceph updates the usage statistics asynchronously and is often not fully updated. This means that a user is likely to be able to write a little over their quotas. When a user is registered to be over its quota it cannot upload more data. If the user deletes data so that the total is less than the limit it might not be able to upload more data before the next usage-statistics-refresh. This happens every few minutes, so the waiting should not be too long.

There are also two kinds of quotas; user and bucket quota. The user quota limits the total amount of data a certain project can store. The bucket quota limits the amount of data a project can store in a single swift container. In general these limits can both be updated to the same values, when values are changed.

Project quotas

Every openstack-tenant accessing the swift API will get a user at the radosgw, and the username is the project ID. Each user can have a quota assigned; but the default is no quota which means that the global quotas apply for the user. We have set the defaults to 20K objects, with a total size of 20GB. To see a users quota the following command can be used:

See users quota
root@radosgw1:~# radosgw-admin user info --uid=e305b450c48e455b962ef1513d7f0e3f
{
    ...
    "bucket_quota": {
        "enabled": false,
        "check_on_raw": false,
        "max_size": -1,
        "max_size_kb": 0,
        "max_objects": -1
    },
    "user_quota": {
        "enabled": false,
        "check_on_raw": false,
        "max_size": -1,
        "max_size_kb": 0,
        "max_objects": -1
    },
    ...
}


To see how much capacity a certain user is using you can use the stats command:

Change default quotas
root@radosgw1:~# radosgw-admin user stats --uid=e305b450c48e455b962ef1513d7f0e3f
{
    "stats": {
        "total_entries": 20,
        "total_bytes": 2097152000,
        "total_bytes_rounded": 2097152000
    },
    "last_stats_sync": "2019-01-18 14:54:08.832917Z",
    "last_stats_update": "2019-01-18 14:54:08.825901Z"
}

To change a users quota one can use similar commands as the ones used to change the default quota. If the users quota is not set before it should also be enabled:

Change a users quotas
root@radosgw1:~# radosgw-admin quota set --quota-scope=user --uid=e305b450c48e455b962ef1513d7f0e3f --max-size=400G --max-objects=20971520
root@radosgw1:~# radosgw-admin quota set --quota-scope=bucket --uid=e305b450c48e455b962ef1513d7f0e3f --max-size=400G --max-objects=20971520
root@radosgw1:~# radosgw-admin quota enable --uid=e305b450c48e455b962ef1513d7f0e3f --quota-scope=user
root@radosgw1:~# radosgw-admin quota enable --uid=e305b450c48e455b962ef1513d7f0e3f --quota-scope=bucket

Default quotas

Users which have not a specific quota set will have the global quota as their qouta. The global quota can be seen at the radosgw's:

Show default quotas
root@radosgw1:~# radosgw-admin global quota get
{
    "bucket quota": {
        "enabled": true,
        "check_on_raw": false,
        "max_size": 21474836480,
        "max_size_kb": 20971520,
        "max_objects": 20480
    },
    "user quota": {
        "enabled": true,
        "check_on_raw": false,
        "max_size": 21474836480,
        "max_size_kb": 20971520,
        "max_objects": 20480
    }
}

The quotas can also be changed at the radosgw's. After a change of the global-quota the radosgw's should be restarted.

Change default quotas
root@radosgw1:~# radosgw-admin global quota set --quota-scope=user --max-objects=20480 --max-size=20G
Global quota changes saved. They will take effect as the gateways are restarted.
{
    "user quota": {
        "enabled": true,
        "check_on_raw": false,
        "max_size": 21474836480,
        "max_size_kb": 20971520,
        "max_objects": 20480
    }
}
root@radosgw1:~# radosgw-admin global quota set --quota-scope=bucket --max-objects=20480 --max-size=20G
Global quota changes saved. They will take effect as the gateways are restarted.
{
    "bucket quota": {
        "enabled": true,
        "check_on_raw": false,
        "max_size": 21474836480,
        "max_size_kb": 20971520,
        "max_objects": 20480
    }
}
root@radosgw1:~# systemctl restart ceph-radosgw.target

If the quotas is not enabled, it is done with the following commands:

Change default quotas
root@radosgw1:~# radosgw-admin global quota enable --quota-scope=bucket
root@radosgw1:~# radosgw-admin global quota enable --quota-scope=user
  • No labels