summaryrefslogtreecommitdiffstats
path: root/docs/release/userguide/multisite.kingbird.usage.rst
blob: e9ead90bc2d256fa53bd8a33950b57f50c2948ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0

=============================
Multisite.Kingbird user guide
=============================

Quota management for OpenStack multi-region deployments
-------------------------------------------------------
Kingbird is centralized synchronization service for multi-region OpenStack
deployments. In OPNFV Colorado release, Kingbird provides centralized quota
management feature. Administrator can set quota per project based in Kingbird
and sync the quota limit to multi-region OpenStack periodiclly or on-demand.
The tenant can check the total quota limit and usage from Kingbird for all
regions. Administrator can also manage the default quota by quota class
setting.

Following quota items are supported to be managed in Kingbird:

- **instances**: Number of instances allowed per project.
- **cores**: Number of instance cores allowed per project.
- **ram**: Megabytes of instance RAM allowed per project.
- **metadata_items**: Number of metadata items allowed per instance.
- **key_pairs**: Number of key pairs per user.
- **fixed_ips**: Number of fixed IPs allowed per project,
  valid if Nova Network is used.
- **security_groups**: Number of security groups per project,
  valid if Nova Network is used.
- **floating_ips**: Number of floating IPs allowed per project,
  valid if Nova Network is used.
- **network**: Number of networks allowed per project,
  valid if Neutron is used.
- **subnet**: Number of subnets allowed per project,
  valid if Neutron is used.
- **port**: Number of ports allowed per project,
  valid if Neutron is used.
- **security_group**: Number of security groups allowed per project,
  valid if Neutron is used.
- **security_group_rule**: Number of security group rules allowed per project,
  valid if Neutron is used.
- **router**: Number of routers allowed per project,
  valid if Neutron is used.
- **floatingip**: Number of floating IPs allowed per project,
  valid if Neutron is used.
- **volumes**: Number of volumes allowed per project.
- **snapshots**: Number of snapshots allowed per project.
- **gigabytes**: Total amount of storage, in gigabytes, allowed for volumes
  and snapshots per project.
- **backups**: Number of volume backups allowed per project.
- **backup_gigabytes**: Total amount of storage, in gigabytes, allowed for volume
  backups per project.

Key pair is the only resource type supported in resource synchronization.

Only restful APIs are provided for Kingbird in Colorado release, so curl or
other http client can be used to call Kingbird API.

Before use the following command, get token, project id, and kingbird service
endpoint first. Use $kb_token to repesent the token, and $admin_tenant_id as
administrator project_id, and $tenant_id as the target project_id for quota
management and $kb_ip_addr for the kingbird service endpoint ip address.

Note:
To view all tenants (projects), run:

    .. code-block:: bash

        openstack project list

To get token, run:

    .. code-block:: bash

        openstack token issue

To get Kingbird service endpoint, run:

    .. code-block:: bash

        openstack endpoint list

Quota Management API
--------------------

1. Update global limit for a tenant

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota update b8eea2ceda4c47f1906fda7e7152a322 --port 10 --security_groups 10

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       -X PUT \
       -d '{"quota_set":{"cores": 10,"ram": 51200, "metadata_items": 100,"key_pairs": 100, "network":20,"security_group": 20,"security_group_rule": 20}}' \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-sets/$tenant_id

2. Get global limit for a tenant

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota show --tenant $tenant_id

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-sets/$tenant_id

3. A tenant can also get the global limit by himself

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota show

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       http://$kb_ip_addr:8118/v1.0/$tenant_id/os-quota-sets/$tenant_id

4. Get defaults limits

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota defaults

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-sets/defaults

5. Get total usage for a tenant

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota detail --tenant $tenant_id

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       -X GET \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-sets/$tenant_id/detail

6. A tenant can also get the total usage by himself

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota detail

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       -X GET \
       http://$kb_ip_addr:8118/v1.0/$tenant_id/os-quota-sets/$tenant_id/detail

7. On demand quota sync

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota sync $tenant_id

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       -X PUT \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-sets/$tenant_id/sync


8. Delete specific global limit for a tenant

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       -X DELETE \
       -d '{"quota_set": [ "cores", "ram"]}' \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-sets/$tenant_id

9. Delete all kingbird global limit for a tenant

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota delete $tenant_id

    Use curl:

    .. code-block:: bash

      curl \
      -H "Content-Type: application/json" \
      -H "X-Auth-Token: $kb_token" \
      -X DELETE \
      http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-sets/$tenant_id


Quota Class API
---------------

1. Update default quota class

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota-class update --port 10 --security_groups 10 <quota class>

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       -X PUT \
       -d '{"quota_class_set":{"cores": 100, "network":50,"security_group": 50,"security_group_rule": 50}}' \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-class-sets/default

2. Get default quota class

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota-class show default

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-class-sets/default

3. Delete default quota class

    Use python-kingbirdclient:

    .. code-block:: bash

       kingbird quota-class delete default

    Use curl:

    .. code-block:: bash

       curl \
       -H "Content-Type: application/json" \
       -H "X-Auth-Token: $kb_token" \
       -X DELETE \
       http://$kb_ip_addr:8118/v1.0/$admin_tenant_id/os-quota-class-sets/default


Resource Synchronization API
-----------------------------

1. Create synchronization job

    .. code-block:: bash

      curl \
      -H "Content-Type: application/json" \
      -H "X-Auth-Token: $kb_token" \
      -X POST -d \
      '{"resource_set":{"resources": ["<Keypair_name>"],"force":<True/False>,"resource_type": "keypair","source": <"Source_Region">,"target": [<"List_of_target_regions">]}}' \
      http://$kb_ip_addr:8118/v1.0/$tenant_id/os-sync

2. Get synchronization job

    .. code-block:: bash

      curl \
      -H "Content-Type: application/json" \
      -H "X-Auth-Token: $kb_token" \
      http://$kb_ip_addr:8118/v1.0/$tenant_id/os-sync/

3. Get active synchronization job

    .. code-block:: bash

      curl \
      -H "Content-Type: application/json" \
      -H "X-Auth-Token: $kb_token" \
      http://$kb_ip_addr:8118/v1.0/$tenant_id/os-sync/active

4. Get detail information of a synchronization job

    .. code-block:: bash

      curl \
      -H "Content-Type: application/json" \
      -H "X-Auth-Token: $kb_token" \
      http://$kb_ip_addr:8118/v1.0/$tenant_id/os-sync/$job_id

5. Delete a synchronization job

    .. code-block:: bash

      curl \
      -H "Content-Type: application/json" \
      -H "X-Auth-Token: $kb_token" \
      -X DELETE \
       http://$kb_ip_addr:8118/v1.0/$tenant_id/os-sync/job_id