Revision 88394aa7 doc/rapi.rst
b/doc/rapi.rst | ||
---|---|---|
71 | 71 |
.. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer |
72 | 72 |
.. _RFC2617: http://tools.ietf.org/rfc/rfc2617.txt |
73 | 73 |
|
74 |
|
|
75 |
PUT or POST? |
|
76 |
------------ |
|
77 |
|
|
78 |
According to RFC2616 the main difference between PUT and POST is that |
|
79 |
POST can create new resources but PUT can only create the resource the |
|
80 |
URI was pointing to on the PUT request. |
|
81 |
|
|
82 |
Unfortunately, due to historic reasons, the Ganeti RAPI library is not |
|
83 |
consistent with this usage, so just use the methods as documented below |
|
84 |
for each resource. |
|
85 |
|
|
86 |
For more details have a look in the source code at |
|
87 |
``lib/rapi/rlib2.py``. |
|
88 |
|
|
89 |
|
|
90 |
Generic parameter types |
|
91 |
----------------------- |
|
92 |
|
|
93 |
A few generic refered parameter types and the values they allow. |
|
94 |
|
|
95 |
``bool`` |
|
96 |
++++++++ |
|
97 |
|
|
98 |
A boolean option will accept ``1`` or ``0`` as numbers but not |
|
99 |
i.e. ``True`` or ``False``. |
|
100 |
|
|
74 | 101 |
Generic parameters |
75 | 102 |
------------------ |
76 | 103 |
|
... | ... | |
89 | 116 |
``dry-run`` |
90 | 117 |
+++++++++++ |
91 | 118 |
|
92 |
The optional *dry-run* argument, if provided and set to a positive
|
|
93 |
integer value (e.g. ``?dry-run=1``), signals to Ganeti that the job
|
|
94 |
should not be executed, only the pre-execution checks will be done.
|
|
119 |
The boolean *dry-run* argument, if provided and set, signals to Ganeti
|
|
120 |
that the job should not be executed, only the pre-execution checks will
|
|
121 |
be done. |
|
95 | 122 |
|
96 | 123 |
This is useful in trying to determine (without guarantees though, as in |
97 | 124 |
the meantime the cluster state could have changed) if the operation is |
... | ... | |
278 | 305 |
} |
279 | 306 |
] |
280 | 307 |
|
281 |
If the optional *bulk* argument is provided and set to a true value (i.e
|
|
282 |
``?bulk=1``), the output contains detailed information about instances
|
|
283 |
as a list. |
|
308 |
If the optional bool *bulk* argument is provided and set to a true value
|
|
309 |
(i.e ``?bulk=1``), the output contains detailed information about
|
|
310 |
instances as a list.
|
|
284 | 311 |
|
285 | 312 |
Example:: |
286 | 313 |
|
... | ... | |
317 | 344 |
|
318 | 345 |
Creates an instance. |
319 | 346 |
|
320 |
If the optional *dry-run* argument is provided and set to a positive |
|
321 |
integer valu (e.g. ``?dry-run=1``), the job will not be actually |
|
322 |
executed, only the pre-execution checks will be done. Query-ing the job |
|
323 |
result will return, in both dry-run and normal case, the list of nodes |
|
324 |
selected for the instance. |
|
347 |
If the optional bool *dry-run* argument is provided, the job will not be |
|
348 |
actually executed, only the pre-execution checks will be done. Query-ing |
|
349 |
the job result will return, in both dry-run and normal case, the list of |
|
350 |
nodes selected for the instance. |
|
325 | 351 |
|
326 | 352 |
Returns: a job ID that can be used later for polling. |
327 | 353 |
|
... | ... | |
372 | 398 |
|
373 | 399 |
Reboots the instance. |
374 | 400 |
|
375 |
The URI takes optional ``type=hard|soft|full`` and |
|
376 |
``ignore_secondaries=False|True`` parameters. |
|
401 |
The URI takes optional ``type=soft|hard|full`` and |
|
402 |
``ignore_secondaries=0|1`` parameters. |
|
403 |
|
|
404 |
``type`` defines the reboot type. ``soft`` is just a normal reboot, |
|
405 |
without terminating the hypervisor. ``hard`` means full shutdown |
|
406 |
(including terminating the hypervisor process) and startup again. |
|
407 |
``full`` is like ``hard`` but also recreates the configuration from |
|
408 |
ground up as if you would have done a ``gnt-instance shutdown`` and |
|
409 |
``gnt-instance start`` on it. |
|
410 |
|
|
411 |
``ignore_secondaries`` is a bool argument indicating if we start the |
|
412 |
instance even if secondary disks are failing. |
|
377 | 413 |
|
378 | 414 |
It supports the ``dry-run`` argument. |
379 | 415 |
|
... | ... | |
405 | 441 |
|
406 | 442 |
Startup an instance. |
407 | 443 |
|
408 |
The URI takes an optional ``force=False|True`` parameter to start the
|
|
409 |
instance if even if secondary disks are failing.
|
|
444 |
The URI takes an optional ``force=1|0`` parameter to start the
|
|
445 |
instance even if secondary disks are failing. |
|
410 | 446 |
|
411 | 447 |
It supports the ``dry-run`` argument. |
412 | 448 |
|
... | ... | |
438 | 474 |
``replace_auto``), ``disks`` (comma separated list of disk indexes), |
439 | 475 |
``remote_node`` and ``iallocator``. |
440 | 476 |
|
477 |
Either ``remote_node`` or ``iallocator`` needs to be defined when using |
|
478 |
``mode=replace_new_secondary``. |
|
479 |
|
|
480 |
``mode`` is a mandatory parameter. ``replace_auto`` tries to determine |
|
481 |
the broken disk(s) on its own and replacing it. |
|
482 |
|
|
441 | 483 |
|
442 | 484 |
``/2/instances/[instance_name]/activate-disks`` |
443 | 485 |
+++++++++++++++++++++++++++++++++++++++++++++++ |
... | ... | |
449 | 491 |
``PUT`` |
450 | 492 |
~~~~~~~ |
451 | 493 |
|
452 |
Takes the parameter ``ignore_size``. When set ignore the recorded |
|
494 |
Takes the bool parameter ``ignore_size``. When set ignore the recorded
|
|
453 | 495 |
size (useful for forcing activation when recorded size is wrong). |
454 | 496 |
|
455 | 497 |
|
... | ... | |
674 | 716 |
~~~~~~~~ |
675 | 717 |
|
676 | 718 |
To evacuate a node, either one of the ``iallocator`` or ``remote_node`` |
677 |
parameters must be passed: |
|
719 |
parameters must be passed::
|
|
678 | 720 |
|
679 | 721 |
evacuate?iallocator=[iallocator] |
680 | 722 |
evacuate?remote_node=[nodeX.example.com] |
... | ... | |
689 | 731 |
``POST`` |
690 | 732 |
~~~~~~~~ |
691 | 733 |
|
692 |
No parameters are required, but ``live`` can be set to a boolean value. |
|
734 |
No parameters are required, but the bool parameter ``live`` can be set |
|
735 |
to use live migration (if available). |
|
693 | 736 |
|
694 | 737 |
migrate?live=[0|1] |
695 | 738 |
|
... | ... | |
725 | 768 |
The request is a string which should be PUT to this URI. The result will |
726 | 769 |
be a job id. |
727 | 770 |
|
728 |
It supports the ``force`` argument. |
|
771 |
It supports the bool ``force`` argument.
|
|
729 | 772 |
|
730 | 773 |
``/2/nodes/[node_name]/storage`` |
731 | 774 |
++++++++++++++++++++++++++++++++ |
Also available in: Unified diff