root / doc / rapi.rst @ 6395cebb
History | View | Annotate | Download (22.4 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 | 5ef5cfea | Michael Hanselmann | Ganeti RAPI client |
140 | 5ef5cfea | Michael Hanselmann | ++++++++++++++++++ |
141 | 5ef5cfea | Michael Hanselmann | |
142 | 5ef5cfea | Michael Hanselmann | Ganeti includes a standalone RAPI client, ``lib/rapi/client.py``. |
143 | 5ef5cfea | Michael Hanselmann | |
144 | 4352bf6d | Iustin Pop | Shell |
145 | 4352bf6d | Iustin Pop | +++++ |
146 | 4352bf6d | Iustin Pop | |
147 | c8e0a534 | Iustin Pop | .. highlight:: sh |
148 | c8e0a534 | Iustin Pop | |
149 | 4352bf6d | Iustin Pop | Using wget:: |
150 | 4352bf6d | Iustin Pop | |
151 | c8e0a534 | Iustin Pop | wget -q -O - https://CLUSTERNAME:5080/2/info |
152 | 4352bf6d | Iustin Pop | |
153 | 4352bf6d | Iustin Pop | or curl:: |
154 | 4352bf6d | Iustin Pop | |
155 | 4352bf6d | Iustin Pop | curl https://CLUSTERNAME:5080/2/info |
156 | 4352bf6d | Iustin Pop | |
157 | 4352bf6d | Iustin Pop | |
158 | 4352bf6d | Iustin Pop | Python |
159 | 4352bf6d | Iustin Pop | ++++++ |
160 | 4352bf6d | Iustin Pop | |
161 | c71a1a3d | Iustin Pop | .. highlight:: python |
162 | c71a1a3d | Iustin Pop | |
163 | c71a1a3d | Iustin Pop | :: |
164 | 4352bf6d | Iustin Pop | |
165 | 4352bf6d | Iustin Pop | import urllib2 |
166 | 4fb301b5 | Tim Boring | f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info') |
167 | 4352bf6d | Iustin Pop | print f.read() |
168 | 4352bf6d | Iustin Pop | |
169 | 4352bf6d | Iustin Pop | |
170 | 4352bf6d | Iustin Pop | JavaScript |
171 | 4352bf6d | Iustin Pop | ++++++++++ |
172 | 4352bf6d | Iustin Pop | |
173 | 2cad4b91 | Iustin Pop | .. warning:: While it's possible to use JavaScript, it poses several |
174 | c71a1a3d | Iustin Pop | potential problems, including browser blocking request due to |
175 | c71a1a3d | Iustin Pop | non-standard ports or different domain names. Fetching the data on |
176 | c71a1a3d | Iustin Pop | the webserver is easier. |
177 | 4352bf6d | Iustin Pop | |
178 | c8e0a534 | Iustin Pop | .. highlight:: javascript |
179 | c8e0a534 | Iustin Pop | |
180 | 4352bf6d | Iustin Pop | :: |
181 | 4352bf6d | Iustin Pop | |
182 | 4fb301b5 | Tim Boring | var url = 'https://CLUSTERNAME:5080/2/info'; |
183 | 4352bf6d | Iustin Pop | var info; |
184 | 4352bf6d | Iustin Pop | var xmlreq = new XMLHttpRequest(); |
185 | 4352bf6d | Iustin Pop | xmlreq.onreadystatechange = function () { |
186 | 4352bf6d | Iustin Pop | if (xmlreq.readyState != 4) return; |
187 | 4352bf6d | Iustin Pop | if (xmlreq.status == 200) { |
188 | 4352bf6d | Iustin Pop | info = eval("(" + xmlreq.responseText + ")"); |
189 | 4352bf6d | Iustin Pop | alert(info); |
190 | 4352bf6d | Iustin Pop | } else { |
191 | 4352bf6d | Iustin Pop | alert('Error fetching cluster info'); |
192 | 4352bf6d | Iustin Pop | } |
193 | 4352bf6d | Iustin Pop | xmlreq = null; |
194 | 4352bf6d | Iustin Pop | }; |
195 | 4352bf6d | Iustin Pop | xmlreq.open('GET', url, true); |
196 | 4352bf6d | Iustin Pop | xmlreq.send(null); |
197 | 4352bf6d | Iustin Pop | |
198 | 4352bf6d | Iustin Pop | Resources |
199 | 4352bf6d | Iustin Pop | --------- |
200 | 4352bf6d | Iustin Pop | |
201 | c8e0a534 | Iustin Pop | .. highlight:: javascript |
202 | 6d81475c | Iustin Pop | |
203 | c8e0a534 | Iustin Pop | ``/`` |
204 | c8e0a534 | Iustin Pop | +++++ |
205 | 6d81475c | Iustin Pop | |
206 | c8e0a534 | Iustin Pop | The root resource. |
207 | 6d81475c | Iustin Pop | |
208 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``. |
209 | 6d81475c | Iustin Pop | |
210 | c8e0a534 | Iustin Pop | ``GET`` |
211 | c8e0a534 | Iustin Pop | ~~~~~~~ |
212 | 6d81475c | Iustin Pop | |
213 | c8e0a534 | Iustin Pop | Shows the list of mapped resources. |
214 | 6d81475c | Iustin Pop | |
215 | c8e0a534 | Iustin Pop | Returns: a dictionary with 'name' and 'uri' keys for each of them. |
216 | 6d81475c | Iustin Pop | |
217 | c8e0a534 | Iustin Pop | ``/2`` |
218 | c8e0a534 | Iustin Pop | ++++++ |
219 | 6d81475c | Iustin Pop | |
220 | c8e0a534 | Iustin Pop | The ``/2`` resource, the root of the version 2 API. |
221 | 6d81475c | Iustin Pop | |
222 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``. |
223 | 6d81475c | Iustin Pop | |
224 | c8e0a534 | Iustin Pop | ``GET`` |
225 | c8e0a534 | Iustin Pop | ~~~~~~~ |
226 | 6d81475c | Iustin Pop | |
227 | c8e0a534 | Iustin Pop | Show the list of mapped resources. |
228 | 6d81475c | Iustin Pop | |
229 | c8e0a534 | Iustin Pop | Returns: a dictionary with ``name`` and ``uri`` keys for each of them. |
230 | 6d81475c | Iustin Pop | |
231 | c8e0a534 | Iustin Pop | ``/2/info`` |
232 | c8e0a534 | Iustin Pop | +++++++++++ |
233 | 6d81475c | Iustin Pop | |
234 | c8e0a534 | Iustin Pop | Cluster information resource. |
235 | 6d81475c | Iustin Pop | |
236 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``. |
237 | 6d81475c | Iustin Pop | |
238 | c8e0a534 | Iustin Pop | ``GET`` |
239 | c8e0a534 | Iustin Pop | ~~~~~~~ |
240 | 6d81475c | Iustin Pop | |
241 | c8e0a534 | Iustin Pop | Returns cluster information. |
242 | 6d81475c | Iustin Pop | |
243 | c8e0a534 | Iustin Pop | Example:: |
244 | 6d81475c | Iustin Pop | |
245 | 6d81475c | Iustin Pop | { |
246 | 6d81475c | Iustin Pop | "config_version": 2000000, |
247 | 6d81475c | Iustin Pop | "name": "cluster", |
248 | 6d81475c | Iustin Pop | "software_version": "2.0.0~beta2", |
249 | 6d81475c | Iustin Pop | "os_api_version": 10, |
250 | 6d81475c | Iustin Pop | "export_version": 0, |
251 | 6d81475c | Iustin Pop | "candidate_pool_size": 10, |
252 | 6d81475c | Iustin Pop | "enabled_hypervisors": [ |
253 | 6d81475c | Iustin Pop | "fake" |
254 | 6d81475c | Iustin Pop | ], |
255 | 6d81475c | Iustin Pop | "hvparams": { |
256 | 6d81475c | Iustin Pop | "fake": {} |
257 | 6d81475c | Iustin Pop | }, |
258 | 6d81475c | Iustin Pop | "default_hypervisor": "fake", |
259 | 6d81475c | Iustin Pop | "master": "node1.example.com", |
260 | 6d81475c | Iustin Pop | "architecture": [ |
261 | 6d81475c | Iustin Pop | "64bit", |
262 | 6d81475c | Iustin Pop | "x86_64" |
263 | 6d81475c | Iustin Pop | ], |
264 | 6d81475c | Iustin Pop | "protocol_version": 20, |
265 | 6d81475c | Iustin Pop | "beparams": { |
266 | 6d81475c | Iustin Pop | "default": { |
267 | 6d81475c | Iustin Pop | "auto_balance": true, |
268 | 6d81475c | Iustin Pop | "vcpus": 1, |
269 | 6d81475c | Iustin Pop | "memory": 128 |
270 | 6d81475c | Iustin Pop | } |
271 | 6d81475c | Iustin Pop | } |
272 | 6d81475c | Iustin Pop | } |
273 | 6d81475c | Iustin Pop | |
274 | 508e9b20 | Michael Hanselmann | |
275 | 508e9b20 | Michael Hanselmann | ``/2/redistribute-config`` |
276 | 508e9b20 | Michael Hanselmann | ++++++++++++++++++++++++++ |
277 | 508e9b20 | Michael Hanselmann | |
278 | 508e9b20 | Michael Hanselmann | Redistribute configuration to all nodes. |
279 | 508e9b20 | Michael Hanselmann | |
280 | 508e9b20 | Michael Hanselmann | It supports the following commands: ``PUT``. |
281 | 508e9b20 | Michael Hanselmann | |
282 | 508e9b20 | Michael Hanselmann | ``PUT`` |
283 | 508e9b20 | Michael Hanselmann | ~~~~~~~ |
284 | 508e9b20 | Michael Hanselmann | |
285 | 508e9b20 | Michael Hanselmann | Redistribute configuration to all nodes. The result will be a job id. |
286 | 508e9b20 | Michael Hanselmann | |
287 | 508e9b20 | Michael Hanselmann | |
288 | 7eac4a4d | Michael Hanselmann | ``/2/features`` |
289 | 7eac4a4d | Michael Hanselmann | +++++++++++++++ |
290 | 7eac4a4d | Michael Hanselmann | |
291 | 7eac4a4d | Michael Hanselmann | ``GET`` |
292 | 7eac4a4d | Michael Hanselmann | ~~~~~~~ |
293 | 7eac4a4d | Michael Hanselmann | |
294 | 7eac4a4d | Michael Hanselmann | Returns a list of features supported by the RAPI server. Available |
295 | 7eac4a4d | Michael Hanselmann | features: |
296 | 7eac4a4d | Michael Hanselmann | |
297 | 7eac4a4d | Michael Hanselmann | ``instance-create-reqv1`` |
298 | 7eac4a4d | Michael Hanselmann | Instance creation request data version 1 supported. |
299 | 7eac4a4d | Michael Hanselmann | |
300 | 7eac4a4d | Michael Hanselmann | |
301 | c8e0a534 | Iustin Pop | ``/2/instances`` |
302 | c8e0a534 | Iustin Pop | ++++++++++++++++ |
303 | 6d81475c | Iustin Pop | |
304 | c8e0a534 | Iustin Pop | The instances resource. |
305 | 6d81475c | Iustin Pop | |
306 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``, ``POST``. |
307 | 6d81475c | Iustin Pop | |
308 | c8e0a534 | Iustin Pop | ``GET`` |
309 | c8e0a534 | Iustin Pop | ~~~~~~~ |
310 | 6d81475c | Iustin Pop | |
311 | c8e0a534 | Iustin Pop | Returns a list of all available instances. |
312 | 6d81475c | Iustin Pop | |
313 | c8e0a534 | Iustin Pop | Example:: |
314 | 6d81475c | Iustin Pop | |
315 | 6d81475c | Iustin Pop | [ |
316 | 6d81475c | Iustin Pop | { |
317 | 6d81475c | Iustin Pop | "name": "web.example.com", |
318 | 6d81475c | Iustin Pop | "uri": "\/instances\/web.example.com" |
319 | 6d81475c | Iustin Pop | }, |
320 | 6d81475c | Iustin Pop | { |
321 | 6d81475c | Iustin Pop | "name": "mail.example.com", |
322 | 6d81475c | Iustin Pop | "uri": "\/instances\/mail.example.com" |
323 | 6d81475c | Iustin Pop | } |
324 | 6d81475c | Iustin Pop | ] |
325 | 6d81475c | Iustin Pop | |
326 | 88394aa7 | René Nussbaumer | If the optional bool *bulk* argument is provided and set to a true value |
327 | 88394aa7 | René Nussbaumer | (i.e ``?bulk=1``), the output contains detailed information about |
328 | 88394aa7 | René Nussbaumer | instances as a list. |
329 | 6d81475c | Iustin Pop | |
330 | c8e0a534 | Iustin Pop | Example:: |
331 | 6d81475c | Iustin Pop | |
332 | 6d81475c | Iustin Pop | [ |
333 | 6d81475c | Iustin Pop | { |
334 | 6d81475c | Iustin Pop | "status": "running", |
335 | 6d81475c | Iustin Pop | "disk_usage": 20480, |
336 | 6d81475c | Iustin Pop | "nic.bridges": [ |
337 | 6d81475c | Iustin Pop | "xen-br0" |
338 | 6d81475c | Iustin Pop | ], |
339 | 6d81475c | Iustin Pop | "name": "web.example.com", |
340 | 6d81475c | Iustin Pop | "tags": ["tag1", "tag2"], |
341 | 6d81475c | Iustin Pop | "beparams": { |
342 | 6d81475c | Iustin Pop | "vcpus": 2, |
343 | 6d81475c | Iustin Pop | "memory": 512 |
344 | 6d81475c | Iustin Pop | }, |
345 | 6d81475c | Iustin Pop | "disk.sizes": [ |
346 | 6d81475c | Iustin Pop | 20480 |
347 | 6d81475c | Iustin Pop | ], |
348 | 6d81475c | Iustin Pop | "pnode": "node1.example.com", |
349 | 6d81475c | Iustin Pop | "nic.macs": ["01:23:45:67:89:01"], |
350 | 6d81475c | Iustin Pop | "snodes": ["node2.example.com"], |
351 | 6d81475c | Iustin Pop | "disk_template": "drbd", |
352 | 6d81475c | Iustin Pop | "admin_state": true, |
353 | 6d81475c | Iustin Pop | "os": "debian-etch", |
354 | 6d81475c | Iustin Pop | "oper_state": true |
355 | 6d81475c | Iustin Pop | }, |
356 | 6d81475c | Iustin Pop | ... |
357 | 6d81475c | Iustin Pop | ] |
358 | 6d81475c | Iustin Pop | |
359 | 6d81475c | Iustin Pop | |
360 | c8e0a534 | Iustin Pop | ``POST`` |
361 | c8e0a534 | Iustin Pop | ~~~~~~~~ |
362 | 6d81475c | Iustin Pop | |
363 | c8e0a534 | Iustin Pop | Creates an instance. |
364 | 6d81475c | Iustin Pop | |
365 | 88394aa7 | René Nussbaumer | If the optional bool *dry-run* argument is provided, the job will not be |
366 | 88394aa7 | René Nussbaumer | actually executed, only the pre-execution checks will be done. Query-ing |
367 | 88394aa7 | René Nussbaumer | the job result will return, in both dry-run and normal case, the list of |
368 | 88394aa7 | René Nussbaumer | nodes selected for the instance. |
369 | 2cad4b91 | Iustin Pop | |
370 | c8e0a534 | Iustin Pop | Returns: a job ID that can be used later for polling. |
371 | 6d81475c | Iustin Pop | |
372 | 6395cebb | Michael Hanselmann | Body parameters: |
373 | 6395cebb | Michael Hanselmann | |
374 | 6395cebb | Michael Hanselmann | ``__version__`` (int, required) |
375 | 6395cebb | Michael Hanselmann | Must be ``1`` (older Ganeti versions used a different format for |
376 | 6395cebb | Michael Hanselmann | instance creation requests, version ``0``, but that format is not |
377 | 6395cebb | Michael Hanselmann | documented). |
378 | 6395cebb | Michael Hanselmann | ``name`` (string, required) |
379 | 6395cebb | Michael Hanselmann | Instance name |
380 | 6395cebb | Michael Hanselmann | ``disk_template`` (string, required) |
381 | 6395cebb | Michael Hanselmann | Disk template for instance |
382 | 6395cebb | Michael Hanselmann | ``disks`` (list, required) |
383 | 6395cebb | Michael Hanselmann | List of disk definitions. Example: ``[{"size": 100}, {"size": 5}]``. |
384 | 6395cebb | Michael Hanselmann | Each disk definition must contain a ``size`` value and can contain an |
385 | 6395cebb | Michael Hanselmann | optional ``mode`` value denoting the disk access mode (``ro`` or |
386 | 6395cebb | Michael Hanselmann | ``rw``). |
387 | 6395cebb | Michael Hanselmann | ``nics`` (list, required) |
388 | 6395cebb | Michael Hanselmann | List of NIC (network interface) definitions. Example: ``[{}, {}, |
389 | 6395cebb | Michael Hanselmann | {"ip": "1.2.3.4"}]``. Each NIC definition can contain the optional |
390 | 6395cebb | Michael Hanselmann | values ``ip``, ``mode``, ``link`` and ``bridge``. |
391 | 6395cebb | Michael Hanselmann | ``os`` (string) |
392 | 6395cebb | Michael Hanselmann | Instance operating system. |
393 | 6395cebb | Michael Hanselmann | ``force_variant`` (bool) |
394 | 6395cebb | Michael Hanselmann | Whether to force an unknown variant. |
395 | 6395cebb | Michael Hanselmann | ``pnode`` (string) |
396 | 6395cebb | Michael Hanselmann | Primary node. |
397 | 6395cebb | Michael Hanselmann | ``snode`` (string) |
398 | 6395cebb | Michael Hanselmann | Secondary node. |
399 | 6395cebb | Michael Hanselmann | ``src_node`` (string) |
400 | 6395cebb | Michael Hanselmann | Source node for import. |
401 | 6395cebb | Michael Hanselmann | ``src_path`` (string) |
402 | 6395cebb | Michael Hanselmann | Source directory for import. |
403 | 6395cebb | Michael Hanselmann | ``start`` (bool) |
404 | 6395cebb | Michael Hanselmann | Whether to start instance after creation. |
405 | 6395cebb | Michael Hanselmann | ``ip_check`` (bool) |
406 | 6395cebb | Michael Hanselmann | Whether to ensure instance's IP address is inactive. |
407 | 6395cebb | Michael Hanselmann | ``name_check`` (bool) |
408 | 6395cebb | Michael Hanselmann | Whether to ensure instance's name is resolvable. |
409 | 6395cebb | Michael Hanselmann | ``file_storage_dir`` (string) |
410 | 6395cebb | Michael Hanselmann | File storage directory. |
411 | 6395cebb | Michael Hanselmann | ``file_driver`` (string) |
412 | 6395cebb | Michael Hanselmann | File storage driver. |
413 | 6395cebb | Michael Hanselmann | ``iallocator`` (string) |
414 | 6395cebb | Michael Hanselmann | Instance allocator name. |
415 | 6395cebb | Michael Hanselmann | ``hypervisor`` (string) |
416 | 6395cebb | Michael Hanselmann | Hypervisor name. |
417 | 6395cebb | Michael Hanselmann | ``hvparams`` (dict) |
418 | 6395cebb | Michael Hanselmann | Hypervisor parameters, hypervisor-dependent. |
419 | 6395cebb | Michael Hanselmann | ``beparams`` |
420 | 6395cebb | Michael Hanselmann | Backend parameters. |
421 | 6395cebb | Michael Hanselmann | |
422 | 6395cebb | Michael Hanselmann | |
423 | c8e0a534 | Iustin Pop | ``/2/instances/[instance_name]`` |
424 | c8e0a534 | Iustin Pop | ++++++++++++++++++++++++++++++++ |
425 | 6d81475c | Iustin Pop | |
426 | c8e0a534 | Iustin Pop | Instance-specific resource. |
427 | 6d81475c | Iustin Pop | |
428 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``, ``DELETE``. |
429 | 6d81475c | Iustin Pop | |
430 | c8e0a534 | Iustin Pop | ``GET`` |
431 | c8e0a534 | Iustin Pop | ~~~~~~~ |
432 | 6d81475c | Iustin Pop | |
433 | c8e0a534 | Iustin Pop | Returns information about an instance, similar to the bulk output from |
434 | c8e0a534 | Iustin Pop | the instance list. |
435 | 6d81475c | Iustin Pop | |
436 | c8e0a534 | Iustin Pop | ``DELETE`` |
437 | c8e0a534 | Iustin Pop | ~~~~~~~~~~ |
438 | 6d81475c | Iustin Pop | |
439 | c8e0a534 | Iustin Pop | Deletes an instance. |
440 | 6d81475c | Iustin Pop | |
441 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
442 | 2cad4b91 | Iustin Pop | |
443 | 6d81475c | Iustin Pop | |
444 | d8260842 | Michael Hanselmann | ``/2/instances/[instance_name]/info`` |
445 | d8260842 | Michael Hanselmann | +++++++++++++++++++++++++++++++++++++++ |
446 | d8260842 | Michael Hanselmann | |
447 | d8260842 | Michael Hanselmann | It supports the following commands: ``GET``. |
448 | d8260842 | Michael Hanselmann | |
449 | d8260842 | Michael Hanselmann | ``GET`` |
450 | d8260842 | Michael Hanselmann | ~~~~~~~ |
451 | d8260842 | Michael Hanselmann | |
452 | d8260842 | Michael Hanselmann | Requests detailed information about the instance. An optional parameter, |
453 | d8260842 | Michael Hanselmann | ``static`` (bool), can be set to return only static information from the |
454 | 7faf5110 | Michael Hanselmann | configuration without querying the instance's nodes. The result will be |
455 | 7faf5110 | Michael Hanselmann | a job id. |
456 | d8260842 | Michael Hanselmann | |
457 | d8260842 | Michael Hanselmann | |
458 | c8e0a534 | Iustin Pop | ``/2/instances/[instance_name]/reboot`` |
459 | c8e0a534 | Iustin Pop | +++++++++++++++++++++++++++++++++++++++ |
460 | 6d81475c | Iustin Pop | |
461 | c8e0a534 | Iustin Pop | Reboots URI for an instance. |
462 | 6d81475c | Iustin Pop | |
463 | c8e0a534 | Iustin Pop | It supports the following commands: ``POST``. |
464 | 6d81475c | Iustin Pop | |
465 | c8e0a534 | Iustin Pop | ``POST`` |
466 | c8e0a534 | Iustin Pop | ~~~~~~~~ |
467 | 6d81475c | Iustin Pop | |
468 | c8e0a534 | Iustin Pop | Reboots the instance. |
469 | 6d81475c | Iustin Pop | |
470 | 88394aa7 | René Nussbaumer | The URI takes optional ``type=soft|hard|full`` and |
471 | 88394aa7 | René Nussbaumer | ``ignore_secondaries=0|1`` parameters. |
472 | 88394aa7 | René Nussbaumer | |
473 | 88394aa7 | René Nussbaumer | ``type`` defines the reboot type. ``soft`` is just a normal reboot, |
474 | 88394aa7 | René Nussbaumer | without terminating the hypervisor. ``hard`` means full shutdown |
475 | 88394aa7 | René Nussbaumer | (including terminating the hypervisor process) and startup again. |
476 | 88394aa7 | René Nussbaumer | ``full`` is like ``hard`` but also recreates the configuration from |
477 | 88394aa7 | René Nussbaumer | ground up as if you would have done a ``gnt-instance shutdown`` and |
478 | 88394aa7 | René Nussbaumer | ``gnt-instance start`` on it. |
479 | 88394aa7 | René Nussbaumer | |
480 | 88394aa7 | René Nussbaumer | ``ignore_secondaries`` is a bool argument indicating if we start the |
481 | 88394aa7 | René Nussbaumer | instance even if secondary disks are failing. |
482 | 6d81475c | Iustin Pop | |
483 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
484 | 2cad4b91 | Iustin Pop | |
485 | 2cad4b91 | Iustin Pop | |
486 | c8e0a534 | Iustin Pop | ``/2/instances/[instance_name]/shutdown`` |
487 | c8e0a534 | Iustin Pop | +++++++++++++++++++++++++++++++++++++++++ |
488 | 6d81475c | Iustin Pop | |
489 | c8e0a534 | Iustin Pop | Instance shutdown URI. |
490 | 6d81475c | Iustin Pop | |
491 | c8e0a534 | Iustin Pop | It supports the following commands: ``PUT``. |
492 | 6d81475c | Iustin Pop | |
493 | c8e0a534 | Iustin Pop | ``PUT`` |
494 | c8e0a534 | Iustin Pop | ~~~~~~~ |
495 | 6d81475c | Iustin Pop | |
496 | c8e0a534 | Iustin Pop | Shutdowns an instance. |
497 | 6d81475c | Iustin Pop | |
498 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
499 | 2cad4b91 | Iustin Pop | |
500 | 6d81475c | Iustin Pop | |
501 | c8e0a534 | Iustin Pop | ``/2/instances/[instance_name]/startup`` |
502 | c8e0a534 | Iustin Pop | ++++++++++++++++++++++++++++++++++++++++ |
503 | 6d81475c | Iustin Pop | |
504 | c8e0a534 | Iustin Pop | Instance startup URI. |
505 | 6d81475c | Iustin Pop | |
506 | c8e0a534 | Iustin Pop | It supports the following commands: ``PUT``. |
507 | 6d81475c | Iustin Pop | |
508 | c8e0a534 | Iustin Pop | ``PUT`` |
509 | c8e0a534 | Iustin Pop | ~~~~~~~ |
510 | 6d81475c | Iustin Pop | |
511 | c8e0a534 | Iustin Pop | Startup an instance. |
512 | 6d81475c | Iustin Pop | |
513 | 88394aa7 | René Nussbaumer | The URI takes an optional ``force=1|0`` parameter to start the |
514 | 88394aa7 | René Nussbaumer | instance even if secondary disks are failing. |
515 | 6d81475c | Iustin Pop | |
516 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
517 | 2cad4b91 | Iustin Pop | |
518 | f72542cc | Michael Hanselmann | ``/2/instances/[instance_name]/reinstall`` |
519 | f72542cc | Michael Hanselmann | ++++++++++++++++++++++++++++++++++++++++++++++ |
520 | f72542cc | Michael Hanselmann | |
521 | f72542cc | Michael Hanselmann | Installs the operating system again. |
522 | f72542cc | Michael Hanselmann | |
523 | f72542cc | Michael Hanselmann | It supports the following commands: ``POST``. |
524 | f72542cc | Michael Hanselmann | |
525 | f72542cc | Michael Hanselmann | ``POST`` |
526 | f72542cc | Michael Hanselmann | ~~~~~~~~ |
527 | f72542cc | Michael Hanselmann | |
528 | f72542cc | Michael Hanselmann | Takes the parameters ``os`` (OS template name) and ``nostartup`` (bool). |
529 | f72542cc | Michael Hanselmann | |
530 | 2cad4b91 | Iustin Pop | |
531 | 4c98b915 | Michael Hanselmann | ``/2/instances/[instance_name]/replace-disks`` |
532 | 4c98b915 | Michael Hanselmann | ++++++++++++++++++++++++++++++++++++++++++++++ |
533 | 4c98b915 | Michael Hanselmann | |
534 | 4c98b915 | Michael Hanselmann | Replaces disks on an instance. |
535 | 4c98b915 | Michael Hanselmann | |
536 | 4c98b915 | Michael Hanselmann | It supports the following commands: ``POST``. |
537 | 4c98b915 | Michael Hanselmann | |
538 | 4c98b915 | Michael Hanselmann | ``POST`` |
539 | 4c98b915 | Michael Hanselmann | ~~~~~~~~ |
540 | 4c98b915 | Michael Hanselmann | |
541 | 4c98b915 | Michael Hanselmann | Takes the parameters ``mode`` (one of ``replace_on_primary``, |
542 | 7faf5110 | Michael Hanselmann | ``replace_on_secondary``, ``replace_new_secondary`` or |
543 | 7faf5110 | Michael Hanselmann | ``replace_auto``), ``disks`` (comma separated list of disk indexes), |
544 | 7faf5110 | Michael Hanselmann | ``remote_node`` and ``iallocator``. |
545 | 4c98b915 | Michael Hanselmann | |
546 | 88394aa7 | René Nussbaumer | Either ``remote_node`` or ``iallocator`` needs to be defined when using |
547 | 88394aa7 | René Nussbaumer | ``mode=replace_new_secondary``. |
548 | 88394aa7 | René Nussbaumer | |
549 | 88394aa7 | René Nussbaumer | ``mode`` is a mandatory parameter. ``replace_auto`` tries to determine |
550 | 88394aa7 | René Nussbaumer | the broken disk(s) on its own and replacing it. |
551 | 88394aa7 | René Nussbaumer | |
552 | 4c98b915 | Michael Hanselmann | |
553 | 2263aec2 | René Nussbaumer | ``/2/instances/[instance_name]/activate-disks`` |
554 | 2263aec2 | René Nussbaumer | +++++++++++++++++++++++++++++++++++++++++++++++ |
555 | 2263aec2 | René Nussbaumer | |
556 | 2263aec2 | René Nussbaumer | Activate disks on an instance. |
557 | 2263aec2 | René Nussbaumer | |
558 | 2263aec2 | René Nussbaumer | It supports the following commands: ``PUT``. |
559 | 2263aec2 | René Nussbaumer | |
560 | 2263aec2 | René Nussbaumer | ``PUT`` |
561 | 2263aec2 | René Nussbaumer | ~~~~~~~ |
562 | 2263aec2 | René Nussbaumer | |
563 | 88394aa7 | René Nussbaumer | Takes the bool parameter ``ignore_size``. When set ignore the recorded |
564 | 2263aec2 | René Nussbaumer | size (useful for forcing activation when recorded size is wrong). |
565 | 2263aec2 | René Nussbaumer | |
566 | 2263aec2 | René Nussbaumer | |
567 | 2263aec2 | René Nussbaumer | ``/2/instances/[instance_name]/deactivate-disks`` |
568 | 2263aec2 | René Nussbaumer | +++++++++++++++++++++++++++++++++++++++++++++++++ |
569 | 2263aec2 | René Nussbaumer | |
570 | 2263aec2 | René Nussbaumer | Deactivate disks on an instance. |
571 | 2263aec2 | René Nussbaumer | |
572 | 2263aec2 | René Nussbaumer | It supports the following commands: ``PUT``. |
573 | 2263aec2 | René Nussbaumer | |
574 | 2263aec2 | René Nussbaumer | ``PUT`` |
575 | 2263aec2 | René Nussbaumer | ~~~~~~~ |
576 | 2263aec2 | René Nussbaumer | |
577 | 2263aec2 | René Nussbaumer | Takes no parameters. |
578 | 2263aec2 | René Nussbaumer | |
579 | 2263aec2 | René Nussbaumer | |
580 | c8e0a534 | Iustin Pop | ``/2/instances/[instance_name]/tags`` |
581 | c8e0a534 | Iustin Pop | +++++++++++++++++++++++++++++++++++++ |
582 | 6d81475c | Iustin Pop | |
583 | c8e0a534 | Iustin Pop | Manages per-instance tags. |
584 | 6d81475c | Iustin Pop | |
585 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
586 | 6d81475c | Iustin Pop | |
587 | c8e0a534 | Iustin Pop | ``GET`` |
588 | c8e0a534 | Iustin Pop | ~~~~~~~ |
589 | 6d81475c | Iustin Pop | |
590 | c8e0a534 | Iustin Pop | Returns a list of tags. |
591 | 6d81475c | Iustin Pop | |
592 | c8e0a534 | Iustin Pop | Example:: |
593 | 6d81475c | Iustin Pop | |
594 | c8e0a534 | Iustin Pop | ["tag1", "tag2", "tag3"] |
595 | 6d81475c | Iustin Pop | |
596 | c8e0a534 | Iustin Pop | ``PUT`` |
597 | c8e0a534 | Iustin Pop | ~~~~~~~ |
598 | 6d81475c | Iustin Pop | |
599 | c8e0a534 | Iustin Pop | Add a set of tags. |
600 | 6d81475c | Iustin Pop | |
601 | c8e0a534 | Iustin Pop | The request as a list of strings should be ``PUT`` to this URI. The |
602 | 508e9b20 | Michael Hanselmann | result will be a job id. |
603 | 6d81475c | Iustin Pop | |
604 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
605 | 2cad4b91 | Iustin Pop | |
606 | 2cad4b91 | Iustin Pop | |
607 | c8e0a534 | Iustin Pop | ``DELETE`` |
608 | c8e0a534 | Iustin Pop | ~~~~~~~~~~ |
609 | 6d81475c | Iustin Pop | |
610 | c8e0a534 | Iustin Pop | Delete a tag. |
611 | 6d81475c | Iustin Pop | |
612 | c71a1a3d | Iustin Pop | In order to delete a set of tags, the DELETE request should be addressed |
613 | c71a1a3d | Iustin Pop | to URI like:: |
614 | 6d81475c | Iustin Pop | |
615 | c8e0a534 | Iustin Pop | /tags?tag=[tag]&tag=[tag] |
616 | 6d81475c | Iustin Pop | |
617 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
618 | 2cad4b91 | Iustin Pop | |
619 | 2cad4b91 | Iustin Pop | |
620 | c8e0a534 | Iustin Pop | ``/2/jobs`` |
621 | c8e0a534 | Iustin Pop | +++++++++++ |
622 | 6d81475c | Iustin Pop | |
623 | c8e0a534 | Iustin Pop | The ``/2/jobs`` resource. |
624 | 6d81475c | Iustin Pop | |
625 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``. |
626 | 6d81475c | Iustin Pop | |
627 | c8e0a534 | Iustin Pop | ``GET`` |
628 | c8e0a534 | Iustin Pop | ~~~~~~~ |
629 | 6d81475c | Iustin Pop | |
630 | c8e0a534 | Iustin Pop | Returns a dictionary of jobs. |
631 | 6d81475c | Iustin Pop | |
632 | c8e0a534 | Iustin Pop | Returns: a dictionary with jobs id and uri. |
633 | 6d81475c | Iustin Pop | |
634 | c8e0a534 | Iustin Pop | ``/2/jobs/[job_id]`` |
635 | c8e0a534 | Iustin Pop | ++++++++++++++++++++ |
636 | 6d81475c | Iustin Pop | |
637 | 6d81475c | Iustin Pop | |
638 | c8e0a534 | Iustin Pop | Individual job URI. |
639 | 6d81475c | Iustin Pop | |
640 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``, ``DELETE``. |
641 | 6d81475c | Iustin Pop | |
642 | c8e0a534 | Iustin Pop | ``GET`` |
643 | c8e0a534 | Iustin Pop | ~~~~~~~ |
644 | 6d81475c | Iustin Pop | |
645 | c8e0a534 | Iustin Pop | Returns a job status. |
646 | 6d81475c | Iustin Pop | |
647 | c8e0a534 | Iustin Pop | Returns: a dictionary with job parameters. |
648 | 6d81475c | Iustin Pop | |
649 | c8e0a534 | Iustin Pop | The result includes: |
650 | 6d81475c | Iustin Pop | |
651 | c8e0a534 | Iustin Pop | - id: job ID as a number |
652 | c8e0a534 | Iustin Pop | - status: current job status as a string |
653 | c71a1a3d | Iustin Pop | - ops: involved OpCodes as a list of dictionaries for each opcodes in |
654 | c71a1a3d | Iustin Pop | the job |
655 | c8e0a534 | Iustin Pop | - opstatus: OpCodes status as a list |
656 | e91cfc2a | Iustin Pop | - opresult: OpCodes results as a list |
657 | e91cfc2a | Iustin Pop | |
658 | e91cfc2a | Iustin Pop | For a successful opcode, the ``opresult`` field corresponding to it will |
659 | e91cfc2a | Iustin Pop | contain the raw result from its :term:`LogicalUnit`. In case an opcode |
660 | e91cfc2a | Iustin Pop | has failed, its element in the opresult list will be a list of two |
661 | e91cfc2a | Iustin Pop | elements: |
662 | e91cfc2a | Iustin Pop | |
663 | e91cfc2a | Iustin Pop | - first element the error type (the Ganeti internal error name) |
664 | e91cfc2a | Iustin Pop | - second element a list of either one or two elements: |
665 | e91cfc2a | Iustin Pop | |
666 | e91cfc2a | Iustin Pop | - the first element is the textual error description |
667 | e91cfc2a | Iustin Pop | - the second element, if any, will hold an error classification |
668 | e91cfc2a | Iustin Pop | |
669 | e91cfc2a | Iustin Pop | The error classification is most useful for the ``OpPrereqError`` |
670 | e91cfc2a | Iustin Pop | error type - these errors happen before the OpCode has started |
671 | e91cfc2a | Iustin Pop | executing, so it's possible to retry the OpCode without side |
672 | e91cfc2a | Iustin Pop | effects. But whether it make sense to retry depends on the error |
673 | e91cfc2a | Iustin Pop | classification: |
674 | e91cfc2a | Iustin Pop | |
675 | e91cfc2a | Iustin Pop | ``resolver_error`` |
676 | e91cfc2a | Iustin Pop | Resolver errors. This usually means that a name doesn't exist in DNS, |
677 | e91cfc2a | Iustin Pop | so if it's a case of slow DNS propagation the operation can be retried |
678 | e91cfc2a | Iustin Pop | later. |
679 | e91cfc2a | Iustin Pop | |
680 | e91cfc2a | Iustin Pop | ``insufficient_resources`` |
681 | e91cfc2a | Iustin Pop | Not enough resources (iallocator failure, disk space, memory, |
682 | e91cfc2a | Iustin Pop | etc.). If the resources on the cluster increase, the operation might |
683 | e91cfc2a | Iustin Pop | succeed. |
684 | e91cfc2a | Iustin Pop | |
685 | e91cfc2a | Iustin Pop | ``wrong_input`` |
686 | e91cfc2a | Iustin Pop | Wrong arguments (at syntax level). The operation will not ever be |
687 | e91cfc2a | Iustin Pop | accepted unless the arguments change. |
688 | e91cfc2a | Iustin Pop | |
689 | e91cfc2a | Iustin Pop | ``wrong_state`` |
690 | e91cfc2a | Iustin Pop | Wrong entity state. For example, live migration has been requested for |
691 | e91cfc2a | Iustin Pop | a down instance, or instance creation on an offline node. The |
692 | e91cfc2a | Iustin Pop | operation can be retried once the resource has changed state. |
693 | e91cfc2a | Iustin Pop | |
694 | e91cfc2a | Iustin Pop | ``unknown_entity`` |
695 | e91cfc2a | Iustin Pop | Entity not found. For example, information has been requested for an |
696 | e91cfc2a | Iustin Pop | unknown instance. |
697 | e91cfc2a | Iustin Pop | |
698 | e91cfc2a | Iustin Pop | ``already_exists`` |
699 | e91cfc2a | Iustin Pop | Entity already exists. For example, instance creation has been |
700 | e91cfc2a | Iustin Pop | requested for an already-existing instance. |
701 | e91cfc2a | Iustin Pop | |
702 | e91cfc2a | Iustin Pop | ``resource_not_unique`` |
703 | e91cfc2a | Iustin Pop | Resource not unique (e.g. MAC or IP duplication). |
704 | e91cfc2a | Iustin Pop | |
705 | e91cfc2a | Iustin Pop | ``internal_error`` |
706 | e91cfc2a | Iustin Pop | Internal cluster error. For example, a node is unreachable but not set |
707 | e91cfc2a | Iustin Pop | offline, or the ganeti node daemons are not working, etc. A |
708 | e91cfc2a | Iustin Pop | ``gnt-cluster verify`` should be run. |
709 | e91cfc2a | Iustin Pop | |
710 | e91cfc2a | Iustin Pop | ``environment_error`` |
711 | e91cfc2a | Iustin Pop | Environment error (e.g. node disk error). A ``gnt-cluster verify`` |
712 | e91cfc2a | Iustin Pop | should be run. |
713 | e91cfc2a | Iustin Pop | |
714 | e91cfc2a | Iustin Pop | Note that in the above list, by entity we refer to a node or instance, |
715 | e91cfc2a | Iustin Pop | while by a resource we refer to an instance's disk, or NIC, etc. |
716 | e91cfc2a | Iustin Pop | |
717 | 6d81475c | Iustin Pop | |
718 | c8e0a534 | Iustin Pop | ``DELETE`` |
719 | c8e0a534 | Iustin Pop | ~~~~~~~~~~ |
720 | 6d81475c | Iustin Pop | |
721 | c8e0a534 | Iustin Pop | Cancel a not-yet-started job. |
722 | 6d81475c | Iustin Pop | |
723 | 793a8f7c | Michael Hanselmann | |
724 | 793a8f7c | Michael Hanselmann | ``/2/jobs/[job_id]/wait`` |
725 | 793a8f7c | Michael Hanselmann | +++++++++++++++++++++++++ |
726 | 793a8f7c | Michael Hanselmann | |
727 | 793a8f7c | Michael Hanselmann | ``GET`` |
728 | 793a8f7c | Michael Hanselmann | ~~~~~~~ |
729 | 793a8f7c | Michael Hanselmann | |
730 | 793a8f7c | Michael Hanselmann | Waits for changes on a job. Takes the following body parameters in a |
731 | 793a8f7c | Michael Hanselmann | dict: |
732 | 793a8f7c | Michael Hanselmann | |
733 | 793a8f7c | Michael Hanselmann | ``fields`` |
734 | 793a8f7c | Michael Hanselmann | The job fields on which to watch for changes. |
735 | 793a8f7c | Michael Hanselmann | |
736 | 793a8f7c | Michael Hanselmann | ``previous_job_info`` |
737 | 793a8f7c | Michael Hanselmann | Previously received field values or None if not yet available. |
738 | 793a8f7c | Michael Hanselmann | |
739 | 793a8f7c | Michael Hanselmann | ``previous_log_serial`` |
740 | 793a8f7c | Michael Hanselmann | Highest log serial number received so far or None if not yet |
741 | 793a8f7c | Michael Hanselmann | available. |
742 | 793a8f7c | Michael Hanselmann | |
743 | 793a8f7c | Michael Hanselmann | Returns None if no changes have been detected and a dict with two keys, |
744 | 793a8f7c | Michael Hanselmann | ``job_info`` and ``log_entries`` otherwise. |
745 | 793a8f7c | Michael Hanselmann | |
746 | 793a8f7c | Michael Hanselmann | |
747 | c8e0a534 | Iustin Pop | ``/2/nodes`` |
748 | c8e0a534 | Iustin Pop | ++++++++++++ |
749 | 6d81475c | Iustin Pop | |
750 | c8e0a534 | Iustin Pop | Nodes resource. |
751 | 6d81475c | Iustin Pop | |
752 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``. |
753 | 6d81475c | Iustin Pop | |
754 | c8e0a534 | Iustin Pop | ``GET`` |
755 | c8e0a534 | Iustin Pop | ~~~~~~~ |
756 | 6d81475c | Iustin Pop | |
757 | c8e0a534 | Iustin Pop | Returns a list of all nodes. |
758 | 6d81475c | Iustin Pop | |
759 | c8e0a534 | Iustin Pop | Example:: |
760 | 6d81475c | Iustin Pop | |
761 | 6d81475c | Iustin Pop | [ |
762 | 6d81475c | Iustin Pop | { |
763 | 6d81475c | Iustin Pop | "id": "node1.example.com", |
764 | 20b1bd80 | Iustin Pop | "uri": "\/nodes\/node1.example.com" |
765 | 6d81475c | Iustin Pop | }, |
766 | 6d81475c | Iustin Pop | { |
767 | 6d81475c | Iustin Pop | "id": "node2.example.com", |
768 | 20b1bd80 | Iustin Pop | "uri": "\/nodes\/node2.example.com" |
769 | 6d81475c | Iustin Pop | } |
770 | 6d81475c | Iustin Pop | ] |
771 | 6d81475c | Iustin Pop | |
772 | c71a1a3d | Iustin Pop | If the optional 'bulk' argument is provided and set to 'true' value (i.e |
773 | c71a1a3d | Iustin Pop | '?bulk=1'), the output contains detailed information about nodes as a |
774 | c71a1a3d | Iustin Pop | list. |
775 | 6d81475c | Iustin Pop | |
776 | c8e0a534 | Iustin Pop | Example:: |
777 | 6d81475c | Iustin Pop | |
778 | 6d81475c | Iustin Pop | [ |
779 | 6d81475c | Iustin Pop | { |
780 | 6d81475c | Iustin Pop | "pinst_cnt": 1, |
781 | 6d81475c | Iustin Pop | "mfree": 31280, |
782 | 6d81475c | Iustin Pop | "mtotal": 32763, |
783 | 6d81475c | Iustin Pop | "name": "www.example.com", |
784 | 6d81475c | Iustin Pop | "tags": [], |
785 | 6d81475c | Iustin Pop | "mnode": 512, |
786 | 6d81475c | Iustin Pop | "dtotal": 5246208, |
787 | 6d81475c | Iustin Pop | "sinst_cnt": 2, |
788 | 6d81475c | Iustin Pop | "dfree": 5171712, |
789 | 6d81475c | Iustin Pop | "offline": false |
790 | 6d81475c | Iustin Pop | }, |
791 | 6d81475c | Iustin Pop | ... |
792 | 6d81475c | Iustin Pop | ] |
793 | 6d81475c | Iustin Pop | |
794 | f72542cc | Michael Hanselmann | ``/2/nodes/[node_name]`` |
795 | f72542cc | Michael Hanselmann | +++++++++++++++++++++++++++++++++ |
796 | f72542cc | Michael Hanselmann | |
797 | f72542cc | Michael Hanselmann | Returns information about a node. |
798 | f72542cc | Michael Hanselmann | |
799 | f72542cc | Michael Hanselmann | It supports the following commands: ``GET``. |
800 | f72542cc | Michael Hanselmann | |
801 | 73452f12 | Michael Hanselmann | ``/2/nodes/[node_name]/evacuate`` |
802 | 73452f12 | Michael Hanselmann | +++++++++++++++++++++++++++++++++ |
803 | 73452f12 | Michael Hanselmann | |
804 | 73452f12 | Michael Hanselmann | Evacuates all secondary instances off a node. |
805 | 73452f12 | Michael Hanselmann | |
806 | 73452f12 | Michael Hanselmann | It supports the following commands: ``POST``. |
807 | 73452f12 | Michael Hanselmann | |
808 | 73452f12 | Michael Hanselmann | ``POST`` |
809 | 73452f12 | Michael Hanselmann | ~~~~~~~~ |
810 | 73452f12 | Michael Hanselmann | |
811 | 73452f12 | Michael Hanselmann | To evacuate a node, either one of the ``iallocator`` or ``remote_node`` |
812 | 88394aa7 | René Nussbaumer | parameters must be passed:: |
813 | 73452f12 | Michael Hanselmann | |
814 | 73452f12 | Michael Hanselmann | evacuate?iallocator=[iallocator] |
815 | 73452f12 | Michael Hanselmann | evacuate?remote_node=[nodeX.example.com] |
816 | 73452f12 | Michael Hanselmann | |
817 | 1c482bab | Michael Hanselmann | ``/2/nodes/[node_name]/migrate`` |
818 | 1c482bab | Michael Hanselmann | +++++++++++++++++++++++++++++++++ |
819 | 1c482bab | Michael Hanselmann | |
820 | 1c482bab | Michael Hanselmann | Migrates all primary instances from a node. |
821 | 1c482bab | Michael Hanselmann | |
822 | 1c482bab | Michael Hanselmann | It supports the following commands: ``POST``. |
823 | 1c482bab | Michael Hanselmann | |
824 | 1c482bab | Michael Hanselmann | ``POST`` |
825 | 1c482bab | Michael Hanselmann | ~~~~~~~~ |
826 | 1c482bab | Michael Hanselmann | |
827 | 88394aa7 | René Nussbaumer | No parameters are required, but the bool parameter ``live`` can be set |
828 | 88394aa7 | René Nussbaumer | to use live migration (if available). |
829 | 1c482bab | Michael Hanselmann | |
830 | 1c482bab | Michael Hanselmann | migrate?live=[0|1] |
831 | 1c482bab | Michael Hanselmann | |
832 | 64dae8fc | Michael Hanselmann | ``/2/nodes/[node_name]/role`` |
833 | 64dae8fc | Michael Hanselmann | +++++++++++++++++++++++++++++ |
834 | 64dae8fc | Michael Hanselmann | |
835 | 64dae8fc | Michael Hanselmann | Manages node role. |
836 | 64dae8fc | Michael Hanselmann | |
837 | 64dae8fc | Michael Hanselmann | It supports the following commands: ``GET``, ``PUT``. |
838 | 64dae8fc | Michael Hanselmann | |
839 | 64dae8fc | Michael Hanselmann | The role is always one of the following: |
840 | 64dae8fc | Michael Hanselmann | |
841 | 64dae8fc | Michael Hanselmann | - drained |
842 | 64dae8fc | Michael Hanselmann | - master |
843 | 64dae8fc | Michael Hanselmann | - master-candidate |
844 | 64dae8fc | Michael Hanselmann | - offline |
845 | 64dae8fc | Michael Hanselmann | - regular |
846 | 64dae8fc | Michael Hanselmann | |
847 | 64dae8fc | Michael Hanselmann | ``GET`` |
848 | 64dae8fc | Michael Hanselmann | ~~~~~~~ |
849 | 64dae8fc | Michael Hanselmann | |
850 | 64dae8fc | Michael Hanselmann | Returns the current node role. |
851 | 64dae8fc | Michael Hanselmann | |
852 | 64dae8fc | Michael Hanselmann | Example:: |
853 | 64dae8fc | Michael Hanselmann | |
854 | 64dae8fc | Michael Hanselmann | "master-candidate" |
855 | 64dae8fc | Michael Hanselmann | |
856 | 64dae8fc | Michael Hanselmann | ``PUT`` |
857 | 64dae8fc | Michael Hanselmann | ~~~~~~~ |
858 | 64dae8fc | Michael Hanselmann | |
859 | 64dae8fc | Michael Hanselmann | Change the node role. |
860 | 64dae8fc | Michael Hanselmann | |
861 | 7faf5110 | Michael Hanselmann | The request is a string which should be PUT to this URI. The result will |
862 | 7faf5110 | Michael Hanselmann | be a job id. |
863 | 64dae8fc | Michael Hanselmann | |
864 | 88394aa7 | René Nussbaumer | It supports the bool ``force`` argument. |
865 | 64dae8fc | Michael Hanselmann | |
866 | 7a95a954 | Michael Hanselmann | ``/2/nodes/[node_name]/storage`` |
867 | 7a95a954 | Michael Hanselmann | ++++++++++++++++++++++++++++++++ |
868 | 7a95a954 | Michael Hanselmann | |
869 | 7a95a954 | Michael Hanselmann | Manages storage units on the node. |
870 | 7a95a954 | Michael Hanselmann | |
871 | 7a95a954 | Michael Hanselmann | ``GET`` |
872 | 7a95a954 | Michael Hanselmann | ~~~~~~~ |
873 | 7a95a954 | Michael Hanselmann | |
874 | 7a95a954 | Michael Hanselmann | Requests a list of storage units on a node. Requires the parameters |
875 | 7a95a954 | Michael Hanselmann | ``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and |
876 | 7faf5110 | Michael Hanselmann | ``output_fields``. The result will be a job id, using which the result |
877 | 7faf5110 | Michael Hanselmann | can be retrieved. |
878 | 7a95a954 | Michael Hanselmann | |
879 | 1e82bc80 | Michael Hanselmann | ``/2/nodes/[node_name]/storage/modify`` |
880 | 1e82bc80 | Michael Hanselmann | +++++++++++++++++++++++++++++++++++++++ |
881 | 1e82bc80 | Michael Hanselmann | |
882 | 1e82bc80 | Michael Hanselmann | Modifies storage units on the node. |
883 | 1e82bc80 | Michael Hanselmann | |
884 | 1e82bc80 | Michael Hanselmann | ``PUT`` |
885 | 1e82bc80 | Michael Hanselmann | ~~~~~~~ |
886 | 1e82bc80 | Michael Hanselmann | |
887 | 7faf5110 | Michael Hanselmann | Modifies parameters of storage units on the node. Requires the |
888 | 7faf5110 | Michael Hanselmann | parameters ``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) |
889 | 7faf5110 | Michael Hanselmann | and ``name`` (name of the storage unit). Parameters can be passed |
890 | 7faf5110 | Michael Hanselmann | additionally. Currently only ``allocatable`` (bool) is supported. The |
891 | 7faf5110 | Michael Hanselmann | result will be a job id. |
892 | 1e82bc80 | Michael Hanselmann | |
893 | 723f4565 | Michael Hanselmann | ``/2/nodes/[node_name]/storage/repair`` |
894 | 723f4565 | Michael Hanselmann | +++++++++++++++++++++++++++++++++++++++ |
895 | 723f4565 | Michael Hanselmann | |
896 | 723f4565 | Michael Hanselmann | Repairs a storage unit on the node. |
897 | 723f4565 | Michael Hanselmann | |
898 | 723f4565 | Michael Hanselmann | ``PUT`` |
899 | 723f4565 | Michael Hanselmann | ~~~~~~~ |
900 | 723f4565 | Michael Hanselmann | |
901 | 7faf5110 | Michael Hanselmann | Repairs a storage unit on the node. Requires the parameters |
902 | 7faf5110 | Michael Hanselmann | ``storage_type`` (currently only ``lvm-vg`` can be repaired) and |
903 | 7faf5110 | Michael Hanselmann | ``name`` (name of the storage unit). The result will be a job id. |
904 | 723f4565 | Michael Hanselmann | |
905 | c8e0a534 | Iustin Pop | ``/2/nodes/[node_name]/tags`` |
906 | c8e0a534 | Iustin Pop | +++++++++++++++++++++++++++++ |
907 | 6d81475c | Iustin Pop | |
908 | c8e0a534 | Iustin Pop | Manages per-node tags. |
909 | 6d81475c | Iustin Pop | |
910 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
911 | 6d81475c | Iustin Pop | |
912 | c8e0a534 | Iustin Pop | ``GET`` |
913 | c8e0a534 | Iustin Pop | ~~~~~~~ |
914 | 6d81475c | Iustin Pop | |
915 | c8e0a534 | Iustin Pop | Returns a list of tags. |
916 | 6d81475c | Iustin Pop | |
917 | c8e0a534 | Iustin Pop | Example:: |
918 | 6d81475c | Iustin Pop | |
919 | c8e0a534 | Iustin Pop | ["tag1", "tag2", "tag3"] |
920 | 6d81475c | Iustin Pop | |
921 | c8e0a534 | Iustin Pop | ``PUT`` |
922 | c8e0a534 | Iustin Pop | ~~~~~~~ |
923 | 6d81475c | Iustin Pop | |
924 | c8e0a534 | Iustin Pop | Add a set of tags. |
925 | 6d81475c | Iustin Pop | |
926 | c8e0a534 | Iustin Pop | The request as a list of strings should be PUT to this URI. The result |
927 | c8e0a534 | Iustin Pop | will be a job id. |
928 | 6d81475c | Iustin Pop | |
929 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
930 | 2cad4b91 | Iustin Pop | |
931 | c8e0a534 | Iustin Pop | ``DELETE`` |
932 | c8e0a534 | Iustin Pop | ~~~~~~~~~~ |
933 | 6d81475c | Iustin Pop | |
934 | c8e0a534 | Iustin Pop | Deletes tags. |
935 | 6d81475c | Iustin Pop | |
936 | c71a1a3d | Iustin Pop | In order to delete a set of tags, the DELETE request should be addressed |
937 | c71a1a3d | Iustin Pop | to URI like:: |
938 | 6d81475c | Iustin Pop | |
939 | c8e0a534 | Iustin Pop | /tags?tag=[tag]&tag=[tag] |
940 | 6d81475c | Iustin Pop | |
941 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
942 | 2cad4b91 | Iustin Pop | |
943 | 2cad4b91 | Iustin Pop | |
944 | c8e0a534 | Iustin Pop | ``/2/os`` |
945 | c8e0a534 | Iustin Pop | +++++++++ |
946 | 6d81475c | Iustin Pop | |
947 | c8e0a534 | Iustin Pop | OS resource. |
948 | 6d81475c | Iustin Pop | |
949 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``. |
950 | 6d81475c | Iustin Pop | |
951 | c8e0a534 | Iustin Pop | ``GET`` |
952 | c8e0a534 | Iustin Pop | ~~~~~~~ |
953 | 6d81475c | Iustin Pop | |
954 | c8e0a534 | Iustin Pop | Return a list of all OSes. |
955 | 6d81475c | Iustin Pop | |
956 | c8e0a534 | Iustin Pop | Can return error 500 in case of a problem. Since this is a costly |
957 | c71a1a3d | Iustin Pop | operation for Ganeti 2.0, it is not recommended to execute it too often. |
958 | 6d81475c | Iustin Pop | |
959 | c8e0a534 | Iustin Pop | Example:: |
960 | 6d81475c | Iustin Pop | |
961 | c8e0a534 | Iustin Pop | ["debian-etch"] |
962 | 6d81475c | Iustin Pop | |
963 | c8e0a534 | Iustin Pop | ``/2/tags`` |
964 | c8e0a534 | Iustin Pop | +++++++++++ |
965 | 6d81475c | Iustin Pop | |
966 | c8e0a534 | Iustin Pop | Manages cluster tags. |
967 | 6d81475c | Iustin Pop | |
968 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
969 | 6d81475c | Iustin Pop | |
970 | c8e0a534 | Iustin Pop | ``GET`` |
971 | c8e0a534 | Iustin Pop | ~~~~~~~ |
972 | 6d81475c | Iustin Pop | |
973 | c8e0a534 | Iustin Pop | Returns the cluster tags. |
974 | 6d81475c | Iustin Pop | |
975 | c8e0a534 | Iustin Pop | Example:: |
976 | 6d81475c | Iustin Pop | |
977 | c8e0a534 | Iustin Pop | ["tag1", "tag2", "tag3"] |
978 | 6d81475c | Iustin Pop | |
979 | c8e0a534 | Iustin Pop | ``PUT`` |
980 | c8e0a534 | Iustin Pop | ~~~~~~~ |
981 | 6d81475c | Iustin Pop | |
982 | c8e0a534 | Iustin Pop | Adds a set of tags. |
983 | 6d81475c | Iustin Pop | |
984 | c8e0a534 | Iustin Pop | The request as a list of strings should be PUT to this URI. The result |
985 | c8e0a534 | Iustin Pop | will be a job id. |
986 | 6d81475c | Iustin Pop | |
987 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
988 | 2cad4b91 | Iustin Pop | |
989 | 2cad4b91 | Iustin Pop | |
990 | c8e0a534 | Iustin Pop | ``DELETE`` |
991 | c8e0a534 | Iustin Pop | ~~~~~~~~~~ |
992 | 6d81475c | Iustin Pop | |
993 | c8e0a534 | Iustin Pop | Deletes tags. |
994 | 6d81475c | Iustin Pop | |
995 | c71a1a3d | Iustin Pop | In order to delete a set of tags, the DELETE request should be addressed |
996 | c71a1a3d | Iustin Pop | to URI like:: |
997 | 6d81475c | Iustin Pop | |
998 | c8e0a534 | Iustin Pop | /tags?tag=[tag]&tag=[tag] |
999 | 6d81475c | Iustin Pop | |
1000 | 2cad4b91 | Iustin Pop | It supports the ``dry-run`` argument. |
1001 | 2cad4b91 | Iustin Pop | |
1002 | 2cad4b91 | Iustin Pop | |
1003 | c8e0a534 | Iustin Pop | ``/version`` |
1004 | c8e0a534 | Iustin Pop | ++++++++++++ |
1005 | 6d81475c | Iustin Pop | |
1006 | c8e0a534 | Iustin Pop | The version resource. |
1007 | 6d81475c | Iustin Pop | |
1008 | c71a1a3d | Iustin Pop | This resource should be used to determine the remote API version and to |
1009 | c71a1a3d | Iustin Pop | adapt clients accordingly. |
1010 | 6d81475c | Iustin Pop | |
1011 | c8e0a534 | Iustin Pop | It supports the following commands: ``GET``. |
1012 | 6d81475c | Iustin Pop | |
1013 | c8e0a534 | Iustin Pop | ``GET`` |
1014 | c8e0a534 | Iustin Pop | ~~~~~~~ |
1015 | 6d81475c | Iustin Pop | |
1016 | c71a1a3d | Iustin Pop | Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0 |
1017 | c71a1a3d | Iustin Pop | returns ``2``. |
1018 | 558fd122 | Michael Hanselmann | |
1019 | 558fd122 | Michael Hanselmann | .. vim: set textwidth=72 : |
1020 | c71a1a3d | Iustin Pop | .. Local Variables: |
1021 | c71a1a3d | Iustin Pop | .. mode: rst |
1022 | c71a1a3d | Iustin Pop | .. fill-column: 72 |
1023 | c71a1a3d | Iustin Pop | .. End: |