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