Statistics
| Branch: | Tag: | Revision:

root / doc / rapi.rst @ d32f3b81

History | View | Annotate | Download (22.5 kB)

1
Ganeti remote API
2
=================
3

    
4
Documents Ganeti version |version|
5

    
6
.. contents::
7

    
8
Introduction
9
------------
10

    
11
Ganeti supports a remote API for enable external tools to easily
12
retrieve information about a cluster's state. The remote API daemon,
13
*ganeti-rapi*, is automatically started on the master node. By default
14
it runs on TCP port 5080, but this can be changed either in
15
``.../constants.py`` or via the command line parameter *-p*. SSL mode,
16
which is used by default, can also be disabled by passing command line
17
parameters.
18

    
19

    
20
Users and passwords
21
-------------------
22

    
23
``ganeti-rapi`` reads users and passwords from a file (usually
24
``/var/lib/ganeti/rapi_users``) on startup. After modifying the password
25
file, ``ganeti-rapi`` must be restarted.
26

    
27
Each line consists of two or three fields separated by whitespace. The
28
first two fields are for username and password. The third field is
29
optional and can be used to specify per-user options. Currently,
30
``write`` is the only option supported and enables the user to execute
31
operations modifying the cluster. Lines starting with the hash sign
32
(``#``) are treated as comments.
33

    
34
Passwords can either be written in clear text or as a hash. Clear text
35
passwords may not start with an opening brace (``{``) or they must be
36
prefixed with ``{cleartext}``. To use the hashed form, get the MD5 hash
37
of the string ``$username:Ganeti Remote API:$password`` (e.g. ``echo -n
38
'jack:Ganeti Remote API:abc123' | openssl md5``) [#pwhash]_ and prefix
39
it with ``{ha1}``. Using the scheme prefix for all passwords is
40
recommended. Scheme prefixes are not case sensitive.
41

    
42
Example::
43

    
44
  # Give Jack and Fred read-only access
45
  jack abc123
46
  fred {cleartext}foo555
47

    
48
  # Give write access to an imaginary instance creation script
49
  autocreator xyz789 write
50

    
51
  # Hashed password for Jessica
52
  jessica {HA1}7046452df2cbb530877058712cf17bd4 write
53

    
54

    
55
.. [#pwhash] Using the MD5 hash of username, realm and password is
56
   described in RFC2617_ ("HTTP Authentication"), sections 3.2.2.2 and
57
   3.3. The reason for using it over another algorithm is forward
58
   compatibility. If ``ganeti-rapi`` were to implement HTTP Digest
59
   authentication in the future, the same hash could be used.
60
   In the current version ``ganeti-rapi``'s realm, ``Ganeti Remote
61
   API``, can only be changed by modifying the source code.
62

    
63

    
64
Protocol
65
--------
66

    
67
The protocol used is JSON_ over HTTP designed after the REST_ principle.
68
HTTP Basic authentication as per RFC2617_ is supported.
69

    
70
.. _JSON: http://www.json.org/
71
.. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer
72
.. _RFC2617: http://tools.ietf.org/rfc/rfc2617.txt
73

    
74

    
75
PUT or POST?
76
------------
77

    
78
According to RFC2616 the main difference between PUT and POST is that
79
POST can create new resources but PUT can only create the resource the
80
URI was pointing to on the PUT request.
81

    
82
Unfortunately, due to historic reasons, the Ganeti RAPI library is not
83
consistent with this usage, so just use the methods as documented below
84
for each resource.
85

    
86
For more details have a look in the source code at
87
``lib/rapi/rlib2.py``.
88

    
89

    
90
Generic parameter types
91
-----------------------
92

    
93
A few generic refered parameter types and the values they allow.
94

    
95
``bool``
96
++++++++
97

    
98
A boolean option will accept ``1`` or ``0`` as numbers but not
99
i.e. ``True`` or ``False``.
100

    
101
Generic parameters
102
------------------
103

    
104
A few parameter mean the same thing across all resources which implement
105
it.
106

    
107
``bulk``
108
++++++++
109

    
110
Bulk-mode means that for the resources which usually return just a list
111
of child resources (e.g. ``/2/instances`` which returns just instance
112
names), the output will instead contain detailed data for all these
113
subresources. This is more efficient than query-ing the sub-resources
114
themselves.
115

    
116
``dry-run``
117
+++++++++++
118

    
119
The boolean *dry-run* argument, if provided and set, signals to Ganeti
120
that the job should not be executed, only the pre-execution checks will
121
be done.
122

    
123
This is useful in trying to determine (without guarantees though, as in
124
the meantime the cluster state could have changed) if the operation is
125
likely to succeed or at least start executing.
126

    
127
``force``
128
+++++++++++
129

    
130
Force operation to continue even if it will cause the cluster to become
131
inconsistent (e.g. because there are not enough master candidates).
132

    
133
Usage examples
134
--------------
135

    
136
You can access the API using your favorite programming language as long
137
as it supports network connections.
138

    
139
Ganeti RAPI client
140
++++++++++++++++++
141

    
142
Ganeti includes a standalone RAPI client, ``lib/rapi/client.py``.
143

    
144
Shell
145
+++++
146

    
147
.. highlight:: sh
148

    
149
Using wget::
150

    
151
   wget -q -O - https://CLUSTERNAME:5080/2/info
152

    
153
or curl::
154

    
155
  curl https://CLUSTERNAME:5080/2/info
156

    
157

    
158
Python
159
++++++
160

    
161
.. highlight:: python
162

    
163
::
164

    
165
  import urllib2
166
  f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info')
167
  print f.read()
168

    
169

    
170
JavaScript
171
++++++++++
172

    
173
.. warning:: While it's possible to use JavaScript, it poses several
174
   potential problems, including browser blocking request due to
175
   non-standard ports or different domain names. Fetching the data on
176
   the webserver is easier.
177

    
178
.. highlight:: javascript
179

    
180
::
181

    
182
  var url = 'https://CLUSTERNAME:5080/2/info';
183
  var info;
184
  var xmlreq = new XMLHttpRequest();
185
  xmlreq.onreadystatechange = function () {
186
    if (xmlreq.readyState != 4) return;
187
    if (xmlreq.status == 200) {
188
      info = eval("(" + xmlreq.responseText + ")");
189
      alert(info);
190
    } else {
191
      alert('Error fetching cluster info');
192
    }
193
    xmlreq = null;
194
  };
195
  xmlreq.open('GET', url, true);
196
  xmlreq.send(null);
197

    
198
Resources
199
---------
200

    
201
.. highlight:: javascript
202

    
203
``/``
204
+++++
205

    
206
The root resource.
207

    
208
It supports the following commands: ``GET``.
209

    
210
``GET``
211
~~~~~~~
212

    
213
Shows the list of mapped resources.
214

    
215
Returns: a dictionary with 'name' and 'uri' keys for each of them.
216

    
217
``/2``
218
++++++
219

    
220
The ``/2`` resource, the root of the version 2 API.
221

    
222
It supports the following commands: ``GET``.
223

    
224
``GET``
225
~~~~~~~
226

    
227
Show the list of mapped resources.
228

    
229
Returns: a dictionary with ``name`` and ``uri`` keys for each of them.
230

    
231
``/2/info``
232
+++++++++++
233

    
234
Cluster information resource.
235

    
236
It supports the following commands: ``GET``.
237

    
238
``GET``
239
~~~~~~~
240

    
241
Returns cluster information.
242

    
243
Example::
244

    
245
  {
246
    "config_version": 2000000,
247
    "name": "cluster",
248
    "software_version": "2.0.0~beta2",
249
    "os_api_version": 10,
250
    "export_version": 0,
251
    "candidate_pool_size": 10,
252
    "enabled_hypervisors": [
253
      "fake"
254
    ],
255
    "hvparams": {
256
      "fake": {}
257
     },
258
    "default_hypervisor": "fake",
259
    "master": "node1.example.com",
260
    "architecture": [
261
      "64bit",
262
      "x86_64"
263
    ],
264
    "protocol_version": 20,
265
    "beparams": {
266
      "default": {
267
        "auto_balance": true,
268
        "vcpus": 1,
269
        "memory": 128
270
       }
271
      }
272
    }
273

    
274

    
275
``/2/redistribute-config``
276
++++++++++++++++++++++++++
277

    
278
Redistribute configuration to all nodes.
279

    
280
It supports the following commands: ``PUT``.
281

    
282
``PUT``
283
~~~~~~~
284

    
285
Redistribute configuration to all nodes. The result will be a job id.
286

    
287

    
288
``/2/features``
289
+++++++++++++++
290

    
291
``GET``
292
~~~~~~~
293

    
294
Returns a list of features supported by the RAPI server. Available
295
features:
296

    
297
``instance-create-reqv1``
298
  Instance creation request data version 1 supported.
299

    
300

    
301
``/2/instances``
302
++++++++++++++++
303

    
304
The instances resource.
305

    
306
It supports the following commands: ``GET``, ``POST``.
307

    
308
``GET``
309
~~~~~~~
310

    
311
Returns a list of all available instances.
312

    
313
Example::
314

    
315
    [
316
      {
317
        "name": "web.example.com",
318
        "uri": "\/instances\/web.example.com"
319
      },
320
      {
321
        "name": "mail.example.com",
322
        "uri": "\/instances\/mail.example.com"
323
      }
324
    ]
325

    
326
If the optional bool *bulk* argument is provided and set to a true value
327
(i.e ``?bulk=1``), the output contains detailed information about
328
instances as a list.
329

    
330
Example::
331

    
332
    [
333
      {
334
         "status": "running",
335
         "disk_usage": 20480,
336
         "nic.bridges": [
337
           "xen-br0"
338
          ],
339
         "name": "web.example.com",
340
         "tags": ["tag1", "tag2"],
341
         "beparams": {
342
           "vcpus": 2,
343
           "memory": 512
344
         },
345
         "disk.sizes": [
346
             20480
347
         ],
348
         "pnode": "node1.example.com",
349
         "nic.macs": ["01:23:45:67:89:01"],
350
         "snodes": ["node2.example.com"],
351
         "disk_template": "drbd",
352
         "admin_state": true,
353
         "os": "debian-etch",
354
         "oper_state": true
355
      },
356
      ...
357
    ]
358

    
359

    
360
``POST``
361
~~~~~~~~
362

    
363
Creates an instance.
364

    
365
If the optional bool *dry-run* argument is provided, the job will not be
366
actually executed, only the pre-execution checks will be done. Query-ing
367
the job result will return, in both dry-run and normal case, the list of
368
nodes selected for the instance.
369

    
370
Returns: a job ID that can be used later for polling.
371

    
372
Body parameters:
373

    
374
``__version__`` (int, required)
375
  Must be ``1`` (older Ganeti versions used a different format for
376
  instance creation requests, version ``0``, but that format is not
377
  documented).
378
``mode``
379
  Instance creation mode (string, required).
380
``name`` (string, required)
381
  Instance name
382
``disk_template`` (string, required)
383
  Disk template for instance
384
``disks`` (list, required)
385
  List of disk definitions. Example: ``[{"size": 100}, {"size": 5}]``.
386
  Each disk definition must contain a ``size`` value and can contain an
387
  optional ``mode`` value denoting the disk access mode (``ro`` or
388
  ``rw``).
389
``nics`` (list, required)
390
  List of NIC (network interface) definitions. Example: ``[{}, {},
391
  {"ip": "1.2.3.4"}]``. Each NIC definition can contain the optional
392
  values ``ip``, ``mode``, ``link`` and ``bridge``.
393
``os`` (string)
394
  Instance operating system.
395
``force_variant`` (bool)
396
  Whether to force an unknown variant.
397
``pnode`` (string)
398
  Primary node.
399
``snode`` (string)
400
  Secondary node.
401
``src_node`` (string)
402
  Source node for import.
403
``src_path`` (string)
404
  Source directory for import.
405
``start`` (bool)
406
  Whether to start instance after creation.
407
``ip_check`` (bool)
408
  Whether to ensure instance's IP address is inactive.
409
``name_check`` (bool)
410
  Whether to ensure instance's name is resolvable.
411
``file_storage_dir`` (string)
412
  File storage directory.
413
``file_driver`` (string)
414
  File storage driver.
415
``iallocator`` (string)
416
  Instance allocator name.
417
``hypervisor`` (string)
418
  Hypervisor name.
419
``hvparams`` (dict)
420
  Hypervisor parameters, hypervisor-dependent.
421
``beparams``
422
  Backend parameters.
423

    
424

    
425
``/2/instances/[instance_name]``
426
++++++++++++++++++++++++++++++++
427

    
428
Instance-specific resource.
429

    
430
It supports the following commands: ``GET``, ``DELETE``.
431

    
432
``GET``
433
~~~~~~~
434

    
435
Returns information about an instance, similar to the bulk output from
436
the instance list.
437

    
438
``DELETE``
439
~~~~~~~~~~
440

    
441
Deletes an instance.
442

    
443
It supports the ``dry-run`` argument.
444

    
445

    
446
``/2/instances/[instance_name]/info``
447
+++++++++++++++++++++++++++++++++++++++
448

    
449
It supports the following commands: ``GET``.
450

    
451
``GET``
452
~~~~~~~
453

    
454
Requests detailed information about the instance. An optional parameter,
455
``static`` (bool), can be set to return only static information from the
456
configuration without querying the instance's nodes. The result will be
457
a job id.
458

    
459

    
460
``/2/instances/[instance_name]/reboot``
461
+++++++++++++++++++++++++++++++++++++++
462

    
463
Reboots URI for an instance.
464

    
465
It supports the following commands: ``POST``.
466

    
467
``POST``
468
~~~~~~~~
469

    
470
Reboots the instance.
471

    
472
The URI takes optional ``type=soft|hard|full`` and
473
``ignore_secondaries=0|1`` parameters.
474

    
475
``type`` defines the reboot type. ``soft`` is just a normal reboot,
476
without terminating the hypervisor. ``hard`` means full shutdown
477
(including terminating the hypervisor process) and startup again.
478
``full`` is like ``hard`` but also recreates the configuration from
479
ground up as if you would have done a ``gnt-instance shutdown`` and
480
``gnt-instance start`` on it.
481

    
482
``ignore_secondaries`` is a bool argument indicating if we start the
483
instance even if secondary disks are failing.
484

    
485
It supports the ``dry-run`` argument.
486

    
487

    
488
``/2/instances/[instance_name]/shutdown``
489
+++++++++++++++++++++++++++++++++++++++++
490

    
491
Instance shutdown URI.
492

    
493
It supports the following commands: ``PUT``.
494

    
495
``PUT``
496
~~~~~~~
497

    
498
Shutdowns an instance.
499

    
500
It supports the ``dry-run`` argument.
501

    
502

    
503
``/2/instances/[instance_name]/startup``
504
++++++++++++++++++++++++++++++++++++++++
505

    
506
Instance startup URI.
507

    
508
It supports the following commands: ``PUT``.
509

    
510
``PUT``
511
~~~~~~~
512

    
513
Startup an instance.
514

    
515
The URI takes an optional ``force=1|0`` parameter to start the
516
instance even if secondary disks are failing.
517

    
518
It supports the ``dry-run`` argument.
519

    
520
``/2/instances/[instance_name]/reinstall``
521
++++++++++++++++++++++++++++++++++++++++++++++
522

    
523
Installs the operating system again.
524

    
525
It supports the following commands: ``POST``.
526

    
527
``POST``
528
~~~~~~~~
529

    
530
Takes the parameters ``os`` (OS template name) and ``nostartup`` (bool).
531

    
532

    
533
``/2/instances/[instance_name]/replace-disks``
534
++++++++++++++++++++++++++++++++++++++++++++++
535

    
536
Replaces disks on an instance.
537

    
538
It supports the following commands: ``POST``.
539

    
540
``POST``
541
~~~~~~~~
542

    
543
Takes the parameters ``mode`` (one of ``replace_on_primary``,
544
``replace_on_secondary``, ``replace_new_secondary`` or
545
``replace_auto``), ``disks`` (comma separated list of disk indexes),
546
``remote_node`` and ``iallocator``.
547

    
548
Either ``remote_node`` or ``iallocator`` needs to be defined when using
549
``mode=replace_new_secondary``.
550

    
551
``mode`` is a mandatory parameter. ``replace_auto`` tries to determine
552
the broken disk(s) on its own and replacing it.
553

    
554

    
555
``/2/instances/[instance_name]/activate-disks``
556
+++++++++++++++++++++++++++++++++++++++++++++++
557

    
558
Activate disks on an instance.
559

    
560
It supports the following commands: ``PUT``.
561

    
562
``PUT``
563
~~~~~~~
564

    
565
Takes the bool parameter ``ignore_size``. When set ignore the recorded
566
size (useful for forcing activation when recorded size is wrong).
567

    
568

    
569
``/2/instances/[instance_name]/deactivate-disks``
570
+++++++++++++++++++++++++++++++++++++++++++++++++
571

    
572
Deactivate disks on an instance.
573

    
574
It supports the following commands: ``PUT``.
575

    
576
``PUT``
577
~~~~~~~
578

    
579
Takes no parameters.
580

    
581

    
582
``/2/instances/[instance_name]/tags``
583
+++++++++++++++++++++++++++++++++++++
584

    
585
Manages per-instance tags.
586

    
587
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
588

    
589
``GET``
590
~~~~~~~
591

    
592
Returns a list of tags.
593

    
594
Example::
595

    
596
    ["tag1", "tag2", "tag3"]
597

    
598
``PUT``
599
~~~~~~~
600

    
601
Add a set of tags.
602

    
603
The request as a list of strings should be ``PUT`` to this URI. The
604
result will be a job id.
605

    
606
It supports the ``dry-run`` argument.
607

    
608

    
609
``DELETE``
610
~~~~~~~~~~
611

    
612
Delete a tag.
613

    
614
In order to delete a set of tags, the DELETE request should be addressed
615
to URI like::
616

    
617
    /tags?tag=[tag]&tag=[tag]
618

    
619
It supports the ``dry-run`` argument.
620

    
621

    
622
``/2/jobs``
623
+++++++++++
624

    
625
The ``/2/jobs`` resource.
626

    
627
It supports the following commands: ``GET``.
628

    
629
``GET``
630
~~~~~~~
631

    
632
Returns a dictionary of jobs.
633

    
634
Returns: a dictionary with jobs id and uri.
635

    
636
``/2/jobs/[job_id]``
637
++++++++++++++++++++
638

    
639

    
640
Individual job URI.
641

    
642
It supports the following commands: ``GET``, ``DELETE``.
643

    
644
``GET``
645
~~~~~~~
646

    
647
Returns a job status.
648

    
649
Returns: a dictionary with job parameters.
650

    
651
The result includes:
652

    
653
- id: job ID as a number
654
- status: current job status as a string
655
- ops: involved OpCodes as a list of dictionaries for each opcodes in
656
  the job
657
- opstatus: OpCodes status as a list
658
- opresult: OpCodes results as a list
659

    
660
For a successful opcode, the ``opresult`` field corresponding to it will
661
contain the raw result from its :term:`LogicalUnit`. In case an opcode
662
has failed, its element in the opresult list will be a list of two
663
elements:
664

    
665
- first element the error type (the Ganeti internal error name)
666
- second element a list of either one or two elements:
667

    
668
  - the first element is the textual error description
669
  - the second element, if any, will hold an error classification
670

    
671
The error classification is most useful for the ``OpPrereqError``
672
error type - these errors happen before the OpCode has started
673
executing, so it's possible to retry the OpCode without side
674
effects. But whether it make sense to retry depends on the error
675
classification:
676

    
677
``resolver_error``
678
  Resolver errors. This usually means that a name doesn't exist in DNS,
679
  so if it's a case of slow DNS propagation the operation can be retried
680
  later.
681

    
682
``insufficient_resources``
683
  Not enough resources (iallocator failure, disk space, memory,
684
  etc.). If the resources on the cluster increase, the operation might
685
  succeed.
686

    
687
``wrong_input``
688
  Wrong arguments (at syntax level). The operation will not ever be
689
  accepted unless the arguments change.
690

    
691
``wrong_state``
692
  Wrong entity state. For example, live migration has been requested for
693
  a down instance, or instance creation on an offline node. The
694
  operation can be retried once the resource has changed state.
695

    
696
``unknown_entity``
697
  Entity not found. For example, information has been requested for an
698
  unknown instance.
699

    
700
``already_exists``
701
  Entity already exists. For example, instance creation has been
702
  requested for an already-existing instance.
703

    
704
``resource_not_unique``
705
  Resource not unique (e.g. MAC or IP duplication).
706

    
707
``internal_error``
708
  Internal cluster error. For example, a node is unreachable but not set
709
  offline, or the ganeti node daemons are not working, etc. A
710
  ``gnt-cluster verify`` should be run.
711

    
712
``environment_error``
713
  Environment error (e.g. node disk error). A ``gnt-cluster verify``
714
  should be run.
715

    
716
Note that in the above list, by entity we refer to a node or instance,
717
while by a resource we refer to an instance's disk, or NIC, etc.
718

    
719

    
720
``DELETE``
721
~~~~~~~~~~
722

    
723
Cancel a not-yet-started job.
724

    
725

    
726
``/2/jobs/[job_id]/wait``
727
+++++++++++++++++++++++++
728

    
729
``GET``
730
~~~~~~~
731

    
732
Waits for changes on a job. Takes the following body parameters in a
733
dict:
734

    
735
``fields``
736
  The job fields on which to watch for changes.
737

    
738
``previous_job_info``
739
  Previously received field values or None if not yet available.
740

    
741
``previous_log_serial``
742
  Highest log serial number received so far or None if not yet
743
  available.
744

    
745
Returns None if no changes have been detected and a dict with two keys,
746
``job_info`` and ``log_entries`` otherwise.
747

    
748

    
749
``/2/nodes``
750
++++++++++++
751

    
752
Nodes resource.
753

    
754
It supports the following commands: ``GET``.
755

    
756
``GET``
757
~~~~~~~
758

    
759
Returns a list of all nodes.
760

    
761
Example::
762

    
763
    [
764
      {
765
        "id": "node1.example.com",
766
        "uri": "\/nodes\/node1.example.com"
767
      },
768
      {
769
        "id": "node2.example.com",
770
        "uri": "\/nodes\/node2.example.com"
771
      }
772
    ]
773

    
774
If the optional 'bulk' argument is provided and set to 'true' value (i.e
775
'?bulk=1'), the output contains detailed information about nodes as a
776
list.
777

    
778
Example::
779

    
780
    [
781
      {
782
        "pinst_cnt": 1,
783
        "mfree": 31280,
784
        "mtotal": 32763,
785
        "name": "www.example.com",
786
        "tags": [],
787
        "mnode": 512,
788
        "dtotal": 5246208,
789
        "sinst_cnt": 2,
790
        "dfree": 5171712,
791
        "offline": false
792
      },
793
      ...
794
    ]
795

    
796
``/2/nodes/[node_name]``
797
+++++++++++++++++++++++++++++++++
798

    
799
Returns information about a node.
800

    
801
It supports the following commands: ``GET``.
802

    
803
``/2/nodes/[node_name]/evacuate``
804
+++++++++++++++++++++++++++++++++
805

    
806
Evacuates all secondary instances off a node.
807

    
808
It supports the following commands: ``POST``.
809

    
810
``POST``
811
~~~~~~~~
812

    
813
To evacuate a node, either one of the ``iallocator`` or ``remote_node``
814
parameters must be passed::
815

    
816
    evacuate?iallocator=[iallocator]
817
    evacuate?remote_node=[nodeX.example.com]
818

    
819
``/2/nodes/[node_name]/migrate``
820
+++++++++++++++++++++++++++++++++
821

    
822
Migrates all primary instances from a node.
823

    
824
It supports the following commands: ``POST``.
825

    
826
``POST``
827
~~~~~~~~
828

    
829
No parameters are required, but the bool parameter ``live`` can be set
830
to use live migration (if available).
831

    
832
    migrate?live=[0|1]
833

    
834
``/2/nodes/[node_name]/role``
835
+++++++++++++++++++++++++++++
836

    
837
Manages node role.
838

    
839
It supports the following commands: ``GET``, ``PUT``.
840

    
841
The role is always one of the following:
842

    
843
  - drained
844
  - master
845
  - master-candidate
846
  - offline
847
  - regular
848

    
849
``GET``
850
~~~~~~~
851

    
852
Returns the current node role.
853

    
854
Example::
855

    
856
    "master-candidate"
857

    
858
``PUT``
859
~~~~~~~
860

    
861
Change the node role.
862

    
863
The request is a string which should be PUT to this URI. The result will
864
be a job id.
865

    
866
It supports the bool ``force`` argument.
867

    
868
``/2/nodes/[node_name]/storage``
869
++++++++++++++++++++++++++++++++
870

    
871
Manages storage units on the node.
872

    
873
``GET``
874
~~~~~~~
875

    
876
Requests a list of storage units on a node. Requires the parameters
877
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and
878
``output_fields``. The result will be a job id, using which the result
879
can be retrieved.
880

    
881
``/2/nodes/[node_name]/storage/modify``
882
+++++++++++++++++++++++++++++++++++++++
883

    
884
Modifies storage units on the node.
885

    
886
``PUT``
887
~~~~~~~
888

    
889
Modifies parameters of storage units on the node. Requires the
890
parameters ``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``)
891
and ``name`` (name of the storage unit).  Parameters can be passed
892
additionally. Currently only ``allocatable`` (bool) is supported. The
893
result will be a job id.
894

    
895
``/2/nodes/[node_name]/storage/repair``
896
+++++++++++++++++++++++++++++++++++++++
897

    
898
Repairs a storage unit on the node.
899

    
900
``PUT``
901
~~~~~~~
902

    
903
Repairs a storage unit on the node. Requires the parameters
904
``storage_type`` (currently only ``lvm-vg`` can be repaired) and
905
``name`` (name of the storage unit). The result will be a job id.
906

    
907
``/2/nodes/[node_name]/tags``
908
+++++++++++++++++++++++++++++
909

    
910
Manages per-node tags.
911

    
912
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
913

    
914
``GET``
915
~~~~~~~
916

    
917
Returns a list of tags.
918

    
919
Example::
920

    
921
    ["tag1", "tag2", "tag3"]
922

    
923
``PUT``
924
~~~~~~~
925

    
926
Add a set of tags.
927

    
928
The request as a list of strings should be PUT to this URI. The result
929
will be a job id.
930

    
931
It supports the ``dry-run`` argument.
932

    
933
``DELETE``
934
~~~~~~~~~~
935

    
936
Deletes tags.
937

    
938
In order to delete a set of tags, the DELETE request should be addressed
939
to URI like::
940

    
941
    /tags?tag=[tag]&tag=[tag]
942

    
943
It supports the ``dry-run`` argument.
944

    
945

    
946
``/2/os``
947
+++++++++
948

    
949
OS resource.
950

    
951
It supports the following commands: ``GET``.
952

    
953
``GET``
954
~~~~~~~
955

    
956
Return a list of all OSes.
957

    
958
Can return error 500 in case of a problem. Since this is a costly
959
operation for Ganeti 2.0, it is not recommended to execute it too often.
960

    
961
Example::
962

    
963
    ["debian-etch"]
964

    
965
``/2/tags``
966
+++++++++++
967

    
968
Manages cluster tags.
969

    
970
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
971

    
972
``GET``
973
~~~~~~~
974

    
975
Returns the cluster tags.
976

    
977
Example::
978

    
979
    ["tag1", "tag2", "tag3"]
980

    
981
``PUT``
982
~~~~~~~
983

    
984
Adds a set of tags.
985

    
986
The request as a list of strings should be PUT to this URI. The result
987
will be a job id.
988

    
989
It supports the ``dry-run`` argument.
990

    
991

    
992
``DELETE``
993
~~~~~~~~~~
994

    
995
Deletes tags.
996

    
997
In order to delete a set of tags, the DELETE request should be addressed
998
to URI like::
999

    
1000
    /tags?tag=[tag]&tag=[tag]
1001

    
1002
It supports the ``dry-run`` argument.
1003

    
1004

    
1005
``/version``
1006
++++++++++++
1007

    
1008
The version resource.
1009

    
1010
This resource should be used to determine the remote API version and to
1011
adapt clients accordingly.
1012

    
1013
It supports the following commands: ``GET``.
1014

    
1015
``GET``
1016
~~~~~~~
1017

    
1018
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0
1019
returns ``2``.
1020

    
1021
.. vim: set textwidth=72 :
1022
.. Local Variables:
1023
.. mode: rst
1024
.. fill-column: 72
1025
.. End: