Statistics
| Branch: | Tag: | Revision:

root / doc / rapi.rst @ 7eac4a4d

History | View | Annotate | Download (20.8 kB)

1 4352bf6d Iustin Pop
Ganeti remote API
2 4352bf6d Iustin Pop
=================
3 4352bf6d Iustin Pop
4 c8e0a534 Iustin Pop
Documents Ganeti version |version|
5 4352bf6d Iustin Pop
6 4352bf6d Iustin Pop
.. contents::
7 4352bf6d Iustin Pop
8 4352bf6d Iustin Pop
Introduction
9 4352bf6d Iustin Pop
------------
10 4352bf6d Iustin Pop
11 4352bf6d Iustin Pop
Ganeti supports a remote API for enable external tools to easily
12 4352bf6d Iustin Pop
retrieve information about a cluster's state. The remote API daemon,
13 4352bf6d Iustin Pop
*ganeti-rapi*, is automatically started on the master node. By default
14 4352bf6d Iustin Pop
it runs on TCP port 5080, but this can be changed either in
15 4352bf6d Iustin Pop
``.../constants.py`` or via the command line parameter *-p*. SSL mode,
16 4352bf6d Iustin Pop
which is used by default, can also be disabled by passing command line
17 4352bf6d Iustin Pop
parameters.
18 4352bf6d Iustin Pop
19 c099b8d8 Michael Hanselmann
20 c099b8d8 Michael Hanselmann
Users and passwords
21 c099b8d8 Michael Hanselmann
-------------------
22 c099b8d8 Michael Hanselmann
23 c099b8d8 Michael Hanselmann
``ganeti-rapi`` reads users and passwords from a file (usually
24 c099b8d8 Michael Hanselmann
``/var/lib/ganeti/rapi_users``) on startup. After modifying the password
25 c099b8d8 Michael Hanselmann
file, ``ganeti-rapi`` must be restarted.
26 c099b8d8 Michael Hanselmann
27 c099b8d8 Michael Hanselmann
Each line consists of two or three fields separated by whitespace. The
28 c099b8d8 Michael Hanselmann
first two fields are for username and password. The third field is
29 c099b8d8 Michael Hanselmann
optional and can be used to specify per-user options. Currently,
30 c099b8d8 Michael Hanselmann
``write`` is the only option supported and enables the user to execute
31 ab2e463a Michael Hanselmann
operations modifying the cluster. Lines starting with the hash sign
32 ab2e463a Michael Hanselmann
(``#``) are treated as comments.
33 c099b8d8 Michael Hanselmann
34 c099b8d8 Michael Hanselmann
Passwords can either be written in clear text or as a hash. Clear text
35 c099b8d8 Michael Hanselmann
passwords may not start with an opening brace (``{``) or they must be
36 c099b8d8 Michael Hanselmann
prefixed with ``{cleartext}``. To use the hashed form, get the MD5 hash
37 c099b8d8 Michael Hanselmann
of the string ``$username:Ganeti Remote API:$password`` (e.g. ``echo -n
38 ab2e463a Michael Hanselmann
'jack:Ganeti Remote API:abc123' | openssl md5``) [#pwhash]_ and prefix
39 ab2e463a Michael Hanselmann
it with ``{ha1}``. Using the scheme prefix for all passwords is
40 ab2e463a Michael Hanselmann
recommended. Scheme prefixes are not case sensitive.
41 c099b8d8 Michael Hanselmann
42 c099b8d8 Michael Hanselmann
Example::
43 c099b8d8 Michael Hanselmann
44 c099b8d8 Michael Hanselmann
  # Give Jack and Fred read-only access
45 c099b8d8 Michael Hanselmann
  jack abc123
46 c099b8d8 Michael Hanselmann
  fred {cleartext}foo555
47 c099b8d8 Michael Hanselmann
48 c099b8d8 Michael Hanselmann
  # Give write access to an imaginary instance creation script
49 c099b8d8 Michael Hanselmann
  autocreator xyz789 write
50 c099b8d8 Michael Hanselmann
51 c099b8d8 Michael Hanselmann
  # Hashed password for Jessica
52 c099b8d8 Michael Hanselmann
  jessica {HA1}7046452df2cbb530877058712cf17bd4 write
53 c099b8d8 Michael Hanselmann
54 c099b8d8 Michael Hanselmann
55 c099b8d8 Michael Hanselmann
.. [#pwhash] Using the MD5 hash of username, realm and password is
56 c099b8d8 Michael Hanselmann
   described in RFC2617_ ("HTTP Authentication"), sections 3.2.2.2 and
57 c099b8d8 Michael Hanselmann
   3.3. The reason for using it over another algorithm is forward
58 c099b8d8 Michael Hanselmann
   compatibility. If ``ganeti-rapi`` were to implement HTTP Digest
59 c099b8d8 Michael Hanselmann
   authentication in the future, the same hash could be used.
60 c099b8d8 Michael Hanselmann
   In the current version ``ganeti-rapi``'s realm, ``Ganeti Remote
61 c099b8d8 Michael Hanselmann
   API``, can only be changed by modifying the source code.
62 c099b8d8 Michael Hanselmann
63 c099b8d8 Michael Hanselmann
64 4352bf6d Iustin Pop
Protocol
65 4352bf6d Iustin Pop
--------
66 4352bf6d Iustin Pop
67 c099b8d8 Michael Hanselmann
The protocol used is JSON_ over HTTP designed after the REST_ principle.
68 c099b8d8 Michael Hanselmann
HTTP Basic authentication as per RFC2617_ is supported.
69 4352bf6d Iustin Pop
70 4352bf6d Iustin Pop
.. _JSON: http://www.json.org/
71 4352bf6d Iustin Pop
.. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer
72 c099b8d8 Michael Hanselmann
.. _RFC2617: http://tools.ietf.org/rfc/rfc2617.txt
73 4352bf6d Iustin Pop
74 88394aa7 René Nussbaumer
75 88394aa7 René Nussbaumer
PUT or POST?
76 88394aa7 René Nussbaumer
------------
77 88394aa7 René Nussbaumer
78 88394aa7 René Nussbaumer
According to RFC2616 the main difference between PUT and POST is that
79 88394aa7 René Nussbaumer
POST can create new resources but PUT can only create the resource the
80 88394aa7 René Nussbaumer
URI was pointing to on the PUT request.
81 88394aa7 René Nussbaumer
82 88394aa7 René Nussbaumer
Unfortunately, due to historic reasons, the Ganeti RAPI library is not
83 88394aa7 René Nussbaumer
consistent with this usage, so just use the methods as documented below
84 88394aa7 René Nussbaumer
for each resource.
85 88394aa7 René Nussbaumer
86 88394aa7 René Nussbaumer
For more details have a look in the source code at
87 88394aa7 René Nussbaumer
``lib/rapi/rlib2.py``.
88 88394aa7 René Nussbaumer
89 88394aa7 René Nussbaumer
90 88394aa7 René Nussbaumer
Generic parameter types
91 88394aa7 René Nussbaumer
-----------------------
92 88394aa7 René Nussbaumer
93 88394aa7 René Nussbaumer
A few generic refered parameter types and the values they allow.
94 88394aa7 René Nussbaumer
95 88394aa7 René Nussbaumer
``bool``
96 88394aa7 René Nussbaumer
++++++++
97 88394aa7 René Nussbaumer
98 88394aa7 René Nussbaumer
A boolean option will accept ``1`` or ``0`` as numbers but not
99 88394aa7 René Nussbaumer
i.e. ``True`` or ``False``.
100 88394aa7 René Nussbaumer
101 2cad4b91 Iustin Pop
Generic parameters
102 2cad4b91 Iustin Pop
------------------
103 2cad4b91 Iustin Pop
104 7faf5110 Michael Hanselmann
A few parameter mean the same thing across all resources which implement
105 7faf5110 Michael Hanselmann
it.
106 2cad4b91 Iustin Pop
107 2cad4b91 Iustin Pop
``bulk``
108 2cad4b91 Iustin Pop
++++++++
109 2cad4b91 Iustin Pop
110 c71a1a3d Iustin Pop
Bulk-mode means that for the resources which usually return just a list
111 c71a1a3d Iustin Pop
of child resources (e.g. ``/2/instances`` which returns just instance
112 c71a1a3d Iustin Pop
names), the output will instead contain detailed data for all these
113 c71a1a3d Iustin Pop
subresources. This is more efficient than query-ing the sub-resources
114 c71a1a3d Iustin Pop
themselves.
115 2cad4b91 Iustin Pop
116 2cad4b91 Iustin Pop
``dry-run``
117 2cad4b91 Iustin Pop
+++++++++++
118 2cad4b91 Iustin Pop
119 88394aa7 René Nussbaumer
The boolean *dry-run* argument, if provided and set, signals to Ganeti
120 88394aa7 René Nussbaumer
that the job should not be executed, only the pre-execution checks will
121 88394aa7 René Nussbaumer
be done.
122 2cad4b91 Iustin Pop
123 c71a1a3d Iustin Pop
This is useful in trying to determine (without guarantees though, as in
124 c71a1a3d Iustin Pop
the meantime the cluster state could have changed) if the operation is
125 c71a1a3d Iustin Pop
likely to succeed or at least start executing.
126 2cad4b91 Iustin Pop
127 3427d34f Michael Hanselmann
``force``
128 3427d34f Michael Hanselmann
+++++++++++
129 3427d34f Michael Hanselmann
130 3427d34f Michael Hanselmann
Force operation to continue even if it will cause the cluster to become
131 3427d34f Michael Hanselmann
inconsistent (e.g. because there are not enough master candidates).
132 3427d34f Michael Hanselmann
133 4352bf6d Iustin Pop
Usage examples
134 4352bf6d Iustin Pop
--------------
135 4352bf6d Iustin Pop
136 c71a1a3d Iustin Pop
You can access the API using your favorite programming language as long
137 c71a1a3d Iustin Pop
as it supports network connections.
138 4352bf6d Iustin Pop
139 4352bf6d Iustin Pop
Shell
140 4352bf6d Iustin Pop
+++++
141 4352bf6d Iustin Pop
142 c8e0a534 Iustin Pop
.. highlight:: sh
143 c8e0a534 Iustin Pop
144 4352bf6d Iustin Pop
Using wget::
145 4352bf6d Iustin Pop
146 c8e0a534 Iustin Pop
   wget -q -O - https://CLUSTERNAME:5080/2/info
147 4352bf6d Iustin Pop
148 4352bf6d Iustin Pop
or curl::
149 4352bf6d Iustin Pop
150 4352bf6d Iustin Pop
  curl https://CLUSTERNAME:5080/2/info
151 4352bf6d Iustin Pop
152 4352bf6d Iustin Pop
153 4352bf6d Iustin Pop
Python
154 4352bf6d Iustin Pop
++++++
155 4352bf6d Iustin Pop
156 c71a1a3d Iustin Pop
.. highlight:: python
157 c71a1a3d Iustin Pop
158 c71a1a3d Iustin Pop
::
159 4352bf6d Iustin Pop
160 4352bf6d Iustin Pop
  import urllib2
161 4fb301b5 Tim Boring
  f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info')
162 4352bf6d Iustin Pop
  print f.read()
163 4352bf6d Iustin Pop
164 4352bf6d Iustin Pop
165 4352bf6d Iustin Pop
JavaScript
166 4352bf6d Iustin Pop
++++++++++
167 4352bf6d Iustin Pop
168 2cad4b91 Iustin Pop
.. warning:: While it's possible to use JavaScript, it poses several
169 c71a1a3d Iustin Pop
   potential problems, including browser blocking request due to
170 c71a1a3d Iustin Pop
   non-standard ports or different domain names. Fetching the data on
171 c71a1a3d Iustin Pop
   the webserver is easier.
172 4352bf6d Iustin Pop
173 c8e0a534 Iustin Pop
.. highlight:: javascript
174 c8e0a534 Iustin Pop
175 4352bf6d Iustin Pop
::
176 4352bf6d Iustin Pop
177 4fb301b5 Tim Boring
  var url = 'https://CLUSTERNAME:5080/2/info';
178 4352bf6d Iustin Pop
  var info;
179 4352bf6d Iustin Pop
  var xmlreq = new XMLHttpRequest();
180 4352bf6d Iustin Pop
  xmlreq.onreadystatechange = function () {
181 4352bf6d Iustin Pop
    if (xmlreq.readyState != 4) return;
182 4352bf6d Iustin Pop
    if (xmlreq.status == 200) {
183 4352bf6d Iustin Pop
      info = eval("(" + xmlreq.responseText + ")");
184 4352bf6d Iustin Pop
      alert(info);
185 4352bf6d Iustin Pop
    } else {
186 4352bf6d Iustin Pop
      alert('Error fetching cluster info');
187 4352bf6d Iustin Pop
    }
188 4352bf6d Iustin Pop
    xmlreq = null;
189 4352bf6d Iustin Pop
  };
190 4352bf6d Iustin Pop
  xmlreq.open('GET', url, true);
191 4352bf6d Iustin Pop
  xmlreq.send(null);
192 4352bf6d Iustin Pop
193 4352bf6d Iustin Pop
Resources
194 4352bf6d Iustin Pop
---------
195 4352bf6d Iustin Pop
196 c8e0a534 Iustin Pop
.. highlight:: javascript
197 6d81475c Iustin Pop
198 c8e0a534 Iustin Pop
``/``
199 c8e0a534 Iustin Pop
+++++
200 6d81475c Iustin Pop
201 c8e0a534 Iustin Pop
The root resource.
202 6d81475c Iustin Pop
203 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
204 6d81475c Iustin Pop
205 c8e0a534 Iustin Pop
``GET``
206 c8e0a534 Iustin Pop
~~~~~~~
207 6d81475c Iustin Pop
208 c8e0a534 Iustin Pop
Shows the list of mapped resources.
209 6d81475c Iustin Pop
210 c8e0a534 Iustin Pop
Returns: a dictionary with 'name' and 'uri' keys for each of them.
211 6d81475c Iustin Pop
212 c8e0a534 Iustin Pop
``/2``
213 c8e0a534 Iustin Pop
++++++
214 6d81475c Iustin Pop
215 c8e0a534 Iustin Pop
The ``/2`` resource, the root of the version 2 API.
216 6d81475c Iustin Pop
217 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
218 6d81475c Iustin Pop
219 c8e0a534 Iustin Pop
``GET``
220 c8e0a534 Iustin Pop
~~~~~~~
221 6d81475c Iustin Pop
222 c8e0a534 Iustin Pop
Show the list of mapped resources.
223 6d81475c Iustin Pop
224 c8e0a534 Iustin Pop
Returns: a dictionary with ``name`` and ``uri`` keys for each of them.
225 6d81475c Iustin Pop
226 c8e0a534 Iustin Pop
``/2/info``
227 c8e0a534 Iustin Pop
+++++++++++
228 6d81475c Iustin Pop
229 c8e0a534 Iustin Pop
Cluster information resource.
230 6d81475c Iustin Pop
231 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
232 6d81475c Iustin Pop
233 c8e0a534 Iustin Pop
``GET``
234 c8e0a534 Iustin Pop
~~~~~~~
235 6d81475c Iustin Pop
236 c8e0a534 Iustin Pop
Returns cluster information.
237 6d81475c Iustin Pop
238 c8e0a534 Iustin Pop
Example::
239 6d81475c Iustin Pop
240 6d81475c Iustin Pop
  {
241 6d81475c Iustin Pop
    "config_version": 2000000,
242 6d81475c Iustin Pop
    "name": "cluster",
243 6d81475c Iustin Pop
    "software_version": "2.0.0~beta2",
244 6d81475c Iustin Pop
    "os_api_version": 10,
245 6d81475c Iustin Pop
    "export_version": 0,
246 6d81475c Iustin Pop
    "candidate_pool_size": 10,
247 6d81475c Iustin Pop
    "enabled_hypervisors": [
248 6d81475c Iustin Pop
      "fake"
249 6d81475c Iustin Pop
    ],
250 6d81475c Iustin Pop
    "hvparams": {
251 6d81475c Iustin Pop
      "fake": {}
252 6d81475c Iustin Pop
     },
253 6d81475c Iustin Pop
    "default_hypervisor": "fake",
254 6d81475c Iustin Pop
    "master": "node1.example.com",
255 6d81475c Iustin Pop
    "architecture": [
256 6d81475c Iustin Pop
      "64bit",
257 6d81475c Iustin Pop
      "x86_64"
258 6d81475c Iustin Pop
    ],
259 6d81475c Iustin Pop
    "protocol_version": 20,
260 6d81475c Iustin Pop
    "beparams": {
261 6d81475c Iustin Pop
      "default": {
262 6d81475c Iustin Pop
        "auto_balance": true,
263 6d81475c Iustin Pop
        "vcpus": 1,
264 6d81475c Iustin Pop
        "memory": 128
265 6d81475c Iustin Pop
       }
266 6d81475c Iustin Pop
      }
267 6d81475c Iustin Pop
    }
268 6d81475c Iustin Pop
269 508e9b20 Michael Hanselmann
270 508e9b20 Michael Hanselmann
``/2/redistribute-config``
271 508e9b20 Michael Hanselmann
++++++++++++++++++++++++++
272 508e9b20 Michael Hanselmann
273 508e9b20 Michael Hanselmann
Redistribute configuration to all nodes.
274 508e9b20 Michael Hanselmann
275 508e9b20 Michael Hanselmann
It supports the following commands: ``PUT``.
276 508e9b20 Michael Hanselmann
277 508e9b20 Michael Hanselmann
``PUT``
278 508e9b20 Michael Hanselmann
~~~~~~~
279 508e9b20 Michael Hanselmann
280 508e9b20 Michael Hanselmann
Redistribute configuration to all nodes. The result will be a job id.
281 508e9b20 Michael Hanselmann
282 508e9b20 Michael Hanselmann
283 7eac4a4d Michael Hanselmann
``/2/features``
284 7eac4a4d Michael Hanselmann
+++++++++++++++
285 7eac4a4d Michael Hanselmann
286 7eac4a4d Michael Hanselmann
``GET``
287 7eac4a4d Michael Hanselmann
~~~~~~~
288 7eac4a4d Michael Hanselmann
289 7eac4a4d Michael Hanselmann
Returns a list of features supported by the RAPI server. Available
290 7eac4a4d Michael Hanselmann
features:
291 7eac4a4d Michael Hanselmann
292 7eac4a4d Michael Hanselmann
``instance-create-reqv1``
293 7eac4a4d Michael Hanselmann
  Instance creation request data version 1 supported.
294 7eac4a4d Michael Hanselmann
295 7eac4a4d Michael Hanselmann
296 c8e0a534 Iustin Pop
``/2/instances``
297 c8e0a534 Iustin Pop
++++++++++++++++
298 6d81475c Iustin Pop
299 c8e0a534 Iustin Pop
The instances resource.
300 6d81475c Iustin Pop
301 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``POST``.
302 6d81475c Iustin Pop
303 c8e0a534 Iustin Pop
``GET``
304 c8e0a534 Iustin Pop
~~~~~~~
305 6d81475c Iustin Pop
306 c8e0a534 Iustin Pop
Returns a list of all available instances.
307 6d81475c Iustin Pop
308 c8e0a534 Iustin Pop
Example::
309 6d81475c Iustin Pop
310 6d81475c Iustin Pop
    [
311 6d81475c Iustin Pop
      {
312 6d81475c Iustin Pop
        "name": "web.example.com",
313 6d81475c Iustin Pop
        "uri": "\/instances\/web.example.com"
314 6d81475c Iustin Pop
      },
315 6d81475c Iustin Pop
      {
316 6d81475c Iustin Pop
        "name": "mail.example.com",
317 6d81475c Iustin Pop
        "uri": "\/instances\/mail.example.com"
318 6d81475c Iustin Pop
      }
319 6d81475c Iustin Pop
    ]
320 6d81475c Iustin Pop
321 88394aa7 René Nussbaumer
If the optional bool *bulk* argument is provided and set to a true value
322 88394aa7 René Nussbaumer
(i.e ``?bulk=1``), the output contains detailed information about
323 88394aa7 René Nussbaumer
instances as a list.
324 6d81475c Iustin Pop
325 c8e0a534 Iustin Pop
Example::
326 6d81475c Iustin Pop
327 6d81475c Iustin Pop
    [
328 6d81475c Iustin Pop
      {
329 6d81475c Iustin Pop
         "status": "running",
330 6d81475c Iustin Pop
         "disk_usage": 20480,
331 6d81475c Iustin Pop
         "nic.bridges": [
332 6d81475c Iustin Pop
           "xen-br0"
333 6d81475c Iustin Pop
          ],
334 6d81475c Iustin Pop
         "name": "web.example.com",
335 6d81475c Iustin Pop
         "tags": ["tag1", "tag2"],
336 6d81475c Iustin Pop
         "beparams": {
337 6d81475c Iustin Pop
           "vcpus": 2,
338 6d81475c Iustin Pop
           "memory": 512
339 6d81475c Iustin Pop
         },
340 6d81475c Iustin Pop
         "disk.sizes": [
341 6d81475c Iustin Pop
             20480
342 6d81475c Iustin Pop
         ],
343 6d81475c Iustin Pop
         "pnode": "node1.example.com",
344 6d81475c Iustin Pop
         "nic.macs": ["01:23:45:67:89:01"],
345 6d81475c Iustin Pop
         "snodes": ["node2.example.com"],
346 6d81475c Iustin Pop
         "disk_template": "drbd",
347 6d81475c Iustin Pop
         "admin_state": true,
348 6d81475c Iustin Pop
         "os": "debian-etch",
349 6d81475c Iustin Pop
         "oper_state": true
350 6d81475c Iustin Pop
      },
351 6d81475c Iustin Pop
      ...
352 6d81475c Iustin Pop
    ]
353 6d81475c Iustin Pop
354 6d81475c Iustin Pop
355 c8e0a534 Iustin Pop
``POST``
356 c8e0a534 Iustin Pop
~~~~~~~~
357 6d81475c Iustin Pop
358 c8e0a534 Iustin Pop
Creates an instance.
359 6d81475c Iustin Pop
360 88394aa7 René Nussbaumer
If the optional bool *dry-run* argument is provided, the job will not be
361 88394aa7 René Nussbaumer
actually executed, only the pre-execution checks will be done. Query-ing
362 88394aa7 René Nussbaumer
the job result will return, in both dry-run and normal case, the list of
363 88394aa7 René Nussbaumer
nodes selected for the instance.
364 2cad4b91 Iustin Pop
365 c8e0a534 Iustin Pop
Returns: a job ID that can be used later for polling.
366 6d81475c Iustin Pop
367 c8e0a534 Iustin Pop
``/2/instances/[instance_name]``
368 c8e0a534 Iustin Pop
++++++++++++++++++++++++++++++++
369 6d81475c Iustin Pop
370 c8e0a534 Iustin Pop
Instance-specific resource.
371 6d81475c Iustin Pop
372 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``DELETE``.
373 6d81475c Iustin Pop
374 c8e0a534 Iustin Pop
``GET``
375 c8e0a534 Iustin Pop
~~~~~~~
376 6d81475c Iustin Pop
377 c8e0a534 Iustin Pop
Returns information about an instance, similar to the bulk output from
378 c8e0a534 Iustin Pop
the instance list.
379 6d81475c Iustin Pop
380 c8e0a534 Iustin Pop
``DELETE``
381 c8e0a534 Iustin Pop
~~~~~~~~~~
382 6d81475c Iustin Pop
383 c8e0a534 Iustin Pop
Deletes an instance.
384 6d81475c Iustin Pop
385 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
386 2cad4b91 Iustin Pop
387 6d81475c Iustin Pop
388 d8260842 Michael Hanselmann
``/2/instances/[instance_name]/info``
389 d8260842 Michael Hanselmann
+++++++++++++++++++++++++++++++++++++++
390 d8260842 Michael Hanselmann
391 d8260842 Michael Hanselmann
It supports the following commands: ``GET``.
392 d8260842 Michael Hanselmann
393 d8260842 Michael Hanselmann
``GET``
394 d8260842 Michael Hanselmann
~~~~~~~
395 d8260842 Michael Hanselmann
396 d8260842 Michael Hanselmann
Requests detailed information about the instance. An optional parameter,
397 d8260842 Michael Hanselmann
``static`` (bool), can be set to return only static information from the
398 7faf5110 Michael Hanselmann
configuration without querying the instance's nodes. The result will be
399 7faf5110 Michael Hanselmann
a job id.
400 d8260842 Michael Hanselmann
401 d8260842 Michael Hanselmann
402 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/reboot``
403 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++++
404 6d81475c Iustin Pop
405 c8e0a534 Iustin Pop
Reboots URI for an instance.
406 6d81475c Iustin Pop
407 c8e0a534 Iustin Pop
It supports the following commands: ``POST``.
408 6d81475c Iustin Pop
409 c8e0a534 Iustin Pop
``POST``
410 c8e0a534 Iustin Pop
~~~~~~~~
411 6d81475c Iustin Pop
412 c8e0a534 Iustin Pop
Reboots the instance.
413 6d81475c Iustin Pop
414 88394aa7 René Nussbaumer
The URI takes optional ``type=soft|hard|full`` and
415 88394aa7 René Nussbaumer
``ignore_secondaries=0|1`` parameters.
416 88394aa7 René Nussbaumer
417 88394aa7 René Nussbaumer
``type`` defines the reboot type. ``soft`` is just a normal reboot,
418 88394aa7 René Nussbaumer
without terminating the hypervisor. ``hard`` means full shutdown
419 88394aa7 René Nussbaumer
(including terminating the hypervisor process) and startup again.
420 88394aa7 René Nussbaumer
``full`` is like ``hard`` but also recreates the configuration from
421 88394aa7 René Nussbaumer
ground up as if you would have done a ``gnt-instance shutdown`` and
422 88394aa7 René Nussbaumer
``gnt-instance start`` on it.
423 88394aa7 René Nussbaumer
424 88394aa7 René Nussbaumer
``ignore_secondaries`` is a bool argument indicating if we start the
425 88394aa7 René Nussbaumer
instance even if secondary disks are failing.
426 6d81475c Iustin Pop
427 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
428 2cad4b91 Iustin Pop
429 2cad4b91 Iustin Pop
430 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/shutdown``
431 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++++++
432 6d81475c Iustin Pop
433 c8e0a534 Iustin Pop
Instance shutdown URI.
434 6d81475c Iustin Pop
435 c8e0a534 Iustin Pop
It supports the following commands: ``PUT``.
436 6d81475c Iustin Pop
437 c8e0a534 Iustin Pop
``PUT``
438 c8e0a534 Iustin Pop
~~~~~~~
439 6d81475c Iustin Pop
440 c8e0a534 Iustin Pop
Shutdowns an instance.
441 6d81475c Iustin Pop
442 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
443 2cad4b91 Iustin Pop
444 6d81475c Iustin Pop
445 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/startup``
446 c8e0a534 Iustin Pop
++++++++++++++++++++++++++++++++++++++++
447 6d81475c Iustin Pop
448 c8e0a534 Iustin Pop
Instance startup URI.
449 6d81475c Iustin Pop
450 c8e0a534 Iustin Pop
It supports the following commands: ``PUT``.
451 6d81475c Iustin Pop
452 c8e0a534 Iustin Pop
``PUT``
453 c8e0a534 Iustin Pop
~~~~~~~
454 6d81475c Iustin Pop
455 c8e0a534 Iustin Pop
Startup an instance.
456 6d81475c Iustin Pop
457 88394aa7 René Nussbaumer
The URI takes an optional ``force=1|0`` parameter to start the
458 88394aa7 René Nussbaumer
instance even if secondary disks are failing.
459 6d81475c Iustin Pop
460 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
461 2cad4b91 Iustin Pop
462 f72542cc Michael Hanselmann
``/2/instances/[instance_name]/reinstall``
463 f72542cc Michael Hanselmann
++++++++++++++++++++++++++++++++++++++++++++++
464 f72542cc Michael Hanselmann
465 f72542cc Michael Hanselmann
Installs the operating system again.
466 f72542cc Michael Hanselmann
467 f72542cc Michael Hanselmann
It supports the following commands: ``POST``.
468 f72542cc Michael Hanselmann
469 f72542cc Michael Hanselmann
``POST``
470 f72542cc Michael Hanselmann
~~~~~~~~
471 f72542cc Michael Hanselmann
472 f72542cc Michael Hanselmann
Takes the parameters ``os`` (OS template name) and ``nostartup`` (bool).
473 f72542cc Michael Hanselmann
474 2cad4b91 Iustin Pop
475 4c98b915 Michael Hanselmann
``/2/instances/[instance_name]/replace-disks``
476 4c98b915 Michael Hanselmann
++++++++++++++++++++++++++++++++++++++++++++++
477 4c98b915 Michael Hanselmann
478 4c98b915 Michael Hanselmann
Replaces disks on an instance.
479 4c98b915 Michael Hanselmann
480 4c98b915 Michael Hanselmann
It supports the following commands: ``POST``.
481 4c98b915 Michael Hanselmann
482 4c98b915 Michael Hanselmann
``POST``
483 4c98b915 Michael Hanselmann
~~~~~~~~
484 4c98b915 Michael Hanselmann
485 4c98b915 Michael Hanselmann
Takes the parameters ``mode`` (one of ``replace_on_primary``,
486 7faf5110 Michael Hanselmann
``replace_on_secondary``, ``replace_new_secondary`` or
487 7faf5110 Michael Hanselmann
``replace_auto``), ``disks`` (comma separated list of disk indexes),
488 7faf5110 Michael Hanselmann
``remote_node`` and ``iallocator``.
489 4c98b915 Michael Hanselmann
490 88394aa7 René Nussbaumer
Either ``remote_node`` or ``iallocator`` needs to be defined when using
491 88394aa7 René Nussbaumer
``mode=replace_new_secondary``.
492 88394aa7 René Nussbaumer
493 88394aa7 René Nussbaumer
``mode`` is a mandatory parameter. ``replace_auto`` tries to determine
494 88394aa7 René Nussbaumer
the broken disk(s) on its own and replacing it.
495 88394aa7 René Nussbaumer
496 4c98b915 Michael Hanselmann
497 2263aec2 René Nussbaumer
``/2/instances/[instance_name]/activate-disks``
498 2263aec2 René Nussbaumer
+++++++++++++++++++++++++++++++++++++++++++++++
499 2263aec2 René Nussbaumer
500 2263aec2 René Nussbaumer
Activate disks on an instance.
501 2263aec2 René Nussbaumer
502 2263aec2 René Nussbaumer
It supports the following commands: ``PUT``.
503 2263aec2 René Nussbaumer
504 2263aec2 René Nussbaumer
``PUT``
505 2263aec2 René Nussbaumer
~~~~~~~
506 2263aec2 René Nussbaumer
507 88394aa7 René Nussbaumer
Takes the bool parameter ``ignore_size``. When set ignore the recorded
508 2263aec2 René Nussbaumer
size (useful for forcing activation when recorded size is wrong).
509 2263aec2 René Nussbaumer
510 2263aec2 René Nussbaumer
511 2263aec2 René Nussbaumer
``/2/instances/[instance_name]/deactivate-disks``
512 2263aec2 René Nussbaumer
+++++++++++++++++++++++++++++++++++++++++++++++++
513 2263aec2 René Nussbaumer
514 2263aec2 René Nussbaumer
Deactivate disks on an instance.
515 2263aec2 René Nussbaumer
516 2263aec2 René Nussbaumer
It supports the following commands: ``PUT``.
517 2263aec2 René Nussbaumer
518 2263aec2 René Nussbaumer
``PUT``
519 2263aec2 René Nussbaumer
~~~~~~~
520 2263aec2 René Nussbaumer
521 2263aec2 René Nussbaumer
Takes no parameters.
522 2263aec2 René Nussbaumer
523 2263aec2 René Nussbaumer
524 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/tags``
525 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++
526 6d81475c Iustin Pop
527 c8e0a534 Iustin Pop
Manages per-instance tags.
528 6d81475c Iustin Pop
529 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
530 6d81475c Iustin Pop
531 c8e0a534 Iustin Pop
``GET``
532 c8e0a534 Iustin Pop
~~~~~~~
533 6d81475c Iustin Pop
534 c8e0a534 Iustin Pop
Returns a list of tags.
535 6d81475c Iustin Pop
536 c8e0a534 Iustin Pop
Example::
537 6d81475c Iustin Pop
538 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
539 6d81475c Iustin Pop
540 c8e0a534 Iustin Pop
``PUT``
541 c8e0a534 Iustin Pop
~~~~~~~
542 6d81475c Iustin Pop
543 c8e0a534 Iustin Pop
Add a set of tags.
544 6d81475c Iustin Pop
545 c8e0a534 Iustin Pop
The request as a list of strings should be ``PUT`` to this URI. The
546 508e9b20 Michael Hanselmann
result will be a job id.
547 6d81475c Iustin Pop
548 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
549 2cad4b91 Iustin Pop
550 2cad4b91 Iustin Pop
551 c8e0a534 Iustin Pop
``DELETE``
552 c8e0a534 Iustin Pop
~~~~~~~~~~
553 6d81475c Iustin Pop
554 c8e0a534 Iustin Pop
Delete a tag.
555 6d81475c Iustin Pop
556 c71a1a3d Iustin Pop
In order to delete a set of tags, the DELETE request should be addressed
557 c71a1a3d Iustin Pop
to URI like::
558 6d81475c Iustin Pop
559 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
560 6d81475c Iustin Pop
561 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
562 2cad4b91 Iustin Pop
563 2cad4b91 Iustin Pop
564 c8e0a534 Iustin Pop
``/2/jobs``
565 c8e0a534 Iustin Pop
+++++++++++
566 6d81475c Iustin Pop
567 c8e0a534 Iustin Pop
The ``/2/jobs`` resource.
568 6d81475c Iustin Pop
569 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
570 6d81475c Iustin Pop
571 c8e0a534 Iustin Pop
``GET``
572 c8e0a534 Iustin Pop
~~~~~~~
573 6d81475c Iustin Pop
574 c8e0a534 Iustin Pop
Returns a dictionary of jobs.
575 6d81475c Iustin Pop
576 c8e0a534 Iustin Pop
Returns: a dictionary with jobs id and uri.
577 6d81475c Iustin Pop
578 c8e0a534 Iustin Pop
``/2/jobs/[job_id]``
579 c8e0a534 Iustin Pop
++++++++++++++++++++
580 6d81475c Iustin Pop
581 6d81475c Iustin Pop
582 c8e0a534 Iustin Pop
Individual job URI.
583 6d81475c Iustin Pop
584 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``DELETE``.
585 6d81475c Iustin Pop
586 c8e0a534 Iustin Pop
``GET``
587 c8e0a534 Iustin Pop
~~~~~~~
588 6d81475c Iustin Pop
589 c8e0a534 Iustin Pop
Returns a job status.
590 6d81475c Iustin Pop
591 c8e0a534 Iustin Pop
Returns: a dictionary with job parameters.
592 6d81475c Iustin Pop
593 c8e0a534 Iustin Pop
The result includes:
594 6d81475c Iustin Pop
595 c8e0a534 Iustin Pop
- id: job ID as a number
596 c8e0a534 Iustin Pop
- status: current job status as a string
597 c71a1a3d Iustin Pop
- ops: involved OpCodes as a list of dictionaries for each opcodes in
598 c71a1a3d Iustin Pop
  the job
599 c8e0a534 Iustin Pop
- opstatus: OpCodes status as a list
600 e91cfc2a Iustin Pop
- opresult: OpCodes results as a list
601 e91cfc2a Iustin Pop
602 e91cfc2a Iustin Pop
For a successful opcode, the ``opresult`` field corresponding to it will
603 e91cfc2a Iustin Pop
contain the raw result from its :term:`LogicalUnit`. In case an opcode
604 e91cfc2a Iustin Pop
has failed, its element in the opresult list will be a list of two
605 e91cfc2a Iustin Pop
elements:
606 e91cfc2a Iustin Pop
607 e91cfc2a Iustin Pop
- first element the error type (the Ganeti internal error name)
608 e91cfc2a Iustin Pop
- second element a list of either one or two elements:
609 e91cfc2a Iustin Pop
610 e91cfc2a Iustin Pop
  - the first element is the textual error description
611 e91cfc2a Iustin Pop
  - the second element, if any, will hold an error classification
612 e91cfc2a Iustin Pop
613 e91cfc2a Iustin Pop
The error classification is most useful for the ``OpPrereqError``
614 e91cfc2a Iustin Pop
error type - these errors happen before the OpCode has started
615 e91cfc2a Iustin Pop
executing, so it's possible to retry the OpCode without side
616 e91cfc2a Iustin Pop
effects. But whether it make sense to retry depends on the error
617 e91cfc2a Iustin Pop
classification:
618 e91cfc2a Iustin Pop
619 e91cfc2a Iustin Pop
``resolver_error``
620 e91cfc2a Iustin Pop
  Resolver errors. This usually means that a name doesn't exist in DNS,
621 e91cfc2a Iustin Pop
  so if it's a case of slow DNS propagation the operation can be retried
622 e91cfc2a Iustin Pop
  later.
623 e91cfc2a Iustin Pop
624 e91cfc2a Iustin Pop
``insufficient_resources``
625 e91cfc2a Iustin Pop
  Not enough resources (iallocator failure, disk space, memory,
626 e91cfc2a Iustin Pop
  etc.). If the resources on the cluster increase, the operation might
627 e91cfc2a Iustin Pop
  succeed.
628 e91cfc2a Iustin Pop
629 e91cfc2a Iustin Pop
``wrong_input``
630 e91cfc2a Iustin Pop
  Wrong arguments (at syntax level). The operation will not ever be
631 e91cfc2a Iustin Pop
  accepted unless the arguments change.
632 e91cfc2a Iustin Pop
633 e91cfc2a Iustin Pop
``wrong_state``
634 e91cfc2a Iustin Pop
  Wrong entity state. For example, live migration has been requested for
635 e91cfc2a Iustin Pop
  a down instance, or instance creation on an offline node. The
636 e91cfc2a Iustin Pop
  operation can be retried once the resource has changed state.
637 e91cfc2a Iustin Pop
638 e91cfc2a Iustin Pop
``unknown_entity``
639 e91cfc2a Iustin Pop
  Entity not found. For example, information has been requested for an
640 e91cfc2a Iustin Pop
  unknown instance.
641 e91cfc2a Iustin Pop
642 e91cfc2a Iustin Pop
``already_exists``
643 e91cfc2a Iustin Pop
  Entity already exists. For example, instance creation has been
644 e91cfc2a Iustin Pop
  requested for an already-existing instance.
645 e91cfc2a Iustin Pop
646 e91cfc2a Iustin Pop
``resource_not_unique``
647 e91cfc2a Iustin Pop
  Resource not unique (e.g. MAC or IP duplication).
648 e91cfc2a Iustin Pop
649 e91cfc2a Iustin Pop
``internal_error``
650 e91cfc2a Iustin Pop
  Internal cluster error. For example, a node is unreachable but not set
651 e91cfc2a Iustin Pop
  offline, or the ganeti node daemons are not working, etc. A
652 e91cfc2a Iustin Pop
  ``gnt-cluster verify`` should be run.
653 e91cfc2a Iustin Pop
654 e91cfc2a Iustin Pop
``environment_error``
655 e91cfc2a Iustin Pop
  Environment error (e.g. node disk error). A ``gnt-cluster verify``
656 e91cfc2a Iustin Pop
  should be run.
657 e91cfc2a Iustin Pop
658 e91cfc2a Iustin Pop
Note that in the above list, by entity we refer to a node or instance,
659 e91cfc2a Iustin Pop
while by a resource we refer to an instance's disk, or NIC, etc.
660 e91cfc2a Iustin Pop
661 6d81475c Iustin Pop
662 c8e0a534 Iustin Pop
``DELETE``
663 c8e0a534 Iustin Pop
~~~~~~~~~~
664 6d81475c Iustin Pop
665 c8e0a534 Iustin Pop
Cancel a not-yet-started job.
666 6d81475c Iustin Pop
667 793a8f7c Michael Hanselmann
668 793a8f7c Michael Hanselmann
``/2/jobs/[job_id]/wait``
669 793a8f7c Michael Hanselmann
+++++++++++++++++++++++++
670 793a8f7c Michael Hanselmann
671 793a8f7c Michael Hanselmann
``GET``
672 793a8f7c Michael Hanselmann
~~~~~~~
673 793a8f7c Michael Hanselmann
674 793a8f7c Michael Hanselmann
Waits for changes on a job. Takes the following body parameters in a
675 793a8f7c Michael Hanselmann
dict:
676 793a8f7c Michael Hanselmann
677 793a8f7c Michael Hanselmann
``fields``
678 793a8f7c Michael Hanselmann
  The job fields on which to watch for changes.
679 793a8f7c Michael Hanselmann
680 793a8f7c Michael Hanselmann
``previous_job_info``
681 793a8f7c Michael Hanselmann
  Previously received field values or None if not yet available.
682 793a8f7c Michael Hanselmann
683 793a8f7c Michael Hanselmann
``previous_log_serial``
684 793a8f7c Michael Hanselmann
  Highest log serial number received so far or None if not yet
685 793a8f7c Michael Hanselmann
  available.
686 793a8f7c Michael Hanselmann
687 793a8f7c Michael Hanselmann
Returns None if no changes have been detected and a dict with two keys,
688 793a8f7c Michael Hanselmann
``job_info`` and ``log_entries`` otherwise.
689 793a8f7c Michael Hanselmann
690 793a8f7c Michael Hanselmann
691 c8e0a534 Iustin Pop
``/2/nodes``
692 c8e0a534 Iustin Pop
++++++++++++
693 6d81475c Iustin Pop
694 c8e0a534 Iustin Pop
Nodes resource.
695 6d81475c Iustin Pop
696 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
697 6d81475c Iustin Pop
698 c8e0a534 Iustin Pop
``GET``
699 c8e0a534 Iustin Pop
~~~~~~~
700 6d81475c Iustin Pop
701 c8e0a534 Iustin Pop
Returns a list of all nodes.
702 6d81475c Iustin Pop
703 c8e0a534 Iustin Pop
Example::
704 6d81475c Iustin Pop
705 6d81475c Iustin Pop
    [
706 6d81475c Iustin Pop
      {
707 6d81475c Iustin Pop
        "id": "node1.example.com",
708 20b1bd80 Iustin Pop
        "uri": "\/nodes\/node1.example.com"
709 6d81475c Iustin Pop
      },
710 6d81475c Iustin Pop
      {
711 6d81475c Iustin Pop
        "id": "node2.example.com",
712 20b1bd80 Iustin Pop
        "uri": "\/nodes\/node2.example.com"
713 6d81475c Iustin Pop
      }
714 6d81475c Iustin Pop
    ]
715 6d81475c Iustin Pop
716 c71a1a3d Iustin Pop
If the optional 'bulk' argument is provided and set to 'true' value (i.e
717 c71a1a3d Iustin Pop
'?bulk=1'), the output contains detailed information about nodes as a
718 c71a1a3d Iustin Pop
list.
719 6d81475c Iustin Pop
720 c8e0a534 Iustin Pop
Example::
721 6d81475c Iustin Pop
722 6d81475c Iustin Pop
    [
723 6d81475c Iustin Pop
      {
724 6d81475c Iustin Pop
        "pinst_cnt": 1,
725 6d81475c Iustin Pop
        "mfree": 31280,
726 6d81475c Iustin Pop
        "mtotal": 32763,
727 6d81475c Iustin Pop
        "name": "www.example.com",
728 6d81475c Iustin Pop
        "tags": [],
729 6d81475c Iustin Pop
        "mnode": 512,
730 6d81475c Iustin Pop
        "dtotal": 5246208,
731 6d81475c Iustin Pop
        "sinst_cnt": 2,
732 6d81475c Iustin Pop
        "dfree": 5171712,
733 6d81475c Iustin Pop
        "offline": false
734 6d81475c Iustin Pop
      },
735 6d81475c Iustin Pop
      ...
736 6d81475c Iustin Pop
    ]
737 6d81475c Iustin Pop
738 f72542cc Michael Hanselmann
``/2/nodes/[node_name]``
739 f72542cc Michael Hanselmann
+++++++++++++++++++++++++++++++++
740 f72542cc Michael Hanselmann
741 f72542cc Michael Hanselmann
Returns information about a node.
742 f72542cc Michael Hanselmann
743 f72542cc Michael Hanselmann
It supports the following commands: ``GET``.
744 f72542cc Michael Hanselmann
745 73452f12 Michael Hanselmann
``/2/nodes/[node_name]/evacuate``
746 73452f12 Michael Hanselmann
+++++++++++++++++++++++++++++++++
747 73452f12 Michael Hanselmann
748 73452f12 Michael Hanselmann
Evacuates all secondary instances off a node.
749 73452f12 Michael Hanselmann
750 73452f12 Michael Hanselmann
It supports the following commands: ``POST``.
751 73452f12 Michael Hanselmann
752 73452f12 Michael Hanselmann
``POST``
753 73452f12 Michael Hanselmann
~~~~~~~~
754 73452f12 Michael Hanselmann
755 73452f12 Michael Hanselmann
To evacuate a node, either one of the ``iallocator`` or ``remote_node``
756 88394aa7 René Nussbaumer
parameters must be passed::
757 73452f12 Michael Hanselmann
758 73452f12 Michael Hanselmann
    evacuate?iallocator=[iallocator]
759 73452f12 Michael Hanselmann
    evacuate?remote_node=[nodeX.example.com]
760 73452f12 Michael Hanselmann
761 1c482bab Michael Hanselmann
``/2/nodes/[node_name]/migrate``
762 1c482bab Michael Hanselmann
+++++++++++++++++++++++++++++++++
763 1c482bab Michael Hanselmann
764 1c482bab Michael Hanselmann
Migrates all primary instances from a node.
765 1c482bab Michael Hanselmann
766 1c482bab Michael Hanselmann
It supports the following commands: ``POST``.
767 1c482bab Michael Hanselmann
768 1c482bab Michael Hanselmann
``POST``
769 1c482bab Michael Hanselmann
~~~~~~~~
770 1c482bab Michael Hanselmann
771 88394aa7 René Nussbaumer
No parameters are required, but the bool parameter ``live`` can be set
772 88394aa7 René Nussbaumer
to use live migration (if available).
773 1c482bab Michael Hanselmann
774 1c482bab Michael Hanselmann
    migrate?live=[0|1]
775 1c482bab Michael Hanselmann
776 64dae8fc Michael Hanselmann
``/2/nodes/[node_name]/role``
777 64dae8fc Michael Hanselmann
+++++++++++++++++++++++++++++
778 64dae8fc Michael Hanselmann
779 64dae8fc Michael Hanselmann
Manages node role.
780 64dae8fc Michael Hanselmann
781 64dae8fc Michael Hanselmann
It supports the following commands: ``GET``, ``PUT``.
782 64dae8fc Michael Hanselmann
783 64dae8fc Michael Hanselmann
The role is always one of the following:
784 64dae8fc Michael Hanselmann
785 64dae8fc Michael Hanselmann
  - drained
786 64dae8fc Michael Hanselmann
  - master
787 64dae8fc Michael Hanselmann
  - master-candidate
788 64dae8fc Michael Hanselmann
  - offline
789 64dae8fc Michael Hanselmann
  - regular
790 64dae8fc Michael Hanselmann
791 64dae8fc Michael Hanselmann
``GET``
792 64dae8fc Michael Hanselmann
~~~~~~~
793 64dae8fc Michael Hanselmann
794 64dae8fc Michael Hanselmann
Returns the current node role.
795 64dae8fc Michael Hanselmann
796 64dae8fc Michael Hanselmann
Example::
797 64dae8fc Michael Hanselmann
798 64dae8fc Michael Hanselmann
    "master-candidate"
799 64dae8fc Michael Hanselmann
800 64dae8fc Michael Hanselmann
``PUT``
801 64dae8fc Michael Hanselmann
~~~~~~~
802 64dae8fc Michael Hanselmann
803 64dae8fc Michael Hanselmann
Change the node role.
804 64dae8fc Michael Hanselmann
805 7faf5110 Michael Hanselmann
The request is a string which should be PUT to this URI. The result will
806 7faf5110 Michael Hanselmann
be a job id.
807 64dae8fc Michael Hanselmann
808 88394aa7 René Nussbaumer
It supports the bool ``force`` argument.
809 64dae8fc Michael Hanselmann
810 7a95a954 Michael Hanselmann
``/2/nodes/[node_name]/storage``
811 7a95a954 Michael Hanselmann
++++++++++++++++++++++++++++++++
812 7a95a954 Michael Hanselmann
813 7a95a954 Michael Hanselmann
Manages storage units on the node.
814 7a95a954 Michael Hanselmann
815 7a95a954 Michael Hanselmann
``GET``
816 7a95a954 Michael Hanselmann
~~~~~~~
817 7a95a954 Michael Hanselmann
818 7a95a954 Michael Hanselmann
Requests a list of storage units on a node. Requires the parameters
819 7a95a954 Michael Hanselmann
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and
820 7faf5110 Michael Hanselmann
``output_fields``. The result will be a job id, using which the result
821 7faf5110 Michael Hanselmann
can be retrieved.
822 7a95a954 Michael Hanselmann
823 1e82bc80 Michael Hanselmann
``/2/nodes/[node_name]/storage/modify``
824 1e82bc80 Michael Hanselmann
+++++++++++++++++++++++++++++++++++++++
825 1e82bc80 Michael Hanselmann
826 1e82bc80 Michael Hanselmann
Modifies storage units on the node.
827 1e82bc80 Michael Hanselmann
828 1e82bc80 Michael Hanselmann
``PUT``
829 1e82bc80 Michael Hanselmann
~~~~~~~
830 1e82bc80 Michael Hanselmann
831 7faf5110 Michael Hanselmann
Modifies parameters of storage units on the node. Requires the
832 7faf5110 Michael Hanselmann
parameters ``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``)
833 7faf5110 Michael Hanselmann
and ``name`` (name of the storage unit).  Parameters can be passed
834 7faf5110 Michael Hanselmann
additionally. Currently only ``allocatable`` (bool) is supported. The
835 7faf5110 Michael Hanselmann
result will be a job id.
836 1e82bc80 Michael Hanselmann
837 723f4565 Michael Hanselmann
``/2/nodes/[node_name]/storage/repair``
838 723f4565 Michael Hanselmann
+++++++++++++++++++++++++++++++++++++++
839 723f4565 Michael Hanselmann
840 723f4565 Michael Hanselmann
Repairs a storage unit on the node.
841 723f4565 Michael Hanselmann
842 723f4565 Michael Hanselmann
``PUT``
843 723f4565 Michael Hanselmann
~~~~~~~
844 723f4565 Michael Hanselmann
845 7faf5110 Michael Hanselmann
Repairs a storage unit on the node. Requires the parameters
846 7faf5110 Michael Hanselmann
``storage_type`` (currently only ``lvm-vg`` can be repaired) and
847 7faf5110 Michael Hanselmann
``name`` (name of the storage unit). The result will be a job id.
848 723f4565 Michael Hanselmann
849 c8e0a534 Iustin Pop
``/2/nodes/[node_name]/tags``
850 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++
851 6d81475c Iustin Pop
852 c8e0a534 Iustin Pop
Manages per-node tags.
853 6d81475c Iustin Pop
854 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
855 6d81475c Iustin Pop
856 c8e0a534 Iustin Pop
``GET``
857 c8e0a534 Iustin Pop
~~~~~~~
858 6d81475c Iustin Pop
859 c8e0a534 Iustin Pop
Returns a list of tags.
860 6d81475c Iustin Pop
861 c8e0a534 Iustin Pop
Example::
862 6d81475c Iustin Pop
863 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
864 6d81475c Iustin Pop
865 c8e0a534 Iustin Pop
``PUT``
866 c8e0a534 Iustin Pop
~~~~~~~
867 6d81475c Iustin Pop
868 c8e0a534 Iustin Pop
Add a set of tags.
869 6d81475c Iustin Pop
870 c8e0a534 Iustin Pop
The request as a list of strings should be PUT to this URI. The result
871 c8e0a534 Iustin Pop
will be a job id.
872 6d81475c Iustin Pop
873 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
874 2cad4b91 Iustin Pop
875 c8e0a534 Iustin Pop
``DELETE``
876 c8e0a534 Iustin Pop
~~~~~~~~~~
877 6d81475c Iustin Pop
878 c8e0a534 Iustin Pop
Deletes tags.
879 6d81475c Iustin Pop
880 c71a1a3d Iustin Pop
In order to delete a set of tags, the DELETE request should be addressed
881 c71a1a3d Iustin Pop
to URI like::
882 6d81475c Iustin Pop
883 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
884 6d81475c Iustin Pop
885 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
886 2cad4b91 Iustin Pop
887 2cad4b91 Iustin Pop
888 c8e0a534 Iustin Pop
``/2/os``
889 c8e0a534 Iustin Pop
+++++++++
890 6d81475c Iustin Pop
891 c8e0a534 Iustin Pop
OS resource.
892 6d81475c Iustin Pop
893 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
894 6d81475c Iustin Pop
895 c8e0a534 Iustin Pop
``GET``
896 c8e0a534 Iustin Pop
~~~~~~~
897 6d81475c Iustin Pop
898 c8e0a534 Iustin Pop
Return a list of all OSes.
899 6d81475c Iustin Pop
900 c8e0a534 Iustin Pop
Can return error 500 in case of a problem. Since this is a costly
901 c71a1a3d Iustin Pop
operation for Ganeti 2.0, it is not recommended to execute it too often.
902 6d81475c Iustin Pop
903 c8e0a534 Iustin Pop
Example::
904 6d81475c Iustin Pop
905 c8e0a534 Iustin Pop
    ["debian-etch"]
906 6d81475c Iustin Pop
907 c8e0a534 Iustin Pop
``/2/tags``
908 c8e0a534 Iustin Pop
+++++++++++
909 6d81475c Iustin Pop
910 c8e0a534 Iustin Pop
Manages cluster tags.
911 6d81475c Iustin Pop
912 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
913 6d81475c Iustin Pop
914 c8e0a534 Iustin Pop
``GET``
915 c8e0a534 Iustin Pop
~~~~~~~
916 6d81475c Iustin Pop
917 c8e0a534 Iustin Pop
Returns the cluster tags.
918 6d81475c Iustin Pop
919 c8e0a534 Iustin Pop
Example::
920 6d81475c Iustin Pop
921 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
922 6d81475c Iustin Pop
923 c8e0a534 Iustin Pop
``PUT``
924 c8e0a534 Iustin Pop
~~~~~~~
925 6d81475c Iustin Pop
926 c8e0a534 Iustin Pop
Adds a set of tags.
927 6d81475c Iustin Pop
928 c8e0a534 Iustin Pop
The request as a list of strings should be PUT to this URI. The result
929 c8e0a534 Iustin Pop
will be a job id.
930 6d81475c Iustin Pop
931 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
932 2cad4b91 Iustin Pop
933 2cad4b91 Iustin Pop
934 c8e0a534 Iustin Pop
``DELETE``
935 c8e0a534 Iustin Pop
~~~~~~~~~~
936 6d81475c Iustin Pop
937 c8e0a534 Iustin Pop
Deletes tags.
938 6d81475c Iustin Pop
939 c71a1a3d Iustin Pop
In order to delete a set of tags, the DELETE request should be addressed
940 c71a1a3d Iustin Pop
to URI like::
941 6d81475c Iustin Pop
942 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
943 6d81475c Iustin Pop
944 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
945 2cad4b91 Iustin Pop
946 2cad4b91 Iustin Pop
947 c8e0a534 Iustin Pop
``/version``
948 c8e0a534 Iustin Pop
++++++++++++
949 6d81475c Iustin Pop
950 c8e0a534 Iustin Pop
The version resource.
951 6d81475c Iustin Pop
952 c71a1a3d Iustin Pop
This resource should be used to determine the remote API version and to
953 c71a1a3d Iustin Pop
adapt clients accordingly.
954 6d81475c Iustin Pop
955 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
956 6d81475c Iustin Pop
957 c8e0a534 Iustin Pop
``GET``
958 c8e0a534 Iustin Pop
~~~~~~~
959 6d81475c Iustin Pop
960 c71a1a3d Iustin Pop
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0
961 c71a1a3d Iustin Pop
returns ``2``.
962 558fd122 Michael Hanselmann
963 558fd122 Michael Hanselmann
.. vim: set textwidth=72 :
964 c71a1a3d Iustin Pop
.. Local Variables:
965 c71a1a3d Iustin Pop
.. mode: rst
966 c71a1a3d Iustin Pop
.. fill-column: 72
967 c71a1a3d Iustin Pop
.. End: