per user quota not applign in openstack train

melanie witt melwittt at gmail.com
Thu Aug 27 23:51:34 UTC 2020


On 8/27/20 11:56, Tim Bell wrote:
> 
>> On 27 Aug 2020, at 19:47, its-openstack at zohocorp.com 
>> As you see from mentioned table. when user1,user2, has instance quota 
>> of 2 and when user1 has created 2 instance, user2 unable to create 
>> instance.
>> but user3 able to create only 1 more instance, user 4 has no quota 
>> applied so project quota 10 will be applied and he can create 10 instance.
>>
>> the quota is applied to each user but not tracked for each user, so 
>> this defeats the purpose of per user quota.
>>
>> Please help us with resolving this issue.

Hi, I tried your scenario in devstack and found a bug in the [lack of] scoping for per-user quotas [1] and have a proposed a patch (still needs test coverage):

https://review.opendev.org/748550

If you could please try out this patch and let me know whether you find any issues, it would be appreciated.

With this patch, I got the following result with your same scenario (first user has instances quota of 2, second user has 2, third user has 3, last user has no per-user quota, project has 10):

$ nova list --fields name,user_id,created --sort created_at:asc
+--------------------------------------+-------+----------------------------------+----------------------+
| ID                                   | Name  | User Id                          | Created              |
+--------------------------------------+-------+----------------------------------+----------------------+
| 5a52f400-2bef-4f00-add4-df69b6ac195f | one   | e630b64070f042e98381bb7f6be9919c | 2020-08-27T21:41:06Z |
| 800c7673-0846-4c2e-a502-2d8db7ceab40 | two   | e630b64070f042e98381bb7f6be9919c | 2020-08-27T21:42:07Z |
| af9b35ce-6ba9-4657-aacf-aedb1915ce9a | three | b34b2b234e0545b9a54ce7f63d9b116e | 2020-08-27T23:14:36Z |
| d83e9c56-ccc5-4d65-bb81-ac3be3a8f575 | four  | b34b2b234e0545b9a54ce7f63d9b116e | 2020-08-27T23:16:24Z |
| 56aa06d2-2d1f-49e4-a314-e2e06f68fef0 | five  | 3278d32e38534016963e457f6c9d07d7 | 2020-08-27T23:16:59Z |
| 38e84ebb-fb88-4e39-b5fe-32bbcdd5f062 | six   | 3278d32e38534016963e457f6c9d07d7 | 2020-08-27T23:17:19Z |
| 7376788f-c51a-4a6d-be91-c14bb71b3541 | seven | 3278d32e38534016963e457f6c9d07d7 | 2020-08-27T23:17:37Z |
| f072d745-c37f-493d-8fa8-7dc83d520539 | eight | 06f1a9d74d214fa1b352d4a3f41e3421 | 2020-08-27T23:18:21Z |
| 58688387-8f8c-4b60-acac-40d11a8ca5b9 | nine  | 06f1a9d74d214fa1b352d4a3f41e3421 | 2020-08-27T23:18:37Z |
| 1a25e99f-2bfe-42ea-b1b3-e88a78b11293 | ten   | 06f1a9d74d214fa1b352d4a3f41e3421 | 2020-08-27T23:18:53Z |
+--------------------------------------+-------+----------------------------------+----------------------+

And I was not able to create a fourth instance with the last user because that would exceed the total project quota of 10.

Also, be careful with how you assign per-user quota in nova. The first time I tried your scenario, I did not make sure to use user_id UUID instead of name. The per-user quotas will not work properly if you do not specify the user_id as a UUID, example:

$ nova quota-update --user 3278d32e38534016963e457f6c9d07d7 --instance 3 518c0eaec2754217bee6b67a1ec6f884

where the first UUID is the user_id and the second UUID is the project_id.

> I had understood that per-user quota was deprecated now.
> 
> Have you had a look at creating dedicated per-usret projects with 
> assigned quotas ?

Tim is correct in that per-user quota is not encouraged because when we move to unified limits in nova [2], they will be removed [3].

If you are able to use a dedicated project per user instead of using per-user quotas, that is a better approach.

Hope this helps,
-melanie

[1] https://bugs.launchpad.net/nova/+bug/1893284
[2] https://review.opendev.org/#/q/topic:bp/unified-limits-nova
[3] https://docs.openstack.org/nova/latest/admin/quotas.html#view-and-update-quota-values-for-a-project-user




More information about the openstack-discuss mailing list