root / doc / rapi.rst @ 1302ce18
History | View | Annotate | Download (49 kB)
1 |
Ganeti remote API |
---|---|
2 |
================= |
3 |
|
4 |
Documents Ganeti version |version| |
5 |
|
6 |
.. contents:: |
7 |
|
8 |
Introduction |
9 |
------------ |
10 |
|
11 |
Ganeti supports a remote API for enable external tools to easily |
12 |
retrieve information about a cluster's state. The remote API daemon, |
13 |
*ganeti-rapi*, is automatically started on the master node. By default |
14 |
it runs on TCP port 5080, but this can be changed either in |
15 |
``.../constants.py`` or via the command line parameter *-p*. SSL mode, |
16 |
which is used by default, can also be disabled by passing command line |
17 |
parameters. |
18 |
|
19 |
.. _rapi-users: |
20 |
|
21 |
Users and passwords |
22 |
------------------- |
23 |
|
24 |
``ganeti-rapi`` reads users and passwords from a file (usually |
25 |
``/var/lib/ganeti/rapi/users``) on startup. Changes to the file will be |
26 |
read automatically. |
27 |
|
28 |
Lines starting with the hash sign (``#``) are treated as comments. Each |
29 |
line consists of two or three fields separated by whitespace. The first |
30 |
two fields are for username and password. The third field is optional |
31 |
and can be used to specify per-user options (separated by comma without |
32 |
spaces). |
33 |
|
34 |
Passwords can either be written in clear text or as a hash. Clear text |
35 |
passwords may not start with an opening brace (``{``) or they must be |
36 |
prefixed with ``{cleartext}``. To use the hashed form, get the MD5 hash |
37 |
of the string ``$username:Ganeti Remote API:$password`` (e.g. ``echo -n |
38 |
'jack:Ganeti Remote API:abc123' | openssl md5``) [#pwhash]_ and prefix |
39 |
it with ``{ha1}``. Using the scheme prefix for all passwords is |
40 |
recommended. Scheme prefixes are case insensitive. |
41 |
|
42 |
Options control a user's access permissions. The section |
43 |
:ref:`rapi-access-permissions` lists the permissions required for each |
44 |
resource. If the ``--require-authentication`` command line option is |
45 |
given to the ``ganeti-rapi`` daemon, all requests require |
46 |
authentication. Available options: |
47 |
|
48 |
.. pyassert:: |
49 |
|
50 |
rapi.RAPI_ACCESS_ALL == set([ |
51 |
rapi.RAPI_ACCESS_WRITE, |
52 |
rapi.RAPI_ACCESS_READ, |
53 |
]) |
54 |
|
55 |
.. pyassert:: |
56 |
|
57 |
rlib2.R_2_nodes_name_storage.GET_ACCESS == [rapi.RAPI_ACCESS_WRITE] |
58 |
|
59 |
.. pyassert:: |
60 |
|
61 |
rlib2.R_2_jobs_id_wait.GET_ACCESS == [rapi.RAPI_ACCESS_WRITE] |
62 |
|
63 |
:pyeval:`rapi.RAPI_ACCESS_WRITE` |
64 |
Enables the user to execute operations modifying the cluster. Implies |
65 |
:pyeval:`rapi.RAPI_ACCESS_READ` access. Resources blocking other |
66 |
operations for read-only access, such as |
67 |
:ref:`/2/nodes/[node_name]/storage <rapi-res-nodes-node_name-storage+get>` |
68 |
or blocking server-side processes, such as |
69 |
:ref:`/2/jobs/[job_id]/wait <rapi-res-jobs-job_id-wait+get>`, use |
70 |
:pyeval:`rapi.RAPI_ACCESS_WRITE` to control access to their |
71 |
:pyeval:`http.HTTP_GET` method. |
72 |
:pyeval:`rapi.RAPI_ACCESS_READ` |
73 |
Allow access to operations querying for information. |
74 |
|
75 |
Example:: |
76 |
|
77 |
# Give Jack and Fred read-only access |
78 |
jack abc123 |
79 |
fred {cleartext}foo555 |
80 |
|
81 |
# Give write access to an imaginary instance creation script |
82 |
autocreator xyz789 write |
83 |
|
84 |
# Hashed password for Jessica |
85 |
jessica {HA1}7046452df2cbb530877058712cf17bd4 write |
86 |
|
87 |
# Monitoring can query for values |
88 |
monitoring {HA1}ec018ffe72b8e75bb4d508ed5b6d079c read |
89 |
|
90 |
# A user who can read and write (the former is implied by granting |
91 |
# write access) |
92 |
superuser {HA1}ec018ffe72b8e75bb4d508ed5b6d079c read,write |
93 |
|
94 |
|
95 |
.. [#pwhash] Using the MD5 hash of username, realm and password is |
96 |
described in :rfc:`2617` ("HTTP Authentication"), sections 3.2.2.2 |
97 |
and 3.3. The reason for using it over another algorithm is forward |
98 |
compatibility. If ``ganeti-rapi`` were to implement HTTP Digest |
99 |
authentication in the future, the same hash could be used. |
100 |
In the current version ``ganeti-rapi``'s realm, ``Ganeti Remote |
101 |
API``, can only be changed by modifying the source code. |
102 |
|
103 |
|
104 |
Protocol |
105 |
-------- |
106 |
|
107 |
The protocol used is JSON_ over HTTP designed after the REST_ principle. |
108 |
HTTP Basic authentication as per :rfc:`2617` is supported. |
109 |
|
110 |
.. _JSON: http://www.json.org/ |
111 |
.. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer |
112 |
|
113 |
HTTP requests with a body (e.g. ``PUT`` or ``POST``) require the request |
114 |
header ``Content-type`` be set to ``application/json`` (see :rfc:`2616` |
115 |
(HTTP/1.1), section 7.2.1). |
116 |
|
117 |
|
118 |
A note on JSON as used by RAPI |
119 |
++++++++++++++++++++++++++++++ |
120 |
|
121 |
JSON_ as used by Ganeti RAPI does not conform to the specification in |
122 |
:rfc:`4627`. Section 2 defines a JSON text to be either an object |
123 |
(``{"key": "value", …}``) or an array (``[1, 2, 3, …]``). In violation |
124 |
of this RAPI uses plain strings (``"master-candidate"``, ``"1234"``) for |
125 |
some requests or responses. Changing this now would likely break |
126 |
existing clients and cause a lot of trouble. |
127 |
|
128 |
.. highlight:: ruby |
129 |
|
130 |
Unlike Python's `JSON encoder and decoder |
131 |
<http://docs.python.org/library/json.html>`_, other programming |
132 |
languages or libraries may only provide a strict implementation, not |
133 |
allowing plain values. For those, responses can usually be wrapped in an |
134 |
array whose first element is then used, e.g. the response ``"1234"`` |
135 |
becomes ``["1234"]``. This works equally well for more complex values. |
136 |
Example in Ruby:: |
137 |
|
138 |
require "json" |
139 |
|
140 |
# Insert code to get response here |
141 |
response = "\"1234\"" |
142 |
|
143 |
decoded = JSON.parse("[#{response}]").first |
144 |
|
145 |
Short of modifying the encoder to allow encoding to a less strict |
146 |
format, requests will have to be formatted by hand. Newer RAPI requests |
147 |
already use a dictionary as their input data and shouldn't cause any |
148 |
problems. |
149 |
|
150 |
|
151 |
PUT or POST? |
152 |
------------ |
153 |
|
154 |
According to :rfc:`2616` the main difference between PUT and POST is |
155 |
that POST can create new resources but PUT can only create the resource |
156 |
the URI was pointing to on the PUT request. |
157 |
|
158 |
Unfortunately, due to historic reasons, the Ganeti RAPI library is not |
159 |
consistent with this usage, so just use the methods as documented below |
160 |
for each resource. |
161 |
|
162 |
For more details have a look in the source code at |
163 |
``lib/rapi/rlib2.py``. |
164 |
|
165 |
|
166 |
Generic parameter types |
167 |
----------------------- |
168 |
|
169 |
A few generic refered parameter types and the values they allow. |
170 |
|
171 |
``bool`` |
172 |
++++++++ |
173 |
|
174 |
A boolean option will accept ``1`` or ``0`` as numbers but not |
175 |
i.e. ``True`` or ``False``. |
176 |
|
177 |
Generic parameters |
178 |
------------------ |
179 |
|
180 |
A few parameter mean the same thing across all resources which implement |
181 |
it. |
182 |
|
183 |
``bulk`` |
184 |
++++++++ |
185 |
|
186 |
Bulk-mode means that for the resources which usually return just a list |
187 |
of child resources (e.g. ``/2/instances`` which returns just instance |
188 |
names), the output will instead contain detailed data for all these |
189 |
subresources. This is more efficient than query-ing the sub-resources |
190 |
themselves. |
191 |
|
192 |
``dry-run`` |
193 |
+++++++++++ |
194 |
|
195 |
The boolean *dry-run* argument, if provided and set, signals to Ganeti |
196 |
that the job should not be executed, only the pre-execution checks will |
197 |
be done. |
198 |
|
199 |
This is useful in trying to determine (without guarantees though, as in |
200 |
the meantime the cluster state could have changed) if the operation is |
201 |
likely to succeed or at least start executing. |
202 |
|
203 |
``force`` |
204 |
+++++++++++ |
205 |
|
206 |
Force operation to continue even if it will cause the cluster to become |
207 |
inconsistent (e.g. because there are not enough master candidates). |
208 |
|
209 |
Parameter details |
210 |
----------------- |
211 |
|
212 |
Some parameters are not straight forward, so we describe them in details |
213 |
here. |
214 |
|
215 |
.. _rapi-ipolicy: |
216 |
|
217 |
``ipolicy`` |
218 |
+++++++++++ |
219 |
|
220 |
The instance policy specification is a dict with the following fields: |
221 |
|
222 |
.. pyassert:: |
223 |
|
224 |
constants.IPOLICY_ALL_KEYS == set([constants.ISPECS_MIN, |
225 |
constants.ISPECS_MAX, |
226 |
constants.ISPECS_STD, |
227 |
constants.IPOLICY_DTS, |
228 |
constants.IPOLICY_VCPU_RATIO, |
229 |
constants.IPOLICY_SPINDLE_RATIO]) |
230 |
|
231 |
|
232 |
.. pyassert:: |
233 |
|
234 |
(set(constants.ISPECS_PARAMETER_TYPES.keys()) == |
235 |
set([constants.ISPEC_MEM_SIZE, |
236 |
constants.ISPEC_DISK_SIZE, |
237 |
constants.ISPEC_DISK_COUNT, |
238 |
constants.ISPEC_CPU_COUNT, |
239 |
constants.ISPEC_NIC_COUNT, |
240 |
constants.ISPEC_SPINDLE_USE])) |
241 |
|
242 |
.. |ispec-min| replace:: :pyeval:`constants.ISPECS_MIN` |
243 |
.. |ispec-max| replace:: :pyeval:`constants.ISPECS_MAX` |
244 |
.. |ispec-std| replace:: :pyeval:`constants.ISPECS_STD` |
245 |
|
246 |
|
247 |
|ispec-min|, |ispec-max|, |ispec-std| |
248 |
A sub- `dict` with the following fields, which sets the limit and standard |
249 |
values of the instances: |
250 |
|
251 |
:pyeval:`constants.ISPEC_MEM_SIZE` |
252 |
The size in MiB of the memory used |
253 |
:pyeval:`constants.ISPEC_DISK_SIZE` |
254 |
The size in MiB of the disk used |
255 |
:pyeval:`constants.ISPEC_DISK_COUNT` |
256 |
The numbers of disks used |
257 |
:pyeval:`constants.ISPEC_CPU_COUNT` |
258 |
The numbers of cpus used |
259 |
:pyeval:`constants.ISPEC_NIC_COUNT` |
260 |
The numbers of nics used |
261 |
:pyeval:`constants.ISPEC_SPINDLE_USE` |
262 |
The numbers of virtual disk spindles used by this instance. They are |
263 |
not real in the sense of actual HDD spindles, but useful for |
264 |
accounting the spindle usage on the residing node |
265 |
:pyeval:`constants.IPOLICY_DTS` |
266 |
A `list` of disk templates allowed for instances using this policy |
267 |
:pyeval:`constants.IPOLICY_VCPU_RATIO` |
268 |
Maximum ratio of virtual to physical CPUs (`float`) |
269 |
:pyeval:`constants.IPOLICY_SPINDLE_RATIO` |
270 |
Maximum ratio of instances to their node's ``spindle_count`` (`float`) |
271 |
|
272 |
Usage examples |
273 |
-------------- |
274 |
|
275 |
You can access the API using your favorite programming language as long |
276 |
as it supports network connections. |
277 |
|
278 |
Ganeti RAPI client |
279 |
++++++++++++++++++ |
280 |
|
281 |
Ganeti includes a standalone RAPI client, ``lib/rapi/client.py``. |
282 |
|
283 |
Shell |
284 |
+++++ |
285 |
|
286 |
.. highlight:: shell-example |
287 |
|
288 |
Using wget:: |
289 |
|
290 |
$ wget -q -O - https://%CLUSTERNAME%:5080/2/info |
291 |
|
292 |
or curl:: |
293 |
|
294 |
$ curl https://%CLUSTERNAME%:5080/2/info |
295 |
|
296 |
|
297 |
Python |
298 |
++++++ |
299 |
|
300 |
.. highlight:: python |
301 |
|
302 |
:: |
303 |
|
304 |
import urllib2 |
305 |
f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info') |
306 |
print f.read() |
307 |
|
308 |
|
309 |
JavaScript |
310 |
++++++++++ |
311 |
|
312 |
.. warning:: While it's possible to use JavaScript, it poses several |
313 |
potential problems, including browser blocking request due to |
314 |
non-standard ports or different domain names. Fetching the data on |
315 |
the webserver is easier. |
316 |
|
317 |
.. highlight:: javascript |
318 |
|
319 |
:: |
320 |
|
321 |
var url = 'https://CLUSTERNAME:5080/2/info'; |
322 |
var info; |
323 |
var xmlreq = new XMLHttpRequest(); |
324 |
xmlreq.onreadystatechange = function () { |
325 |
if (xmlreq.readyState != 4) return; |
326 |
if (xmlreq.status == 200) { |
327 |
info = eval("(" + xmlreq.responseText + ")"); |
328 |
alert(info); |
329 |
} else { |
330 |
alert('Error fetching cluster info'); |
331 |
} |
332 |
xmlreq = null; |
333 |
}; |
334 |
xmlreq.open('GET', url, true); |
335 |
xmlreq.send(null); |
336 |
|
337 |
Resources |
338 |
--------- |
339 |
|
340 |
.. highlight:: javascript |
341 |
|
342 |
``/`` |
343 |
+++++ |
344 |
|
345 |
The root resource. Has no function, but for legacy reasons the ``GET`` |
346 |
method is supported. |
347 |
|
348 |
``/2`` |
349 |
++++++ |
350 |
|
351 |
Has no function, but for legacy reasons the ``GET`` method is supported. |
352 |
|
353 |
.. _rapi-res-info: |
354 |
|
355 |
``/2/info`` |
356 |
+++++++++++ |
357 |
|
358 |
Cluster information resource. |
359 |
|
360 |
It supports the following commands: ``GET``. |
361 |
|
362 |
.. _rapi-res-info+get: |
363 |
|
364 |
``GET`` |
365 |
~~~~~~~ |
366 |
|
367 |
Returns cluster information. |
368 |
|
369 |
Example:: |
370 |
|
371 |
{ |
372 |
"config_version": 2000000, |
373 |
"name": "cluster", |
374 |
"software_version": "2.0.0~beta2", |
375 |
"os_api_version": 10, |
376 |
"export_version": 0, |
377 |
"candidate_pool_size": 10, |
378 |
"enabled_hypervisors": [ |
379 |
"fake" |
380 |
], |
381 |
"hvparams": { |
382 |
"fake": {} |
383 |
}, |
384 |
"default_hypervisor": "fake", |
385 |
"master": "node1.example.com", |
386 |
"architecture": [ |
387 |
"64bit", |
388 |
"x86_64" |
389 |
], |
390 |
"protocol_version": 20, |
391 |
"beparams": { |
392 |
"default": { |
393 |
"auto_balance": true, |
394 |
"vcpus": 1, |
395 |
"memory": 128 |
396 |
} |
397 |
}, |
398 |
… |
399 |
} |
400 |
|
401 |
|
402 |
.. _rapi-res-redistribute-config: |
403 |
|
404 |
``/2/redistribute-config`` |
405 |
++++++++++++++++++++++++++ |
406 |
|
407 |
Redistribute configuration to all nodes. |
408 |
|
409 |
It supports the following commands: ``PUT``. |
410 |
|
411 |
|
412 |
.. _rapi-res-redistribute-config+put: |
413 |
|
414 |
``PUT`` |
415 |
~~~~~~~ |
416 |
|
417 |
Redistribute configuration to all nodes. The result will be a job id. |
418 |
|
419 |
Job result: |
420 |
|
421 |
.. opcode_result:: OP_CLUSTER_REDIST_CONF |
422 |
|
423 |
|
424 |
.. _rapi-res-features: |
425 |
|
426 |
``/2/features`` |
427 |
+++++++++++++++ |
428 |
|
429 |
|
430 |
.. _rapi-res-features+get: |
431 |
|
432 |
``GET`` |
433 |
~~~~~~~ |
434 |
|
435 |
Returns a list of features supported by the RAPI server. Available |
436 |
features: |
437 |
|
438 |
.. pyassert:: |
439 |
|
440 |
rlib2.ALL_FEATURES == set([rlib2._INST_CREATE_REQV1, |
441 |
rlib2._INST_REINSTALL_REQV1, |
442 |
rlib2._NODE_MIGRATE_REQV1, |
443 |
rlib2._NODE_EVAC_RES1]) |
444 |
|
445 |
:pyeval:`rlib2._INST_CREATE_REQV1` |
446 |
Instance creation request data version 1 supported |
447 |
:pyeval:`rlib2._INST_REINSTALL_REQV1` |
448 |
Instance reinstall supports body parameters |
449 |
:pyeval:`rlib2._NODE_MIGRATE_REQV1` |
450 |
Whether migrating a node (``/2/nodes/[node_name]/migrate``) supports |
451 |
request body parameters |
452 |
:pyeval:`rlib2._NODE_EVAC_RES1` |
453 |
Whether evacuating a node (``/2/nodes/[node_name]/evacuate``) returns |
454 |
a new-style result (see resource description) |
455 |
|
456 |
|
457 |
.. _rapi-res-modify: |
458 |
|
459 |
``/2/modify`` |
460 |
++++++++++++++++++++++++++++++++++++++++ |
461 |
|
462 |
Modifies cluster parameters. |
463 |
|
464 |
Supports the following commands: ``PUT``. |
465 |
|
466 |
|
467 |
.. _rapi-res-modify+put: |
468 |
|
469 |
``PUT`` |
470 |
~~~~~~~ |
471 |
|
472 |
Returns a job ID. |
473 |
|
474 |
Body parameters: |
475 |
|
476 |
.. opcode_params:: OP_CLUSTER_SET_PARAMS |
477 |
|
478 |
Job result: |
479 |
|
480 |
.. opcode_result:: OP_CLUSTER_SET_PARAMS |
481 |
|
482 |
|
483 |
.. _rapi-res-groups: |
484 |
|
485 |
``/2/groups`` |
486 |
+++++++++++++ |
487 |
|
488 |
The groups resource. |
489 |
|
490 |
It supports the following commands: ``GET``, ``POST``. |
491 |
|
492 |
.. _rapi-res-groups+get: |
493 |
|
494 |
``GET`` |
495 |
~~~~~~~ |
496 |
|
497 |
Returns a list of all existing node groups. |
498 |
|
499 |
Example:: |
500 |
|
501 |
[ |
502 |
{ |
503 |
"name": "group1", |
504 |
"uri": "\/2\/groups\/group1" |
505 |
}, |
506 |
{ |
507 |
"name": "group2", |
508 |
"uri": "\/2\/groups\/group2" |
509 |
} |
510 |
] |
511 |
|
512 |
If the optional bool *bulk* argument is provided and set to a true value |
513 |
(i.e ``?bulk=1``), the output contains detailed information about node |
514 |
groups as a list. |
515 |
|
516 |
Returned fields: :pyeval:`utils.CommaJoin(sorted(rlib2.G_FIELDS))`. |
517 |
|
518 |
Example:: |
519 |
|
520 |
[ |
521 |
{ |
522 |
"name": "group1", |
523 |
"node_cnt": 2, |
524 |
"node_list": [ |
525 |
"node1.example.com", |
526 |
"node2.example.com" |
527 |
], |
528 |
"uuid": "0d7d407c-262e-49af-881a-6a430034bf43", |
529 |
… |
530 |
}, |
531 |
{ |
532 |
"name": "group2", |
533 |
"node_cnt": 1, |
534 |
"node_list": [ |
535 |
"node3.example.com" |
536 |
], |
537 |
"uuid": "f5a277e7-68f9-44d3-a378-4b25ecb5df5c", |
538 |
… |
539 |
}, |
540 |
… |
541 |
] |
542 |
|
543 |
|
544 |
.. _rapi-res-groups+post: |
545 |
|
546 |
``POST`` |
547 |
~~~~~~~~ |
548 |
|
549 |
Creates a node group. |
550 |
|
551 |
If the optional bool *dry-run* argument is provided, the job will not be |
552 |
actually executed, only the pre-execution checks will be done. |
553 |
|
554 |
Returns: a job ID that can be used later for polling. |
555 |
|
556 |
Body parameters: |
557 |
|
558 |
.. opcode_params:: OP_GROUP_ADD |
559 |
|
560 |
Earlier versions used a parameter named ``name`` which, while still |
561 |
supported, has been renamed to ``group_name``. |
562 |
|
563 |
Job result: |
564 |
|
565 |
.. opcode_result:: OP_GROUP_ADD |
566 |
|
567 |
|
568 |
.. _rapi-res-groups-group_name: |
569 |
|
570 |
``/2/groups/[group_name]`` |
571 |
++++++++++++++++++++++++++ |
572 |
|
573 |
Returns information about a node group. |
574 |
|
575 |
It supports the following commands: ``GET``, ``DELETE``. |
576 |
|
577 |
.. _rapi-res-groups-group_name+get: |
578 |
|
579 |
``GET`` |
580 |
~~~~~~~ |
581 |
|
582 |
Returns information about a node group, similar to the bulk output from |
583 |
the node group list. |
584 |
|
585 |
Returned fields: :pyeval:`utils.CommaJoin(sorted(rlib2.G_FIELDS))`. |
586 |
|
587 |
.. _rapi-res-groups-group_name+delete: |
588 |
|
589 |
``DELETE`` |
590 |
~~~~~~~~~~ |
591 |
|
592 |
Deletes a node group. |
593 |
|
594 |
It supports the ``dry-run`` argument. |
595 |
|
596 |
Job result: |
597 |
|
598 |
.. opcode_result:: OP_GROUP_REMOVE |
599 |
|
600 |
|
601 |
.. _rapi-res-groups-group_name-modify: |
602 |
|
603 |
``/2/groups/[group_name]/modify`` |
604 |
+++++++++++++++++++++++++++++++++ |
605 |
|
606 |
Modifies the parameters of a node group. |
607 |
|
608 |
Supports the following commands: ``PUT``. |
609 |
|
610 |
.. _rapi-res-groups-group_name-modify+put: |
611 |
|
612 |
``PUT`` |
613 |
~~~~~~~ |
614 |
|
615 |
Returns a job ID. |
616 |
|
617 |
Body parameters: |
618 |
|
619 |
.. opcode_params:: OP_GROUP_SET_PARAMS |
620 |
:exclude: group_name |
621 |
|
622 |
Job result: |
623 |
|
624 |
.. opcode_result:: OP_GROUP_SET_PARAMS |
625 |
|
626 |
|
627 |
.. _rapi-res-groups-group_name-rename: |
628 |
|
629 |
``/2/groups/[group_name]/rename`` |
630 |
+++++++++++++++++++++++++++++++++ |
631 |
|
632 |
Renames a node group. |
633 |
|
634 |
Supports the following commands: ``PUT``. |
635 |
|
636 |
.. _rapi-res-groups-group_name-rename+put: |
637 |
|
638 |
``PUT`` |
639 |
~~~~~~~ |
640 |
|
641 |
Returns a job ID. |
642 |
|
643 |
Body parameters: |
644 |
|
645 |
.. opcode_params:: OP_GROUP_RENAME |
646 |
:exclude: group_name |
647 |
|
648 |
Job result: |
649 |
|
650 |
.. opcode_result:: OP_GROUP_RENAME |
651 |
|
652 |
|
653 |
.. _rapi-res-groups-group_name-assign-nodes: |
654 |
|
655 |
``/2/groups/[group_name]/assign-nodes`` |
656 |
+++++++++++++++++++++++++++++++++++++++ |
657 |
|
658 |
Assigns nodes to a group. |
659 |
|
660 |
Supports the following commands: ``PUT``. |
661 |
|
662 |
.. _rapi-res-groups-group_name-assign-nodes+put: |
663 |
|
664 |
``PUT`` |
665 |
~~~~~~~ |
666 |
|
667 |
Returns a job ID. It supports the ``dry-run`` and ``force`` arguments. |
668 |
|
669 |
Body parameters: |
670 |
|
671 |
.. opcode_params:: OP_GROUP_ASSIGN_NODES |
672 |
:exclude: group_name, force, dry_run |
673 |
|
674 |
Job result: |
675 |
|
676 |
.. opcode_result:: OP_GROUP_ASSIGN_NODES |
677 |
|
678 |
.. _rapi-res-groups-group_name-tags: |
679 |
|
680 |
``/2/groups/[group_name]/tags`` |
681 |
+++++++++++++++++++++++++++++++ |
682 |
|
683 |
Manages per-nodegroup tags. |
684 |
|
685 |
Supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
686 |
|
687 |
.. _rapi-res-groups-group_name-tags+get: |
688 |
|
689 |
``GET`` |
690 |
~~~~~~~ |
691 |
|
692 |
Returns a list of tags. |
693 |
|
694 |
Example:: |
695 |
|
696 |
["tag1", "tag2", "tag3"] |
697 |
|
698 |
.. _rapi-res-groups-group_name-tags+put: |
699 |
|
700 |
``PUT`` |
701 |
~~~~~~~ |
702 |
|
703 |
Add a set of tags. |
704 |
|
705 |
The request as a list of strings should be ``PUT`` to this URI. The |
706 |
result will be a job id. |
707 |
|
708 |
It supports the ``dry-run`` argument. |
709 |
|
710 |
|
711 |
.. _rapi-res-groups-group_name-tags+delete: |
712 |
|
713 |
``DELETE`` |
714 |
~~~~~~~~~~ |
715 |
|
716 |
Delete a tag. |
717 |
|
718 |
In order to delete a set of tags, the DELETE request should be addressed |
719 |
to URI like:: |
720 |
|
721 |
/tags?tag=[tag]&tag=[tag] |
722 |
|
723 |
It supports the ``dry-run`` argument. |
724 |
|
725 |
|
726 |
.. _rapi-res-networks: |
727 |
|
728 |
``/2/networks`` |
729 |
+++++++++++++++ |
730 |
|
731 |
The networks resource. |
732 |
|
733 |
It supports the following commands: ``GET``, ``POST``. |
734 |
|
735 |
|
736 |
.. _rapi-res-networks+get: |
737 |
|
738 |
``GET`` |
739 |
~~~~~~~ |
740 |
|
741 |
Returns a list of all existing networks. |
742 |
|
743 |
Example:: |
744 |
|
745 |
[ |
746 |
{ |
747 |
"name": "network1", |
748 |
"uri": "\/2\/networks\/network1" |
749 |
}, |
750 |
{ |
751 |
"name": "network2", |
752 |
"uri": "\/2\/networks\/network2" |
753 |
} |
754 |
] |
755 |
|
756 |
If the optional bool *bulk* argument is provided and set to a true value |
757 |
(i.e ``?bulk=1``), the output contains detailed information about networks |
758 |
as a list. |
759 |
|
760 |
Returned fields: :pyeval:`utils.CommaJoin(sorted(rlib2.NET_FIELDS))`. |
761 |
|
762 |
Example:: |
763 |
|
764 |
[ |
765 |
{ |
766 |
'external_reservations': '10.0.0.0, 10.0.0.1, 10.0.0.15', |
767 |
'free_count': 13, |
768 |
'gateway': '10.0.0.1', |
769 |
'gateway6': None, |
770 |
'group_list': ['default(bridged, prv0)'], |
771 |
'inst_list': [], |
772 |
'mac_prefix': None, |
773 |
'map': 'XX.............X', |
774 |
'name': 'nat', |
775 |
'network': '10.0.0.0/28', |
776 |
'network6': None, |
777 |
'reserved_count': 3, |
778 |
'tags': ['nfdhcpd'], |
779 |
… |
780 |
}, |
781 |
… |
782 |
] |
783 |
|
784 |
|
785 |
.. _rapi-res-networks+post: |
786 |
|
787 |
``POST`` |
788 |
~~~~~~~~ |
789 |
|
790 |
Creates a network. |
791 |
|
792 |
If the optional bool *dry-run* argument is provided, the job will not be |
793 |
actually executed, only the pre-execution checks will be done. |
794 |
|
795 |
Returns: a job ID that can be used later for polling. |
796 |
|
797 |
Body parameters: |
798 |
|
799 |
.. opcode_params:: OP_NETWORK_ADD |
800 |
|
801 |
Job result: |
802 |
|
803 |
.. opcode_result:: OP_NETWORK_ADD |
804 |
|
805 |
|
806 |
.. _rapi-res-networks-network_name: |
807 |
|
808 |
``/2/networks/[network_name]`` |
809 |
++++++++++++++++++++++++++++++ |
810 |
|
811 |
Returns information about a network. |
812 |
|
813 |
It supports the following commands: ``GET``, ``DELETE``. |
814 |
|
815 |
|
816 |
.. _rapi-res-networks-network_name+get: |
817 |
|
818 |
``GET`` |
819 |
~~~~~~~ |
820 |
|
821 |
Returns information about a network, similar to the bulk output from |
822 |
the network list. |
823 |
|
824 |
Returned fields: :pyeval:`utils.CommaJoin(sorted(rlib2.NET_FIELDS))`. |
825 |
|
826 |
|
827 |
.. _rapi-res-networks-network_name+delete: |
828 |
|
829 |
``DELETE`` |
830 |
~~~~~~~~~~ |
831 |
|
832 |
Deletes a network. |
833 |
|
834 |
It supports the ``dry-run`` argument. |
835 |
|
836 |
Job result: |
837 |
|
838 |
.. opcode_result:: OP_NETWORK_REMOVE |
839 |
|
840 |
|
841 |
.. _rapi-res-networks-network_name-modify: |
842 |
|
843 |
``/2/networks/[network_name]/modify`` |
844 |
+++++++++++++++++++++++++++++++++++++ |
845 |
|
846 |
Modifies the parameters of a network. |
847 |
|
848 |
Supports the following commands: ``PUT``. |
849 |
|
850 |
|
851 |
.. _rapi-res-networks-network_name-modify+put: |
852 |
|
853 |
``PUT`` |
854 |
~~~~~~~ |
855 |
|
856 |
Returns a job ID. |
857 |
|
858 |
Body parameters: |
859 |
|
860 |
.. opcode_params:: OP_NETWORK_SET_PARAMS |
861 |
|
862 |
Job result: |
863 |
|
864 |
.. opcode_result:: OP_NETWORK_SET_PARAMS |
865 |
|
866 |
|
867 |
.. _rapi-res-networks-network_name-connect: |
868 |
|
869 |
``/2/networks/[network_name]/connect`` |
870 |
++++++++++++++++++++++++++++++++++++++ |
871 |
|
872 |
Connects a network to a nodegroup. |
873 |
|
874 |
Supports the following commands: ``PUT``. |
875 |
|
876 |
|
877 |
.. _rapi-res-networks-network_name-connect+put: |
878 |
|
879 |
``PUT`` |
880 |
~~~~~~~ |
881 |
|
882 |
Returns a job ID. It supports the ``dry-run`` arguments. |
883 |
|
884 |
Body parameters: |
885 |
|
886 |
.. opcode_params:: OP_NETWORK_CONNECT |
887 |
|
888 |
Job result: |
889 |
|
890 |
.. opcode_result:: OP_NETWORK_CONNECT |
891 |
|
892 |
|
893 |
.. _rapi-res-networks-network_name-disconnect: |
894 |
|
895 |
``/2/networks/[network_name]/disconnect`` |
896 |
+++++++++++++++++++++++++++++++++++++++++ |
897 |
|
898 |
Disonnects a network from a nodegroup. |
899 |
|
900 |
Supports the following commands: ``PUT``. |
901 |
|
902 |
|
903 |
.. _rapi-res-networks-network_name-disconnect+put: |
904 |
|
905 |
``PUT`` |
906 |
~~~~~~~ |
907 |
|
908 |
Returns a job ID. It supports the ``dry-run`` arguments. |
909 |
|
910 |
Body parameters: |
911 |
|
912 |
.. opcode_params:: OP_NETWORK_DISCONNECT |
913 |
|
914 |
Job result: |
915 |
|
916 |
.. opcode_result:: OP_NETWORK_DISCONNECT |
917 |
|
918 |
|
919 |
.. _rapi-res-networks-network_name-tags: |
920 |
|
921 |
``/2/networks/[network_name]/tags`` |
922 |
+++++++++++++++++++++++++++++++++++ |
923 |
|
924 |
Manages per-network tags. |
925 |
|
926 |
Supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
927 |
|
928 |
|
929 |
.. _rapi-res-networks-network_name-tags+get: |
930 |
|
931 |
``GET`` |
932 |
~~~~~~~ |
933 |
|
934 |
Returns a list of tags. |
935 |
|
936 |
Example:: |
937 |
|
938 |
["tag1", "tag2", "tag3"] |
939 |
|
940 |
|
941 |
.. _rapi-res-networks-network_name-tags+put: |
942 |
|
943 |
``PUT`` |
944 |
~~~~~~~ |
945 |
|
946 |
Add a set of tags. |
947 |
|
948 |
The request as a list of strings should be ``PUT`` to this URI. The |
949 |
result will be a job id. |
950 |
|
951 |
It supports the ``dry-run`` argument. |
952 |
|
953 |
|
954 |
.. _rapi-res-networks-network_name-tags+delete: |
955 |
|
956 |
``DELETE`` |
957 |
~~~~~~~~~~ |
958 |
|
959 |
Delete a tag. |
960 |
|
961 |
In order to delete a set of tags, the DELETE request should be addressed |
962 |
to URI like:: |
963 |
|
964 |
/tags?tag=[tag]&tag=[tag] |
965 |
|
966 |
It supports the ``dry-run`` argument. |
967 |
|
968 |
|
969 |
.. _rapi-res-instances-multi-alloc: |
970 |
|
971 |
``/2/instances-multi-alloc`` |
972 |
++++++++++++++++++++++++++++ |
973 |
|
974 |
Tries to allocate multiple instances. |
975 |
|
976 |
It supports the following commands: ``POST`` |
977 |
|
978 |
|
979 |
.. _rapi-res-instances-multi-alloc+post: |
980 |
|
981 |
``POST`` |
982 |
~~~~~~~~ |
983 |
|
984 |
The parameters: |
985 |
|
986 |
.. opcode_params:: OP_INSTANCE_MULTI_ALLOC |
987 |
|
988 |
Job result: |
989 |
|
990 |
.. opcode_result:: OP_INSTANCE_MULTI_ALLOC |
991 |
|
992 |
|
993 |
.. _rapi-res-instances: |
994 |
|
995 |
``/2/instances`` |
996 |
++++++++++++++++ |
997 |
|
998 |
The instances resource. |
999 |
|
1000 |
It supports the following commands: ``GET``, ``POST``. |
1001 |
|
1002 |
|
1003 |
.. _rapi-res-instances+get: |
1004 |
|
1005 |
``GET`` |
1006 |
~~~~~~~ |
1007 |
|
1008 |
Returns a list of all available instances. |
1009 |
|
1010 |
Example:: |
1011 |
|
1012 |
[ |
1013 |
{ |
1014 |
"name": "web.example.com", |
1015 |
"uri": "\/instances\/web.example.com" |
1016 |
}, |
1017 |
{ |
1018 |
"name": "mail.example.com", |
1019 |
"uri": "\/instances\/mail.example.com" |
1020 |
} |
1021 |
] |
1022 |
|
1023 |
If the optional bool *bulk* argument is provided and set to a true value |
1024 |
(i.e ``?bulk=1``), the output contains detailed information about |
1025 |
instances as a list. |
1026 |
|
1027 |
Returned fields: :pyeval:`utils.CommaJoin(sorted(rlib2.I_FIELDS))`. |
1028 |
|
1029 |
Example:: |
1030 |
|
1031 |
[ |
1032 |
{ |
1033 |
"status": "running", |
1034 |
"disk_usage": 20480, |
1035 |
"nic.bridges": [ |
1036 |
"xen-br0" |
1037 |
], |
1038 |
"name": "web.example.com", |
1039 |
"tags": ["tag1", "tag2"], |
1040 |
"beparams": { |
1041 |
"vcpus": 2, |
1042 |
"memory": 512 |
1043 |
}, |
1044 |
"disk.sizes": [ |
1045 |
20480 |
1046 |
], |
1047 |
"pnode": "node1.example.com", |
1048 |
"nic.macs": ["01:23:45:67:89:01"], |
1049 |
"snodes": ["node2.example.com"], |
1050 |
"disk_template": "drbd", |
1051 |
"admin_state": true, |
1052 |
"os": "debian-etch", |
1053 |
"oper_state": true, |
1054 |
… |
1055 |
}, |
1056 |
… |
1057 |
] |
1058 |
|
1059 |
|
1060 |
.. _rapi-res-instances+post: |
1061 |
|
1062 |
``POST`` |
1063 |
~~~~~~~~ |
1064 |
|
1065 |
Creates an instance. |
1066 |
|
1067 |
If the optional bool *dry-run* argument is provided, the job will not be |
1068 |
actually executed, only the pre-execution checks will be done. Query-ing |
1069 |
the job result will return, in both dry-run and normal case, the list of |
1070 |
nodes selected for the instance. |
1071 |
|
1072 |
Returns: a job ID that can be used later for polling. |
1073 |
|
1074 |
Body parameters: |
1075 |
|
1076 |
``__version__`` (int, required) |
1077 |
Must be ``1`` (older Ganeti versions used a different format for |
1078 |
instance creation requests, version ``0``, but that format is no |
1079 |
longer supported) |
1080 |
|
1081 |
.. opcode_params:: OP_INSTANCE_CREATE |
1082 |
|
1083 |
Earlier versions used parameters named ``name`` and ``os``. These have |
1084 |
been replaced by ``instance_name`` and ``os_type`` to match the |
1085 |
underlying opcode. The old names can still be used. |
1086 |
|
1087 |
Job result: |
1088 |
|
1089 |
.. opcode_result:: OP_INSTANCE_CREATE |
1090 |
|
1091 |
|
1092 |
.. _rapi-res-instances-instance_name: |
1093 |
|
1094 |
``/2/instances/[instance_name]`` |
1095 |
++++++++++++++++++++++++++++++++ |
1096 |
|
1097 |
Instance-specific resource. |
1098 |
|
1099 |
It supports the following commands: ``GET``, ``DELETE``. |
1100 |
|
1101 |
|
1102 |
.. _rapi-res-instances-instance_name+get: |
1103 |
|
1104 |
``GET`` |
1105 |
~~~~~~~ |
1106 |
|
1107 |
Returns information about an instance, similar to the bulk output from |
1108 |
the instance list. |
1109 |
|
1110 |
Returned fields: :pyeval:`utils.CommaJoin(sorted(rlib2.I_FIELDS))`. |
1111 |
|
1112 |
|
1113 |
.. _rapi-res-instances-instance_name+delete: |
1114 |
|
1115 |
``DELETE`` |
1116 |
~~~~~~~~~~ |
1117 |
|
1118 |
Deletes an instance. |
1119 |
|
1120 |
It supports the ``dry-run`` argument. |
1121 |
|
1122 |
Job result: |
1123 |
|
1124 |
.. opcode_result:: OP_INSTANCE_REMOVE |
1125 |
|
1126 |
|
1127 |
.. _rapi-res-instances-instance_name-info: |
1128 |
|
1129 |
``/2/instances/[instance_name]/info`` |
1130 |
+++++++++++++++++++++++++++++++++++++++ |
1131 |
|
1132 |
It supports the following commands: ``GET``. |
1133 |
|
1134 |
|
1135 |
.. _rapi-res-instances-instance_name-info+get: |
1136 |
|
1137 |
``GET`` |
1138 |
~~~~~~~ |
1139 |
|
1140 |
Requests detailed information about the instance. An optional parameter, |
1141 |
``static`` (bool), can be set to return only static information from the |
1142 |
configuration without querying the instance's nodes. The result will be |
1143 |
a job id. |
1144 |
|
1145 |
Job result: |
1146 |
|
1147 |
.. opcode_result:: OP_INSTANCE_QUERY_DATA |
1148 |
|
1149 |
|
1150 |
.. _rapi-res-instances-instance_name-reboot: |
1151 |
|
1152 |
``/2/instances/[instance_name]/reboot`` |
1153 |
+++++++++++++++++++++++++++++++++++++++ |
1154 |
|
1155 |
Reboots URI for an instance. |
1156 |
|
1157 |
It supports the following commands: ``POST``. |
1158 |
|
1159 |
|
1160 |
.. _rapi-res-instances-instance_name-reboot+post: |
1161 |
|
1162 |
``POST`` |
1163 |
~~~~~~~~ |
1164 |
|
1165 |
Reboots the instance. |
1166 |
|
1167 |
The URI takes optional ``type=soft|hard|full`` and |
1168 |
``ignore_secondaries=0|1`` parameters. |
1169 |
|
1170 |
``type`` defines the reboot type. ``soft`` is just a normal reboot, |
1171 |
without terminating the hypervisor. ``hard`` means full shutdown |
1172 |
(including terminating the hypervisor process) and startup again. |
1173 |
``full`` is like ``hard`` but also recreates the configuration from |
1174 |
ground up as if you would have done a ``gnt-instance shutdown`` and |
1175 |
``gnt-instance start`` on it. |
1176 |
|
1177 |
``ignore_secondaries`` is a bool argument indicating if we start the |
1178 |
instance even if secondary disks are failing. |
1179 |
|
1180 |
It supports the ``dry-run`` argument. |
1181 |
|
1182 |
Job result: |
1183 |
|
1184 |
.. opcode_result:: OP_INSTANCE_REBOOT |
1185 |
|
1186 |
|
1187 |
.. _rapi-res-instances-instance_name-shutdown: |
1188 |
|
1189 |
``/2/instances/[instance_name]/shutdown`` |
1190 |
+++++++++++++++++++++++++++++++++++++++++ |
1191 |
|
1192 |
Instance shutdown URI. |
1193 |
|
1194 |
It supports the following commands: ``PUT``. |
1195 |
|
1196 |
|
1197 |
.. _rapi-res-instances-instance_name-shutdown+put: |
1198 |
|
1199 |
``PUT`` |
1200 |
~~~~~~~ |
1201 |
|
1202 |
Shutdowns an instance. |
1203 |
|
1204 |
It supports the ``dry-run`` argument. |
1205 |
|
1206 |
.. opcode_params:: OP_INSTANCE_SHUTDOWN |
1207 |
:exclude: instance_name, dry_run |
1208 |
|
1209 |
Job result: |
1210 |
|
1211 |
.. opcode_result:: OP_INSTANCE_SHUTDOWN |
1212 |
|
1213 |
|
1214 |
.. _rapi-res-instances-instance_name-startup: |
1215 |
|
1216 |
``/2/instances/[instance_name]/startup`` |
1217 |
++++++++++++++++++++++++++++++++++++++++ |
1218 |
|
1219 |
Instance startup URI. |
1220 |
|
1221 |
It supports the following commands: ``PUT``. |
1222 |
|
1223 |
|
1224 |
.. _rapi-res-instances-instance_name-startup+put: |
1225 |
|
1226 |
``PUT`` |
1227 |
~~~~~~~ |
1228 |
|
1229 |
Startup an instance. |
1230 |
|
1231 |
The URI takes an optional ``force=1|0`` parameter to start the |
1232 |
instance even if secondary disks are failing. |
1233 |
|
1234 |
It supports the ``dry-run`` argument. |
1235 |
|
1236 |
Job result: |
1237 |
|
1238 |
.. opcode_result:: OP_INSTANCE_STARTUP |
1239 |
|
1240 |
|
1241 |
.. _rapi-res-instances-instance_name-reinstall: |
1242 |
|
1243 |
``/2/instances/[instance_name]/reinstall`` |
1244 |
++++++++++++++++++++++++++++++++++++++++++++++ |
1245 |
|
1246 |
Installs the operating system again. |
1247 |
|
1248 |
It supports the following commands: ``POST``. |
1249 |
|
1250 |
|
1251 |
.. _rapi-res-instances-instance_name-reinstall+post: |
1252 |
|
1253 |
``POST`` |
1254 |
~~~~~~~~ |
1255 |
|
1256 |
Returns a job ID. |
1257 |
|
1258 |
Body parameters: |
1259 |
|
1260 |
``os`` (string, required) |
1261 |
Instance operating system. |
1262 |
``start`` (bool, defaults to true) |
1263 |
Whether to start instance after reinstallation. |
1264 |
``osparams`` (dict) |
1265 |
Dictionary with (temporary) OS parameters. |
1266 |
|
1267 |
For backwards compatbility, this resource also takes the query |
1268 |
parameters ``os`` (OS template name) and ``nostartup`` (bool). New |
1269 |
clients should use the body parameters. |
1270 |
|
1271 |
|
1272 |
.. _rapi-res-instances-instance_name-replace-disks: |
1273 |
|
1274 |
``/2/instances/[instance_name]/replace-disks`` |
1275 |
++++++++++++++++++++++++++++++++++++++++++++++ |
1276 |
|
1277 |
Replaces disks on an instance. |
1278 |
|
1279 |
It supports the following commands: ``POST``. |
1280 |
|
1281 |
|
1282 |
.. _rapi-res-instances-instance_name-replace-disks+post: |
1283 |
|
1284 |
``POST`` |
1285 |
~~~~~~~~ |
1286 |
|
1287 |
Returns a job ID. |
1288 |
|
1289 |
Body parameters: |
1290 |
|
1291 |
.. opcode_params:: OP_INSTANCE_REPLACE_DISKS |
1292 |
:exclude: instance_name |
1293 |
|
1294 |
Ganeti 2.4 and below used query parameters. Those are deprecated and |
1295 |
should no longer be used. |
1296 |
|
1297 |
Job result: |
1298 |
|
1299 |
.. opcode_result:: OP_INSTANCE_REPLACE_DISKS |
1300 |
|
1301 |
|
1302 |
.. _rapi-res-instances-instance_name-activate-disks: |
1303 |
|
1304 |
``/2/instances/[instance_name]/activate-disks`` |
1305 |
+++++++++++++++++++++++++++++++++++++++++++++++ |
1306 |
|
1307 |
Activate disks on an instance. |
1308 |
|
1309 |
It supports the following commands: ``PUT``. |
1310 |
|
1311 |
|
1312 |
.. _rapi-res-instances-instance_name-activate-disks+put: |
1313 |
|
1314 |
``PUT`` |
1315 |
~~~~~~~ |
1316 |
|
1317 |
Takes the bool parameter ``ignore_size``. When set ignore the recorded |
1318 |
size (useful for forcing activation when recorded size is wrong). |
1319 |
|
1320 |
Job result: |
1321 |
|
1322 |
.. opcode_result:: OP_INSTANCE_ACTIVATE_DISKS |
1323 |
|
1324 |
|
1325 |
.. _rapi-res-instances-instance_name-deactivate-disks: |
1326 |
|
1327 |
``/2/instances/[instance_name]/deactivate-disks`` |
1328 |
+++++++++++++++++++++++++++++++++++++++++++++++++ |
1329 |
|
1330 |
Deactivate disks on an instance. |
1331 |
|
1332 |
It supports the following commands: ``PUT``. |
1333 |
|
1334 |
|
1335 |
.. _rapi-res-instances-instance_name-deactivate-disks+put: |
1336 |
|
1337 |
``PUT`` |
1338 |
~~~~~~~ |
1339 |
|
1340 |
Takes no parameters. |
1341 |
|
1342 |
Job result: |
1343 |
|
1344 |
.. opcode_result:: OP_INSTANCE_DEACTIVATE_DISKS |
1345 |
|
1346 |
|
1347 |
.. _rapi-res-instances-instance_name-recreate-disks: |
1348 |
|
1349 |
``/2/instances/[instance_name]/recreate-disks`` |
1350 |
+++++++++++++++++++++++++++++++++++++++++++++++++ |
1351 |
|
1352 |
Recreate disks of an instance. Supports the following commands: |
1353 |
``POST``. |
1354 |
|
1355 |
|
1356 |
.. _rapi-res-instances-instance_name-recreate-disks+post: |
1357 |
|
1358 |
``POST`` |
1359 |
~~~~~~~~ |
1360 |
|
1361 |
Returns a job ID. |
1362 |
|
1363 |
Body parameters: |
1364 |
|
1365 |
.. opcode_params:: OP_INSTANCE_RECREATE_DISKS |
1366 |
:exclude: instance_name |
1367 |
|
1368 |
Job result: |
1369 |
|
1370 |
.. opcode_result:: OP_INSTANCE_RECREATE_DISKS |
1371 |
|
1372 |
|
1373 |
.. _rapi-res-instances-instance_name-disk-disk_index-grow: |
1374 |
|
1375 |
``/2/instances/[instance_name]/disk/[disk_index]/grow`` |
1376 |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1377 |
|
1378 |
Grows one disk of an instance. |
1379 |
|
1380 |
Supports the following commands: ``POST``. |
1381 |
|
1382 |
|
1383 |
.. _rapi-res-instances-instance_name-disk-disk_index-grow+post: |
1384 |
|
1385 |
``POST`` |
1386 |
~~~~~~~~ |
1387 |
|
1388 |
Returns a job ID. |
1389 |
|
1390 |
Body parameters: |
1391 |
|
1392 |
.. opcode_params:: OP_INSTANCE_GROW_DISK |
1393 |
:exclude: instance_name, disk |
1394 |
|
1395 |
Job result: |
1396 |
|
1397 |
.. opcode_result:: OP_INSTANCE_GROW_DISK |
1398 |
|
1399 |
|
1400 |
.. _rapi-res-instances-instance_name-prepare-export: |
1401 |
|
1402 |
``/2/instances/[instance_name]/prepare-export`` |
1403 |
+++++++++++++++++++++++++++++++++++++++++++++++++ |
1404 |
|
1405 |
Prepares an export of an instance. |
1406 |
|
1407 |
It supports the following commands: ``PUT``. |
1408 |
|
1409 |
|
1410 |
.. _rapi-res-instances-instance_name-prepare-export+put: |
1411 |
|
1412 |
``PUT`` |
1413 |
~~~~~~~ |
1414 |
|
1415 |
Takes one parameter, ``mode``, for the export mode. Returns a job ID. |
1416 |
|
1417 |
Job result: |
1418 |
|
1419 |
.. opcode_result:: OP_BACKUP_PREPARE |
1420 |
|
1421 |
|
1422 |
.. _rapi-res-instances-instance_name-export: |
1423 |
|
1424 |
``/2/instances/[instance_name]/export`` |
1425 |
+++++++++++++++++++++++++++++++++++++++++++++++++ |
1426 |
|
1427 |
Exports an instance. |
1428 |
|
1429 |
It supports the following commands: ``PUT``. |
1430 |
|
1431 |
|
1432 |
.. _rapi-res-instances-instance_name-export+put: |
1433 |
|
1434 |
``PUT`` |
1435 |
~~~~~~~ |
1436 |
|
1437 |
Returns a job ID. |
1438 |
|
1439 |
Body parameters: |
1440 |
|
1441 |
.. opcode_params:: OP_BACKUP_EXPORT |
1442 |
:exclude: instance_name |
1443 |
:alias: target_node=destination |
1444 |
|
1445 |
Job result: |
1446 |
|
1447 |
.. opcode_result:: OP_BACKUP_EXPORT |
1448 |
|
1449 |
|
1450 |
.. _rapi-res-instances-instance_name-migrate: |
1451 |
|
1452 |
``/2/instances/[instance_name]/migrate`` |
1453 |
++++++++++++++++++++++++++++++++++++++++ |
1454 |
|
1455 |
Migrates an instance. |
1456 |
|
1457 |
Supports the following commands: ``PUT``. |
1458 |
|
1459 |
|
1460 |
.. _rapi-res-instances-instance_name-migrate+put: |
1461 |
|
1462 |
``PUT`` |
1463 |
~~~~~~~ |
1464 |
|
1465 |
Returns a job ID. |
1466 |
|
1467 |
Body parameters: |
1468 |
|
1469 |
.. opcode_params:: OP_INSTANCE_MIGRATE |
1470 |
:exclude: instance_name, live |
1471 |
|
1472 |
Job result: |
1473 |
|
1474 |
.. opcode_result:: OP_INSTANCE_MIGRATE |
1475 |
|
1476 |
|
1477 |
.. _rapi-res-instances-instance_name-failover: |
1478 |
|
1479 |
``/2/instances/[instance_name]/failover`` |
1480 |
+++++++++++++++++++++++++++++++++++++++++ |
1481 |
|
1482 |
Does a failover of an instance. |
1483 |
|
1484 |
Supports the following commands: ``PUT``. |
1485 |
|
1486 |
|
1487 |
.. _rapi-res-instances-instance_name-failover+put: |
1488 |
|
1489 |
``PUT`` |
1490 |
~~~~~~~ |
1491 |
|
1492 |
Returns a job ID. |
1493 |
|
1494 |
Body parameters: |
1495 |
|
1496 |
.. opcode_params:: OP_INSTANCE_FAILOVER |
1497 |
:exclude: instance_name |
1498 |
|
1499 |
Job result: |
1500 |
|
1501 |
.. opcode_result:: OP_INSTANCE_FAILOVER |
1502 |
|
1503 |
|
1504 |
.. _rapi-res-instances-instance_name-rename: |
1505 |
|
1506 |
``/2/instances/[instance_name]/rename`` |
1507 |
++++++++++++++++++++++++++++++++++++++++ |
1508 |
|
1509 |
Renames an instance. |
1510 |
|
1511 |
Supports the following commands: ``PUT``. |
1512 |
|
1513 |
|
1514 |
.. _rapi-res-instances-instance_name-rename+put: |
1515 |
|
1516 |
``PUT`` |
1517 |
~~~~~~~ |
1518 |
|
1519 |
Returns a job ID. |
1520 |
|
1521 |
Body parameters: |
1522 |
|
1523 |
.. opcode_params:: OP_INSTANCE_RENAME |
1524 |
:exclude: instance_name |
1525 |
|
1526 |
Job result: |
1527 |
|
1528 |
.. opcode_result:: OP_INSTANCE_RENAME |
1529 |
|
1530 |
|
1531 |
.. _rapi-res-instances-instance_name-modify: |
1532 |
|
1533 |
``/2/instances/[instance_name]/modify`` |
1534 |
++++++++++++++++++++++++++++++++++++++++ |
1535 |
|
1536 |
Modifies an instance. |
1537 |
|
1538 |
Supports the following commands: ``PUT``. |
1539 |
|
1540 |
|
1541 |
.. _rapi-res-instances-instance_name-modify+put: |
1542 |
|
1543 |
``PUT`` |
1544 |
~~~~~~~ |
1545 |
|
1546 |
Returns a job ID. |
1547 |
|
1548 |
Body parameters: |
1549 |
|
1550 |
.. opcode_params:: OP_INSTANCE_SET_PARAMS |
1551 |
:exclude: instance_name |
1552 |
|
1553 |
Job result: |
1554 |
|
1555 |
.. opcode_result:: OP_INSTANCE_SET_PARAMS |
1556 |
|
1557 |
|
1558 |
.. _rapi-res-instances-instance_name-console: |
1559 |
|
1560 |
``/2/instances/[instance_name]/console`` |
1561 |
++++++++++++++++++++++++++++++++++++++++ |
1562 |
|
1563 |
Request information for connecting to instance's console. |
1564 |
|
1565 |
.. pyassert:: |
1566 |
|
1567 |
not (hasattr(rlib2.R_2_instances_name_console, "PUT") or |
1568 |
hasattr(rlib2.R_2_instances_name_console, "POST") or |
1569 |
hasattr(rlib2.R_2_instances_name_console, "DELETE")) |
1570 |
|
1571 |
Supports the following commands: ``GET``. Requires authentication with |
1572 |
one of the following options: |
1573 |
:pyeval:`utils.CommaJoin(rlib2.R_2_instances_name_console.GET_ACCESS)`. |
1574 |
|
1575 |
|
1576 |
.. _rapi-res-instances-instance_name-console+get: |
1577 |
|
1578 |
``GET`` |
1579 |
~~~~~~~ |
1580 |
|
1581 |
Returns a dictionary containing information about the instance's |
1582 |
console. Contained keys: |
1583 |
|
1584 |
.. pyassert:: |
1585 |
|
1586 |
constants.CONS_ALL == frozenset([ |
1587 |
constants.CONS_MESSAGE, |
1588 |
constants.CONS_SSH, |
1589 |
constants.CONS_VNC, |
1590 |
constants.CONS_SPICE, |
1591 |
]) |
1592 |
|
1593 |
.. pyassert:: |
1594 |
|
1595 |
frozenset(objects.InstanceConsole.GetAllSlots()) == frozenset([ |
1596 |
"command", |
1597 |
"display", |
1598 |
"host", |
1599 |
"instance", |
1600 |
"kind", |
1601 |
"message", |
1602 |
"port", |
1603 |
"user", |
1604 |
]) |
1605 |
|
1606 |
|
1607 |
``instance`` |
1608 |
Instance name |
1609 |
``kind`` |
1610 |
Console type, one of :pyeval:`constants.CONS_SSH`, |
1611 |
:pyeval:`constants.CONS_VNC`, :pyeval:`constants.CONS_SPICE` |
1612 |
or :pyeval:`constants.CONS_MESSAGE` |
1613 |
``message`` |
1614 |
Message to display (:pyeval:`constants.CONS_MESSAGE` type only) |
1615 |
``host`` |
1616 |
Host to connect to (:pyeval:`constants.CONS_SSH`, |
1617 |
:pyeval:`constants.CONS_VNC` or :pyeval:`constants.CONS_SPICE` only) |
1618 |
``port`` |
1619 |
TCP port to connect to (:pyeval:`constants.CONS_VNC` or |
1620 |
:pyeval:`constants.CONS_SPICE` only) |
1621 |
``user`` |
1622 |
Username to use (:pyeval:`constants.CONS_SSH` only) |
1623 |
``command`` |
1624 |
Command to execute on machine (:pyeval:`constants.CONS_SSH` only) |
1625 |
``display`` |
1626 |
VNC display number (:pyeval:`constants.CONS_VNC` only) |
1627 |
|
1628 |
|
1629 |
.. _rapi-res-instances-instance_name-tags: |
1630 |
|
1631 |
``/2/instances/[instance_name]/tags`` |
1632 |
+++++++++++++++++++++++++++++++++++++ |
1633 |
|
1634 |
Manages per-instance tags. |
1635 |
|
1636 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
1637 |
|
1638 |
|
1639 |
.. _rapi-res-instances-instance_name-tags+get: |
1640 |
|
1641 |
``GET`` |
1642 |
~~~~~~~ |
1643 |
|
1644 |
Returns a list of tags. |
1645 |
|
1646 |
Example:: |
1647 |
|
1648 |
["tag1", "tag2", "tag3"] |
1649 |
|
1650 |
|
1651 |
.. _rapi-res-instances-instance_name-tags+put: |
1652 |
|
1653 |
``PUT`` |
1654 |
~~~~~~~ |
1655 |
|
1656 |
Add a set of tags. |
1657 |
|
1658 |
The request as a list of strings should be ``PUT`` to this URI. The |
1659 |
result will be a job id. |
1660 |
|
1661 |
It supports the ``dry-run`` argument. |
1662 |
|
1663 |
|
1664 |
.. _rapi-res-instances-instance_name-tags+delete: |
1665 |
|
1666 |
``DELETE`` |
1667 |
~~~~~~~~~~ |
1668 |
|
1669 |
Delete a tag. |
1670 |
|
1671 |
In order to delete a set of tags, the DELETE request should be addressed |
1672 |
to URI like:: |
1673 |
|
1674 |
/tags?tag=[tag]&tag=[tag] |
1675 |
|
1676 |
It supports the ``dry-run`` argument. |
1677 |
|
1678 |
|
1679 |
.. _rapi-res-jobs: |
1680 |
|
1681 |
``/2/jobs`` |
1682 |
+++++++++++ |
1683 |
|
1684 |
The ``/2/jobs`` resource. |
1685 |
|
1686 |
It supports the following commands: ``GET``. |
1687 |
|
1688 |
|
1689 |
.. _rapi-res-jobs+get: |
1690 |
|
1691 |
``GET`` |
1692 |
~~~~~~~ |
1693 |
|
1694 |
Returns a dictionary of jobs. |
1695 |
|
1696 |
Returns: a dictionary with jobs id and uri. |
1697 |
|
1698 |
If the optional bool *bulk* argument is provided and set to a true value |
1699 |
(i.e. ``?bulk=1``), the output contains detailed information about jobs |
1700 |
as a list. |
1701 |
|
1702 |
Returned fields for bulk requests (unlike other bulk requests, these |
1703 |
fields are not the same as for per-job requests): |
1704 |
:pyeval:`utils.CommaJoin(sorted(rlib2.J_FIELDS_BULK))`. |
1705 |
|
1706 |
|
1707 |
.. _rapi-res-jobs-job_id: |
1708 |
|
1709 |
``/2/jobs/[job_id]`` |
1710 |
++++++++++++++++++++ |
1711 |
|
1712 |
|
1713 |
Individual job URI. |
1714 |
|
1715 |
It supports the following commands: ``GET``, ``DELETE``. |
1716 |
|
1717 |
|
1718 |
.. _rapi-res-jobs-job_id+get: |
1719 |
|
1720 |
``GET`` |
1721 |
~~~~~~~ |
1722 |
|
1723 |
Returns a dictionary with job parameters, containing the fields |
1724 |
:pyeval:`utils.CommaJoin(sorted(rlib2.J_FIELDS))`. |
1725 |
|
1726 |
The result includes: |
1727 |
|
1728 |
- id: job ID as a number |
1729 |
- status: current job status as a string |
1730 |
- ops: involved OpCodes as a list of dictionaries for each opcodes in |
1731 |
the job |
1732 |
- opstatus: OpCodes status as a list |
1733 |
- opresult: OpCodes results as a list |
1734 |
|
1735 |
For a successful opcode, the ``opresult`` field corresponding to it will |
1736 |
contain the raw result from its :term:`LogicalUnit`. In case an opcode |
1737 |
has failed, its element in the opresult list will be a list of two |
1738 |
elements: |
1739 |
|
1740 |
- first element the error type (the Ganeti internal error name) |
1741 |
- second element a list of either one or two elements: |
1742 |
|
1743 |
- the first element is the textual error description |
1744 |
- the second element, if any, will hold an error classification |
1745 |
|
1746 |
The error classification is most useful for the ``OpPrereqError`` |
1747 |
error type - these errors happen before the OpCode has started |
1748 |
executing, so it's possible to retry the OpCode without side |
1749 |
effects. But whether it make sense to retry depends on the error |
1750 |
classification: |
1751 |
|
1752 |
.. pyassert:: |
1753 |
|
1754 |
errors.ECODE_ALL == set([errors.ECODE_RESOLVER, errors.ECODE_NORES, |
1755 |
errors.ECODE_INVAL, errors.ECODE_STATE, errors.ECODE_NOENT, |
1756 |
errors.ECODE_EXISTS, errors.ECODE_NOTUNIQUE, errors.ECODE_FAULT, |
1757 |
errors.ECODE_ENVIRON, errors.ECODE_TEMP_NORES]) |
1758 |
|
1759 |
:pyeval:`errors.ECODE_RESOLVER` |
1760 |
Resolver errors. This usually means that a name doesn't exist in DNS, |
1761 |
so if it's a case of slow DNS propagation the operation can be retried |
1762 |
later. |
1763 |
|
1764 |
:pyeval:`errors.ECODE_NORES` |
1765 |
Not enough resources (iallocator failure, disk space, memory, |
1766 |
etc.). If the resources on the cluster increase, the operation might |
1767 |
succeed. |
1768 |
|
1769 |
:pyeval:`errors.ECODE_TEMP_NORES` |
1770 |
Simliar to :pyeval:`errors.ECODE_NORES`, but indicating the operation |
1771 |
should be attempted again after some time. |
1772 |
|
1773 |
:pyeval:`errors.ECODE_INVAL` |
1774 |
Wrong arguments (at syntax level). The operation will not ever be |
1775 |
accepted unless the arguments change. |
1776 |
|
1777 |
:pyeval:`errors.ECODE_STATE` |
1778 |
Wrong entity state. For example, live migration has been requested for |
1779 |
a down instance, or instance creation on an offline node. The |
1780 |
operation can be retried once the resource has changed state. |
1781 |
|
1782 |
:pyeval:`errors.ECODE_NOENT` |
1783 |
Entity not found. For example, information has been requested for an |
1784 |
unknown instance. |
1785 |
|
1786 |
:pyeval:`errors.ECODE_EXISTS` |
1787 |
Entity already exists. For example, instance creation has been |
1788 |
requested for an already-existing instance. |
1789 |
|
1790 |
:pyeval:`errors.ECODE_NOTUNIQUE` |
1791 |
Resource not unique (e.g. MAC or IP duplication). |
1792 |
|
1793 |
:pyeval:`errors.ECODE_FAULT` |
1794 |
Internal cluster error. For example, a node is unreachable but not set |
1795 |
offline, or the ganeti node daemons are not working, etc. A |
1796 |
``gnt-cluster verify`` should be run. |
1797 |
|
1798 |
:pyeval:`errors.ECODE_ENVIRON` |
1799 |
Environment error (e.g. node disk error). A ``gnt-cluster verify`` |
1800 |
should be run. |
1801 |
|
1802 |
Note that in the above list, by entity we refer to a node or instance, |
1803 |
while by a resource we refer to an instance's disk, or NIC, etc. |
1804 |
|
1805 |
|
1806 |
.. _rapi-res-jobs-job_id+delete: |
1807 |
|
1808 |
``DELETE`` |
1809 |
~~~~~~~~~~ |
1810 |
|
1811 |
Cancel a not-yet-started job. |
1812 |
|
1813 |
|
1814 |
.. _rapi-res-jobs-job_id-wait: |
1815 |
|
1816 |
``/2/jobs/[job_id]/wait`` |
1817 |
+++++++++++++++++++++++++ |
1818 |
|
1819 |
|
1820 |
.. _rapi-res-jobs-job_id-wait+get: |
1821 |
|
1822 |
``GET`` |
1823 |
~~~~~~~ |
1824 |
|
1825 |
Waits for changes on a job. Takes the following body parameters in a |
1826 |
dict: |
1827 |
|
1828 |
``fields`` |
1829 |
The job fields on which to watch for changes |
1830 |
|
1831 |
``previous_job_info`` |
1832 |
Previously received field values or None if not yet available |
1833 |
|
1834 |
``previous_log_serial`` |
1835 |
Highest log serial number received so far or None if not yet |
1836 |
available |
1837 |
|
1838 |
Returns None if no changes have been detected and a dict with two keys, |
1839 |
``job_info`` and ``log_entries`` otherwise. |
1840 |
|
1841 |
|
1842 |
.. _rapi-res-nodes: |
1843 |
|
1844 |
``/2/nodes`` |
1845 |
++++++++++++ |
1846 |
|
1847 |
Nodes resource. |
1848 |
|
1849 |
It supports the following commands: ``GET``. |
1850 |
|
1851 |
|
1852 |
.. _rapi-res-nodes+get: |
1853 |
|
1854 |
``GET`` |
1855 |
~~~~~~~ |
1856 |
|
1857 |
Returns a list of all nodes. |
1858 |
|
1859 |
Example:: |
1860 |
|
1861 |
[ |
1862 |
{ |
1863 |
"id": "node1.example.com", |
1864 |
"uri": "\/nodes\/node1.example.com" |
1865 |
}, |
1866 |
{ |
1867 |
"id": "node2.example.com", |
1868 |
"uri": "\/nodes\/node2.example.com" |
1869 |
} |
1870 |
] |
1871 |
|
1872 |
If the optional bool *bulk* argument is provided and set to a true value |
1873 |
(i.e ``?bulk=1``), the output contains detailed information about nodes |
1874 |
as a list. |
1875 |
|
1876 |
Returned fields: :pyeval:`utils.CommaJoin(sorted(rlib2.N_FIELDS))`. |
1877 |
|
1878 |
Example:: |
1879 |
|
1880 |
[ |
1881 |
{ |
1882 |
"pinst_cnt": 1, |
1883 |
"mfree": 31280, |
1884 |
"mtotal": 32763, |
1885 |
"name": "www.example.com", |
1886 |
"tags": [], |
1887 |
"mnode": 512, |
1888 |
"dtotal": 5246208, |
1889 |
"sinst_cnt": 2, |
1890 |
"dfree": 5171712, |
1891 |
"offline": false, |
1892 |
… |
1893 |
}, |
1894 |
… |
1895 |
] |
1896 |
|
1897 |
|
1898 |
.. _rapi-res-nodes-node_name: |
1899 |
|
1900 |
``/2/nodes/[node_name]`` |
1901 |
+++++++++++++++++++++++++++++++++ |
1902 |
|
1903 |
Returns information about a node. |
1904 |
|
1905 |
It supports the following commands: ``GET``. |
1906 |
|
1907 |
|
1908 |
.. _rapi-res-nodes-node_name+get: |
1909 |
|
1910 |
``GET`` |
1911 |
~~~~~~~ |
1912 |
|
1913 |
Returned fields: :pyeval:`utils.CommaJoin(sorted(rlib2.N_FIELDS))`. |
1914 |
|
1915 |
|
1916 |
|
1917 |
.. _rapi-res-nodes-node_name-powercycle: |
1918 |
|
1919 |
``/2/nodes/[node_name]/powercycle`` |
1920 |
+++++++++++++++++++++++++++++++++++ |
1921 |
|
1922 |
Powercycles a node. Supports the following commands: ``POST``. |
1923 |
|
1924 |
|
1925 |
.. _rapi-res-nodes-node_name-powercycle+post: |
1926 |
|
1927 |
``POST`` |
1928 |
~~~~~~~~ |
1929 |
|
1930 |
Returns a job ID. |
1931 |
|
1932 |
Job result: |
1933 |
|
1934 |
.. opcode_result:: OP_NODE_POWERCYCLE |
1935 |
|
1936 |
|
1937 |
.. _rapi-res-nodes-node_name-evacuate: |
1938 |
|
1939 |
``/2/nodes/[node_name]/evacuate`` |
1940 |
+++++++++++++++++++++++++++++++++ |
1941 |
|
1942 |
Evacuates instances off a node. |
1943 |
|
1944 |
It supports the following commands: ``POST``. |
1945 |
|
1946 |
|
1947 |
.. _rapi-res-nodes-node_name-evacuate+post: |
1948 |
|
1949 |
``POST`` |
1950 |
~~~~~~~~ |
1951 |
|
1952 |
Returns a job ID. The result of the job will contain the IDs of the |
1953 |
individual jobs submitted to evacuate the node. |
1954 |
|
1955 |
Body parameters: |
1956 |
|
1957 |
.. opcode_params:: OP_NODE_EVACUATE |
1958 |
:exclude: nodes |
1959 |
|
1960 |
Up to and including Ganeti 2.4 query arguments were used. Those are no |
1961 |
longer supported. The new request can be detected by the presence of the |
1962 |
:pyeval:`rlib2._NODE_EVAC_RES1` feature string. |
1963 |
|
1964 |
Job result: |
1965 |
|
1966 |
.. opcode_result:: OP_NODE_EVACUATE |
1967 |
|
1968 |
|
1969 |
.. _rapi-res-nodes-node_name-migrate: |
1970 |
|
1971 |
``/2/nodes/[node_name]/migrate`` |
1972 |
+++++++++++++++++++++++++++++++++ |
1973 |
|
1974 |
Migrates all primary instances from a node. |
1975 |
|
1976 |
It supports the following commands: ``POST``. |
1977 |
|
1978 |
.. _rapi-res-nodes-node_name-migrate+post: |
1979 |
|
1980 |
``POST`` |
1981 |
~~~~~~~~ |
1982 |
|
1983 |
If no mode is explicitly specified, each instances' hypervisor default |
1984 |
migration mode will be used. Body parameters: |
1985 |
|
1986 |
.. opcode_params:: OP_NODE_MIGRATE |
1987 |
:exclude: node_name |
1988 |
|
1989 |
The query arguments used up to and including Ganeti 2.4 are deprecated |
1990 |
and should no longer be used. The new request format can be detected by |
1991 |
the presence of the :pyeval:`rlib2._NODE_MIGRATE_REQV1` feature string. |
1992 |
|
1993 |
Job result: |
1994 |
|
1995 |
.. opcode_result:: OP_NODE_MIGRATE |
1996 |
|
1997 |
|
1998 |
.. _rapi-res-nodes-node_name-role: |
1999 |
|
2000 |
``/2/nodes/[node_name]/role`` |
2001 |
+++++++++++++++++++++++++++++ |
2002 |
|
2003 |
Manages node role. |
2004 |
|
2005 |
It supports the following commands: ``GET``, ``PUT``. |
2006 |
|
2007 |
The role is always one of the following: |
2008 |
|
2009 |
- drained |
2010 |
- master-candidate |
2011 |
- offline |
2012 |
- regular |
2013 |
|
2014 |
Note that the 'master' role is a special, and currently it can't be |
2015 |
modified via RAPI, only via the command line (``gnt-cluster |
2016 |
master-failover``). |
2017 |
|
2018 |
|
2019 |
.. _rapi-res-nodes-node_name-role+get: |
2020 |
|
2021 |
``GET`` |
2022 |
~~~~~~~ |
2023 |
|
2024 |
Returns the current node role. |
2025 |
|
2026 |
Example:: |
2027 |
|
2028 |
"master-candidate" |
2029 |
|
2030 |
|
2031 |
.. _rapi-res-nodes-node_name-role+put: |
2032 |
|
2033 |
``PUT`` |
2034 |
~~~~~~~ |
2035 |
|
2036 |
Change the node role. |
2037 |
|
2038 |
The request is a string which should be PUT to this URI. The result will |
2039 |
be a job id. |
2040 |
|
2041 |
It supports the bool ``force`` argument. |
2042 |
|
2043 |
Job result: |
2044 |
|
2045 |
.. opcode_result:: OP_NODE_SET_PARAMS |
2046 |
|
2047 |
|
2048 |
.. _rapi-res-nodes-node_name-modify: |
2049 |
|
2050 |
``/2/nodes/[node_name]/modify`` |
2051 |
+++++++++++++++++++++++++++++++ |
2052 |
|
2053 |
Modifies the parameters of a node. Supports the following commands: |
2054 |
``POST``. |
2055 |
|
2056 |
|
2057 |
.. _rapi-res-nodes-node_name-modify+post: |
2058 |
|
2059 |
``POST`` |
2060 |
~~~~~~~~ |
2061 |
|
2062 |
Returns a job ID. |
2063 |
|
2064 |
Body parameters: |
2065 |
|
2066 |
.. opcode_params:: OP_NODE_SET_PARAMS |
2067 |
:exclude: node_name |
2068 |
|
2069 |
Job result: |
2070 |
|
2071 |
.. opcode_result:: OP_NODE_SET_PARAMS |
2072 |
|
2073 |
|
2074 |
.. _rapi-res-nodes-node_name-storage: |
2075 |
|
2076 |
``/2/nodes/[node_name]/storage`` |
2077 |
++++++++++++++++++++++++++++++++ |
2078 |
|
2079 |
Manages storage units on the node. |
2080 |
|
2081 |
.. _rapi-res-nodes-node_name-storage+get: |
2082 |
|
2083 |
``GET`` |
2084 |
~~~~~~~ |
2085 |
|
2086 |
.. pyassert:: |
2087 |
|
2088 |
constants.VALID_STORAGE_TYPES == set([constants.ST_FILE, |
2089 |
constants.ST_LVM_PV, |
2090 |
constants.ST_LVM_VG]) |
2091 |
|
2092 |
Requests a list of storage units on a node. Requires the parameters |
2093 |
``storage_type`` (one of :pyeval:`constants.ST_FILE`, |
2094 |
:pyeval:`constants.ST_LVM_PV` or :pyeval:`constants.ST_LVM_VG`) and |
2095 |
``output_fields``. The result will be a job id, using which the result |
2096 |
can be retrieved. |
2097 |
|
2098 |
|
2099 |
.. _rapi-res-nodes-node_name-storage-modify: |
2100 |
|
2101 |
``/2/nodes/[node_name]/storage/modify`` |
2102 |
+++++++++++++++++++++++++++++++++++++++ |
2103 |
|
2104 |
Modifies storage units on the node. |
2105 |
|
2106 |
|
2107 |
.. _rapi-res-nodes-node_name-storage-modify+put: |
2108 |
|
2109 |
``PUT`` |
2110 |
~~~~~~~ |
2111 |
|
2112 |
Modifies parameters of storage units on the node. Requires the |
2113 |
parameters ``storage_type`` (one of :pyeval:`constants.ST_FILE`, |
2114 |
:pyeval:`constants.ST_LVM_PV` or :pyeval:`constants.ST_LVM_VG`) |
2115 |
and ``name`` (name of the storage unit). Parameters can be passed |
2116 |
additionally. Currently only :pyeval:`constants.SF_ALLOCATABLE` (bool) |
2117 |
is supported. The result will be a job id. |
2118 |
|
2119 |
Job result: |
2120 |
|
2121 |
.. opcode_result:: OP_NODE_MODIFY_STORAGE |
2122 |
|
2123 |
|
2124 |
.. _rapi-res-nodes-node_name-storage-repair: |
2125 |
|
2126 |
``/2/nodes/[node_name]/storage/repair`` |
2127 |
+++++++++++++++++++++++++++++++++++++++ |
2128 |
|
2129 |
Repairs a storage unit on the node. |
2130 |
|
2131 |
|
2132 |
.. _rapi-res-nodes-node_name-storage-repair+put: |
2133 |
|
2134 |
``PUT`` |
2135 |
~~~~~~~ |
2136 |
|
2137 |
.. pyassert:: |
2138 |
|
2139 |
constants.VALID_STORAGE_OPERATIONS == { |
2140 |
constants.ST_LVM_VG: set([constants.SO_FIX_CONSISTENCY]), |
2141 |
} |
2142 |
|
2143 |
Repairs a storage unit on the node. Requires the parameters |
2144 |
``storage_type`` (currently only :pyeval:`constants.ST_LVM_VG` can be |
2145 |
repaired) and ``name`` (name of the storage unit). The result will be a |
2146 |
job id. |
2147 |
|
2148 |
Job result: |
2149 |
|
2150 |
.. opcode_result:: OP_REPAIR_NODE_STORAGE |
2151 |
|
2152 |
|
2153 |
.. _rapi-res-nodes-node_name-tags: |
2154 |
|
2155 |
``/2/nodes/[node_name]/tags`` |
2156 |
+++++++++++++++++++++++++++++ |
2157 |
|
2158 |
Manages per-node tags. |
2159 |
|
2160 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
2161 |
|
2162 |
|
2163 |
.. _rapi-res-nodes-node_name-tags+get: |
2164 |
|
2165 |
``GET`` |
2166 |
~~~~~~~ |
2167 |
|
2168 |
Returns a list of tags. |
2169 |
|
2170 |
Example:: |
2171 |
|
2172 |
["tag1", "tag2", "tag3"] |
2173 |
|
2174 |
|
2175 |
.. _rapi-res-nodes-node_name-tags+put: |
2176 |
|
2177 |
``PUT`` |
2178 |
~~~~~~~ |
2179 |
|
2180 |
Add a set of tags. |
2181 |
|
2182 |
The request as a list of strings should be PUT to this URI. The result |
2183 |
will be a job id. |
2184 |
|
2185 |
It supports the ``dry-run`` argument. |
2186 |
|
2187 |
|
2188 |
.. _rapi-res-nodes-node_name-tags+delete: |
2189 |
|
2190 |
``DELETE`` |
2191 |
~~~~~~~~~~ |
2192 |
|
2193 |
Deletes tags. |
2194 |
|
2195 |
In order to delete a set of tags, the DELETE request should be addressed |
2196 |
to URI like:: |
2197 |
|
2198 |
/tags?tag=[tag]&tag=[tag] |
2199 |
|
2200 |
It supports the ``dry-run`` argument. |
2201 |
|
2202 |
|
2203 |
.. _rapi-res-query-resource: |
2204 |
|
2205 |
``/2/query/[resource]`` |
2206 |
+++++++++++++++++++++++ |
2207 |
|
2208 |
Requests resource information. Available fields can be found in man |
2209 |
pages and using ``/2/query/[resource]/fields``. The resource is one of |
2210 |
:pyeval:`utils.CommaJoin(constants.QR_VIA_RAPI)`. See the :doc:`query2 |
2211 |
design document <design-query2>` for more details. |
2212 |
|
2213 |
.. pyassert:: |
2214 |
|
2215 |
(rlib2.R_2_query.GET_ACCESS == rlib2.R_2_query.PUT_ACCESS and |
2216 |
not (hasattr(rlib2.R_2_query, "POST") or |
2217 |
hasattr(rlib2.R_2_query, "DELETE"))) |
2218 |
|
2219 |
Supports the following commands: ``GET``, ``PUT``. Requires |
2220 |
authentication with one of the following options: |
2221 |
:pyeval:`utils.CommaJoin(rlib2.R_2_query.GET_ACCESS)`. |
2222 |
|
2223 |
|
2224 |
.. _rapi-res-query-resource+get: |
2225 |
|
2226 |
``GET`` |
2227 |
~~~~~~~ |
2228 |
|
2229 |
Returns list of included fields and actual data. Takes a query parameter |
2230 |
named "fields", containing a comma-separated list of field names. Does |
2231 |
not support filtering. |
2232 |
|
2233 |
|
2234 |
.. _rapi-res-query-resource+put: |
2235 |
|
2236 |
``PUT`` |
2237 |
~~~~~~~ |
2238 |
|
2239 |
Returns list of included fields and actual data. The list of requested |
2240 |
fields can either be given as the query parameter "fields" or as a body |
2241 |
parameter with the same name. The optional body parameter "filter" can |
2242 |
be given and must be either ``null`` or a list containing filter |
2243 |
operators. |
2244 |
|
2245 |
|
2246 |
.. _rapi-res-query-resource-fields: |
2247 |
|
2248 |
``/2/query/[resource]/fields`` |
2249 |
++++++++++++++++++++++++++++++ |
2250 |
|
2251 |
Request list of available fields for a resource. The resource is one of |
2252 |
:pyeval:`utils.CommaJoin(constants.QR_VIA_RAPI)`. See the |
2253 |
:doc:`query2 design document <design-query2>` for more details. |
2254 |
|
2255 |
Supports the following commands: ``GET``. |
2256 |
|
2257 |
|
2258 |
.. _rapi-res-query-resource-fields+get: |
2259 |
|
2260 |
``GET`` |
2261 |
~~~~~~~ |
2262 |
|
2263 |
Returns a list of field descriptions for available fields. Takes an |
2264 |
optional query parameter named "fields", containing a comma-separated |
2265 |
list of field names. |
2266 |
|
2267 |
|
2268 |
.. _rapi-res-os: |
2269 |
|
2270 |
``/2/os`` |
2271 |
+++++++++ |
2272 |
|
2273 |
OS resource. |
2274 |
|
2275 |
It supports the following commands: ``GET``. |
2276 |
|
2277 |
|
2278 |
.. _rapi-res-os+get: |
2279 |
|
2280 |
``GET`` |
2281 |
~~~~~~~ |
2282 |
|
2283 |
Return a list of all OSes. |
2284 |
|
2285 |
Can return error 500 in case of a problem. Since this is a costly |
2286 |
operation for Ganeti 2.0, it is not recommended to execute it too often. |
2287 |
|
2288 |
Example:: |
2289 |
|
2290 |
["debian-etch"] |
2291 |
|
2292 |
|
2293 |
.. _rapi-res-tags: |
2294 |
|
2295 |
``/2/tags`` |
2296 |
+++++++++++ |
2297 |
|
2298 |
Manages cluster tags. |
2299 |
|
2300 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
2301 |
|
2302 |
|
2303 |
.. _rapi-res-tags+get: |
2304 |
|
2305 |
``GET`` |
2306 |
~~~~~~~ |
2307 |
|
2308 |
Returns the cluster tags. |
2309 |
|
2310 |
Example:: |
2311 |
|
2312 |
["tag1", "tag2", "tag3"] |
2313 |
|
2314 |
|
2315 |
.. _rapi-res-tags+put: |
2316 |
|
2317 |
``PUT`` |
2318 |
~~~~~~~ |
2319 |
|
2320 |
Adds a set of tags. |
2321 |
|
2322 |
The request as a list of strings should be PUT to this URI. The result |
2323 |
will be a job id. |
2324 |
|
2325 |
It supports the ``dry-run`` argument. |
2326 |
|
2327 |
|
2328 |
.. _rapi-res-tags+delete: |
2329 |
|
2330 |
``DELETE`` |
2331 |
~~~~~~~~~~ |
2332 |
|
2333 |
Deletes tags. |
2334 |
|
2335 |
In order to delete a set of tags, the DELETE request should be addressed |
2336 |
to URI like:: |
2337 |
|
2338 |
/tags?tag=[tag]&tag=[tag] |
2339 |
|
2340 |
It supports the ``dry-run`` argument. |
2341 |
|
2342 |
|
2343 |
.. _rapi-res-version: |
2344 |
|
2345 |
``/version`` |
2346 |
++++++++++++ |
2347 |
|
2348 |
The version resource. |
2349 |
|
2350 |
This resource should be used to determine the remote API version and to |
2351 |
adapt clients accordingly. |
2352 |
|
2353 |
It supports the following commands: ``GET``. |
2354 |
|
2355 |
.. _rapi-res-version+get: |
2356 |
|
2357 |
``GET`` |
2358 |
~~~~~~~ |
2359 |
|
2360 |
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0 |
2361 |
returns ``2``. |
2362 |
|
2363 |
|
2364 |
.. _rapi-access-permissions: |
2365 |
|
2366 |
Access permissions |
2367 |
------------------ |
2368 |
|
2369 |
The following list describes the access permissions required for each |
2370 |
resource. See :ref:`rapi-users` for more details. |
2371 |
|
2372 |
.. rapi_access_table:: |
2373 |
|
2374 |
|
2375 |
.. vim: set textwidth=72 : |
2376 |
.. Local Variables: |
2377 |
.. mode: rst |
2378 |
.. fill-column: 72 |
2379 |
.. End: |