root / docs / design / resource-limits.rst @ a988f795
History | View | Annotate | Download (6.1 kB)
1 |
Resource default limits and visibility |
---|---|
2 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
3 |
|
4 |
We wish to keep track of resources which are not visible to the user or |
5 |
resources that we don't care to impose a certain limit on. For example, we |
6 |
wish to know the total number of CPUs per user without checking a limit and |
7 |
without the user needing to specify a value when applying for a new project. |
8 |
However, the administrator should be able at any time to change either of |
9 |
these parameters. |
10 |
|
11 |
Changes for 0.15 |
12 |
================ |
13 |
|
14 |
Resource registration |
15 |
--------------------- |
16 |
|
17 |
A new resource will be registered with an infinite base quota limit (denoted |
18 |
by None); all fields in astakos and quotaholder containing limits will have |
19 |
to be set ``null=True``. A holding is created in the quotaholder for each |
20 |
accepted user with the said limit. This means that the resource is ready to |
21 |
be used in a commission, but we are not interested in checking a senseful |
22 |
limit. |
23 |
|
24 |
Resource ``cyclades.cpu`` will from now on denote the number of active cpus. |
25 |
Its description will change to explain this. A new resource, |
26 |
``cyclades.total_cpu``, will also be registered in the system, with the |
27 |
semantics ``cyclades.cpu`` used to have. The reason for this change is that |
28 |
(in our default policy) we would like to control the number of active CPUs |
29 |
but not the total CPUs (the latter would have an infinite limit). However, |
30 |
existing projects have specified a value for the resource ``cyclades.cpu``. |
31 |
If we don't reinterpret it as active CPUs, then this grant will be |
32 |
useless: It will add a value to infinite total CPUs, but provide no active |
33 |
CPUs. Likewise we will change ``cyclades.ram`` and register |
34 |
``cyclades.total_ram``. |
35 |
|
36 |
There now exists attribute ``allow_in_projects`` in resource definitions, |
37 |
which controls whether a resource appears in a project application in the |
38 |
UI. Currently, this is set to False only for resource |
39 |
``astakos.pending_app``. This will be renamed to ``allow_in_ui`` and affect |
40 |
also the appearance in the Usage page. A new attribute ``allow_in_api`` will |
41 |
also be included in resource definition (True by default), to control |
42 |
whether the resource can appear in related API calls: GET /resources, GET |
43 |
/quotas, POST /projects (applying for a project), etc. ``allow_in_ui`` will |
44 |
entail ``allow_in_api``. Both attributes will be adjustable through |
45 |
``snf-manage resource-modify``. |
46 |
|
47 |
Resources ``cyclades.total_cpu`` and ``cyclades.total_ram`` will be marked |
48 |
with ``allow_in_ui=False`` and ``allow_in_api=False``. |
49 |
|
50 |
Changing base quota |
51 |
------------------- |
52 |
|
53 |
Base quota for a certain user is determined by looking up the base quota |
54 |
limit that is registered for the resource, unless there exists a custom |
55 |
limit for the user/resource pair in the model AstakosUserQuota. Resource |
56 |
limit can change with:: |
57 |
|
58 |
snf-manage resource-modify <resource_name> --limit <value> |
59 |
|
60 |
This not only changes the quota scheme for future users but also affects all |
61 |
existing users that have no custom limit for this resource. Option |
62 |
``--limit`` will be renamed ``--set-base-quota``. Moreover, admin will be |
63 |
forced to provide an extra option ``--preserve-existing=True|False``; if |
64 |
false, it will operate as before; if true, it will preserve limits for |
65 |
existing users by generating entries in AstakosUserQuota with the old |
66 |
default value before changing it. In the latter case, in order to allow |
67 |
reverting the change, a log file will be written containing the list of |
68 |
users whose quota has been preserved, in the following format:: |
69 |
|
70 |
Description: Preserved the following base quota, because default has changed |
71 |
Resource: <resource_name> |
72 |
Date: 2013-12-31T00:00Z |
73 |
<user1_uuid> <username1@example.org> |
74 |
<user2_uuid> <username2@example.org> |
75 |
|
76 |
Log file will be provided by option ``--log-file <filename>``. |
77 |
If options ``--preserve-existing`` and ``--log-file`` are not given in |
78 |
the command line, the user will be prompted to fill them in. |
79 |
|
80 |
.. note:: With the following command you can revert a user quota back to |
81 |
the current default:: |
82 |
|
83 |
snf-manage user-modify <id> --set-base-quota <resource_name> default |
84 |
|
85 |
Inspecting base quota |
86 |
--------------------- |
87 |
|
88 |
Management command ``user-list`` will get a new option |
89 |
``--with-custom-quota`` to filter users that have custom base quota at least |
90 |
for one resource. Option ``--filter-by-resource=<pred>`` will filter users |
91 |
whose base quota satisfy the given predicate. For example:: |
92 |
|
93 |
snf-manage user-list -o uuid,resource,limit --filter-by-resource=cyclades.vm>2 |
94 |
|
95 |
Changes for resource-pool projects (0.16) |
96 |
========================================= |
97 |
|
98 |
In 0.16, projects will be seen as a pool of resources, where one can |
99 |
allocate from and put back. This means that we need to specify a limit for |
100 |
resources, even for those not specified in a project application. (This was |
101 |
not needed prior to 0.16, because quota were cumulative; if you had had |
102 |
infinite total CPUs through base quota, you didn't need an extra project |
103 |
grant for this resource.) |
104 |
|
105 |
Moreover, base quota will be expressed by user-specific base projects. So, |
106 |
we need two different quota schemes: one for filling the resources of a |
107 |
base project when a new user is created, and a second one for completing |
108 |
the values for resources not specified by a project application. |
109 |
|
110 |
The former will be handled with ``snf-manage resource-modify |
111 |
--set-base-quota`` as before; the latter with a new option |
112 |
``--set-project-default``. Similar to the custom base quota logic of 0.15, |
113 |
resources granted by projects will be identified by first looking up the |
114 |
project grant definitions (as described in a project application) and if a |
115 |
resource is missing, it will be looked up in the appropriate scheme. |
116 |
|
117 |
When creating a new user, the base project created will not specify any |
118 |
resources, inheriting thusly the base quota scheme. If a resource base |
119 |
quota limit is changed with option ``--preserve-existing=True``, a new |
120 |
entry will be created in the project definition to keep the old value |
121 |
before changing the default. |
122 |
|
123 |
In the new projects, there are actually two limits per resource we need to |
124 |
define: the project-level and the member-level limit. For reasons of |
125 |
simplicity, the default schemes will only contain one value per resource, |
126 |
which will be consulted for both types of limits. |