Statistics
| Branch: | Tag: | Revision:

root / doc / rapi.rst @ 7eac4a4d

History | View | Annotate | Download (20.8 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
Shell
140
+++++
141

    
142
.. highlight:: sh
143

    
144
Using wget::
145

    
146
   wget -q -O - https://CLUSTERNAME:5080/2/info
147

    
148
or curl::
149

    
150
  curl https://CLUSTERNAME:5080/2/info
151

    
152

    
153
Python
154
++++++
155

    
156
.. highlight:: python
157

    
158
::
159

    
160
  import urllib2
161
  f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info')
162
  print f.read()
163

    
164

    
165
JavaScript
166
++++++++++
167

    
168
.. warning:: While it's possible to use JavaScript, it poses several
169
   potential problems, including browser blocking request due to
170
   non-standard ports or different domain names. Fetching the data on
171
   the webserver is easier.
172

    
173
.. highlight:: javascript
174

    
175
::
176

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

    
193
Resources
194
---------
195

    
196
.. highlight:: javascript
197

    
198
``/``
199
+++++
200

    
201
The root resource.
202

    
203
It supports the following commands: ``GET``.
204

    
205
``GET``
206
~~~~~~~
207

    
208
Shows the list of mapped resources.
209

    
210
Returns: a dictionary with 'name' and 'uri' keys for each of them.
211

    
212
``/2``
213
++++++
214

    
215
The ``/2`` resource, the root of the version 2 API.
216

    
217
It supports the following commands: ``GET``.
218

    
219
``GET``
220
~~~~~~~
221

    
222
Show the list of mapped resources.
223

    
224
Returns: a dictionary with ``name`` and ``uri`` keys for each of them.
225

    
226
``/2/info``
227
+++++++++++
228

    
229
Cluster information resource.
230

    
231
It supports the following commands: ``GET``.
232

    
233
``GET``
234
~~~~~~~
235

    
236
Returns cluster information.
237

    
238
Example::
239

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

    
269

    
270
``/2/redistribute-config``
271
++++++++++++++++++++++++++
272

    
273
Redistribute configuration to all nodes.
274

    
275
It supports the following commands: ``PUT``.
276

    
277
``PUT``
278
~~~~~~~
279

    
280
Redistribute configuration to all nodes. The result will be a job id.
281

    
282

    
283
``/2/features``
284
+++++++++++++++
285

    
286
``GET``
287
~~~~~~~
288

    
289
Returns a list of features supported by the RAPI server. Available
290
features:
291

    
292
``instance-create-reqv1``
293
  Instance creation request data version 1 supported.
294

    
295

    
296
``/2/instances``
297
++++++++++++++++
298

    
299
The instances resource.
300

    
301
It supports the following commands: ``GET``, ``POST``.
302

    
303
``GET``
304
~~~~~~~
305

    
306
Returns a list of all available instances.
307

    
308
Example::
309

    
310
    [
311
      {
312
        "name": "web.example.com",
313
        "uri": "\/instances\/web.example.com"
314
      },
315
      {
316
        "name": "mail.example.com",
317
        "uri": "\/instances\/mail.example.com"
318
      }
319
    ]
320

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

    
325
Example::
326

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

    
354

    
355
``POST``
356
~~~~~~~~
357

    
358
Creates an instance.
359

    
360
If the optional bool *dry-run* argument is provided, the job will not be
361
actually executed, only the pre-execution checks will be done. Query-ing
362
the job result will return, in both dry-run and normal case, the list of
363
nodes selected for the instance.
364

    
365
Returns: a job ID that can be used later for polling.
366

    
367
``/2/instances/[instance_name]``
368
++++++++++++++++++++++++++++++++
369

    
370
Instance-specific resource.
371

    
372
It supports the following commands: ``GET``, ``DELETE``.
373

    
374
``GET``
375
~~~~~~~
376

    
377
Returns information about an instance, similar to the bulk output from
378
the instance list.
379

    
380
``DELETE``
381
~~~~~~~~~~
382

    
383
Deletes an instance.
384

    
385
It supports the ``dry-run`` argument.
386

    
387

    
388
``/2/instances/[instance_name]/info``
389
+++++++++++++++++++++++++++++++++++++++
390

    
391
It supports the following commands: ``GET``.
392

    
393
``GET``
394
~~~~~~~
395

    
396
Requests detailed information about the instance. An optional parameter,
397
``static`` (bool), can be set to return only static information from the
398
configuration without querying the instance's nodes. The result will be
399
a job id.
400

    
401

    
402
``/2/instances/[instance_name]/reboot``
403
+++++++++++++++++++++++++++++++++++++++
404

    
405
Reboots URI for an instance.
406

    
407
It supports the following commands: ``POST``.
408

    
409
``POST``
410
~~~~~~~~
411

    
412
Reboots the instance.
413

    
414
The URI takes optional ``type=soft|hard|full`` and
415
``ignore_secondaries=0|1`` parameters.
416

    
417
``type`` defines the reboot type. ``soft`` is just a normal reboot,
418
without terminating the hypervisor. ``hard`` means full shutdown
419
(including terminating the hypervisor process) and startup again.
420
``full`` is like ``hard`` but also recreates the configuration from
421
ground up as if you would have done a ``gnt-instance shutdown`` and
422
``gnt-instance start`` on it.
423

    
424
``ignore_secondaries`` is a bool argument indicating if we start the
425
instance even if secondary disks are failing.
426

    
427
It supports the ``dry-run`` argument.
428

    
429

    
430
``/2/instances/[instance_name]/shutdown``
431
+++++++++++++++++++++++++++++++++++++++++
432

    
433
Instance shutdown URI.
434

    
435
It supports the following commands: ``PUT``.
436

    
437
``PUT``
438
~~~~~~~
439

    
440
Shutdowns an instance.
441

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

    
444

    
445
``/2/instances/[instance_name]/startup``
446
++++++++++++++++++++++++++++++++++++++++
447

    
448
Instance startup URI.
449

    
450
It supports the following commands: ``PUT``.
451

    
452
``PUT``
453
~~~~~~~
454

    
455
Startup an instance.
456

    
457
The URI takes an optional ``force=1|0`` parameter to start the
458
instance even if secondary disks are failing.
459

    
460
It supports the ``dry-run`` argument.
461

    
462
``/2/instances/[instance_name]/reinstall``
463
++++++++++++++++++++++++++++++++++++++++++++++
464

    
465
Installs the operating system again.
466

    
467
It supports the following commands: ``POST``.
468

    
469
``POST``
470
~~~~~~~~
471

    
472
Takes the parameters ``os`` (OS template name) and ``nostartup`` (bool).
473

    
474

    
475
``/2/instances/[instance_name]/replace-disks``
476
++++++++++++++++++++++++++++++++++++++++++++++
477

    
478
Replaces disks on an instance.
479

    
480
It supports the following commands: ``POST``.
481

    
482
``POST``
483
~~~~~~~~
484

    
485
Takes the parameters ``mode`` (one of ``replace_on_primary``,
486
``replace_on_secondary``, ``replace_new_secondary`` or
487
``replace_auto``), ``disks`` (comma separated list of disk indexes),
488
``remote_node`` and ``iallocator``.
489

    
490
Either ``remote_node`` or ``iallocator`` needs to be defined when using
491
``mode=replace_new_secondary``.
492

    
493
``mode`` is a mandatory parameter. ``replace_auto`` tries to determine
494
the broken disk(s) on its own and replacing it.
495

    
496

    
497
``/2/instances/[instance_name]/activate-disks``
498
+++++++++++++++++++++++++++++++++++++++++++++++
499

    
500
Activate disks on an instance.
501

    
502
It supports the following commands: ``PUT``.
503

    
504
``PUT``
505
~~~~~~~
506

    
507
Takes the bool parameter ``ignore_size``. When set ignore the recorded
508
size (useful for forcing activation when recorded size is wrong).
509

    
510

    
511
``/2/instances/[instance_name]/deactivate-disks``
512
+++++++++++++++++++++++++++++++++++++++++++++++++
513

    
514
Deactivate disks on an instance.
515

    
516
It supports the following commands: ``PUT``.
517

    
518
``PUT``
519
~~~~~~~
520

    
521
Takes no parameters.
522

    
523

    
524
``/2/instances/[instance_name]/tags``
525
+++++++++++++++++++++++++++++++++++++
526

    
527
Manages per-instance tags.
528

    
529
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
530

    
531
``GET``
532
~~~~~~~
533

    
534
Returns a list of tags.
535

    
536
Example::
537

    
538
    ["tag1", "tag2", "tag3"]
539

    
540
``PUT``
541
~~~~~~~
542

    
543
Add a set of tags.
544

    
545
The request as a list of strings should be ``PUT`` to this URI. The
546
result will be a job id.
547

    
548
It supports the ``dry-run`` argument.
549

    
550

    
551
``DELETE``
552
~~~~~~~~~~
553

    
554
Delete a tag.
555

    
556
In order to delete a set of tags, the DELETE request should be addressed
557
to URI like::
558

    
559
    /tags?tag=[tag]&tag=[tag]
560

    
561
It supports the ``dry-run`` argument.
562

    
563

    
564
``/2/jobs``
565
+++++++++++
566

    
567
The ``/2/jobs`` resource.
568

    
569
It supports the following commands: ``GET``.
570

    
571
``GET``
572
~~~~~~~
573

    
574
Returns a dictionary of jobs.
575

    
576
Returns: a dictionary with jobs id and uri.
577

    
578
``/2/jobs/[job_id]``
579
++++++++++++++++++++
580

    
581

    
582
Individual job URI.
583

    
584
It supports the following commands: ``GET``, ``DELETE``.
585

    
586
``GET``
587
~~~~~~~
588

    
589
Returns a job status.
590

    
591
Returns: a dictionary with job parameters.
592

    
593
The result includes:
594

    
595
- id: job ID as a number
596
- status: current job status as a string
597
- ops: involved OpCodes as a list of dictionaries for each opcodes in
598
  the job
599
- opstatus: OpCodes status as a list
600
- opresult: OpCodes results as a list
601

    
602
For a successful opcode, the ``opresult`` field corresponding to it will
603
contain the raw result from its :term:`LogicalUnit`. In case an opcode
604
has failed, its element in the opresult list will be a list of two
605
elements:
606

    
607
- first element the error type (the Ganeti internal error name)
608
- second element a list of either one or two elements:
609

    
610
  - the first element is the textual error description
611
  - the second element, if any, will hold an error classification
612

    
613
The error classification is most useful for the ``OpPrereqError``
614
error type - these errors happen before the OpCode has started
615
executing, so it's possible to retry the OpCode without side
616
effects. But whether it make sense to retry depends on the error
617
classification:
618

    
619
``resolver_error``
620
  Resolver errors. This usually means that a name doesn't exist in DNS,
621
  so if it's a case of slow DNS propagation the operation can be retried
622
  later.
623

    
624
``insufficient_resources``
625
  Not enough resources (iallocator failure, disk space, memory,
626
  etc.). If the resources on the cluster increase, the operation might
627
  succeed.
628

    
629
``wrong_input``
630
  Wrong arguments (at syntax level). The operation will not ever be
631
  accepted unless the arguments change.
632

    
633
``wrong_state``
634
  Wrong entity state. For example, live migration has been requested for
635
  a down instance, or instance creation on an offline node. The
636
  operation can be retried once the resource has changed state.
637

    
638
``unknown_entity``
639
  Entity not found. For example, information has been requested for an
640
  unknown instance.
641

    
642
``already_exists``
643
  Entity already exists. For example, instance creation has been
644
  requested for an already-existing instance.
645

    
646
``resource_not_unique``
647
  Resource not unique (e.g. MAC or IP duplication).
648

    
649
``internal_error``
650
  Internal cluster error. For example, a node is unreachable but not set
651
  offline, or the ganeti node daemons are not working, etc. A
652
  ``gnt-cluster verify`` should be run.
653

    
654
``environment_error``
655
  Environment error (e.g. node disk error). A ``gnt-cluster verify``
656
  should be run.
657

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

    
661

    
662
``DELETE``
663
~~~~~~~~~~
664

    
665
Cancel a not-yet-started job.
666

    
667

    
668
``/2/jobs/[job_id]/wait``
669
+++++++++++++++++++++++++
670

    
671
``GET``
672
~~~~~~~
673

    
674
Waits for changes on a job. Takes the following body parameters in a
675
dict:
676

    
677
``fields``
678
  The job fields on which to watch for changes.
679

    
680
``previous_job_info``
681
  Previously received field values or None if not yet available.
682

    
683
``previous_log_serial``
684
  Highest log serial number received so far or None if not yet
685
  available.
686

    
687
Returns None if no changes have been detected and a dict with two keys,
688
``job_info`` and ``log_entries`` otherwise.
689

    
690

    
691
``/2/nodes``
692
++++++++++++
693

    
694
Nodes resource.
695

    
696
It supports the following commands: ``GET``.
697

    
698
``GET``
699
~~~~~~~
700

    
701
Returns a list of all nodes.
702

    
703
Example::
704

    
705
    [
706
      {
707
        "id": "node1.example.com",
708
        "uri": "\/nodes\/node1.example.com"
709
      },
710
      {
711
        "id": "node2.example.com",
712
        "uri": "\/nodes\/node2.example.com"
713
      }
714
    ]
715

    
716
If the optional 'bulk' argument is provided and set to 'true' value (i.e
717
'?bulk=1'), the output contains detailed information about nodes as a
718
list.
719

    
720
Example::
721

    
722
    [
723
      {
724
        "pinst_cnt": 1,
725
        "mfree": 31280,
726
        "mtotal": 32763,
727
        "name": "www.example.com",
728
        "tags": [],
729
        "mnode": 512,
730
        "dtotal": 5246208,
731
        "sinst_cnt": 2,
732
        "dfree": 5171712,
733
        "offline": false
734
      },
735
      ...
736
    ]
737

    
738
``/2/nodes/[node_name]``
739
+++++++++++++++++++++++++++++++++
740

    
741
Returns information about a node.
742

    
743
It supports the following commands: ``GET``.
744

    
745
``/2/nodes/[node_name]/evacuate``
746
+++++++++++++++++++++++++++++++++
747

    
748
Evacuates all secondary instances off a node.
749

    
750
It supports the following commands: ``POST``.
751

    
752
``POST``
753
~~~~~~~~
754

    
755
To evacuate a node, either one of the ``iallocator`` or ``remote_node``
756
parameters must be passed::
757

    
758
    evacuate?iallocator=[iallocator]
759
    evacuate?remote_node=[nodeX.example.com]
760

    
761
``/2/nodes/[node_name]/migrate``
762
+++++++++++++++++++++++++++++++++
763

    
764
Migrates all primary instances from a node.
765

    
766
It supports the following commands: ``POST``.
767

    
768
``POST``
769
~~~~~~~~
770

    
771
No parameters are required, but the bool parameter ``live`` can be set
772
to use live migration (if available).
773

    
774
    migrate?live=[0|1]
775

    
776
``/2/nodes/[node_name]/role``
777
+++++++++++++++++++++++++++++
778

    
779
Manages node role.
780

    
781
It supports the following commands: ``GET``, ``PUT``.
782

    
783
The role is always one of the following:
784

    
785
  - drained
786
  - master
787
  - master-candidate
788
  - offline
789
  - regular
790

    
791
``GET``
792
~~~~~~~
793

    
794
Returns the current node role.
795

    
796
Example::
797

    
798
    "master-candidate"
799

    
800
``PUT``
801
~~~~~~~
802

    
803
Change the node role.
804

    
805
The request is a string which should be PUT to this URI. The result will
806
be a job id.
807

    
808
It supports the bool ``force`` argument.
809

    
810
``/2/nodes/[node_name]/storage``
811
++++++++++++++++++++++++++++++++
812

    
813
Manages storage units on the node.
814

    
815
``GET``
816
~~~~~~~
817

    
818
Requests a list of storage units on a node. Requires the parameters
819
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and
820
``output_fields``. The result will be a job id, using which the result
821
can be retrieved.
822

    
823
``/2/nodes/[node_name]/storage/modify``
824
+++++++++++++++++++++++++++++++++++++++
825

    
826
Modifies storage units on the node.
827

    
828
``PUT``
829
~~~~~~~
830

    
831
Modifies parameters of storage units on the node. Requires the
832
parameters ``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``)
833
and ``name`` (name of the storage unit).  Parameters can be passed
834
additionally. Currently only ``allocatable`` (bool) is supported. The
835
result will be a job id.
836

    
837
``/2/nodes/[node_name]/storage/repair``
838
+++++++++++++++++++++++++++++++++++++++
839

    
840
Repairs a storage unit on the node.
841

    
842
``PUT``
843
~~~~~~~
844

    
845
Repairs a storage unit on the node. Requires the parameters
846
``storage_type`` (currently only ``lvm-vg`` can be repaired) and
847
``name`` (name of the storage unit). The result will be a job id.
848

    
849
``/2/nodes/[node_name]/tags``
850
+++++++++++++++++++++++++++++
851

    
852
Manages per-node tags.
853

    
854
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
855

    
856
``GET``
857
~~~~~~~
858

    
859
Returns a list of tags.
860

    
861
Example::
862

    
863
    ["tag1", "tag2", "tag3"]
864

    
865
``PUT``
866
~~~~~~~
867

    
868
Add a set of tags.
869

    
870
The request as a list of strings should be PUT to this URI. The result
871
will be a job id.
872

    
873
It supports the ``dry-run`` argument.
874

    
875
``DELETE``
876
~~~~~~~~~~
877

    
878
Deletes tags.
879

    
880
In order to delete a set of tags, the DELETE request should be addressed
881
to URI like::
882

    
883
    /tags?tag=[tag]&tag=[tag]
884

    
885
It supports the ``dry-run`` argument.
886

    
887

    
888
``/2/os``
889
+++++++++
890

    
891
OS resource.
892

    
893
It supports the following commands: ``GET``.
894

    
895
``GET``
896
~~~~~~~
897

    
898
Return a list of all OSes.
899

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

    
903
Example::
904

    
905
    ["debian-etch"]
906

    
907
``/2/tags``
908
+++++++++++
909

    
910
Manages cluster tags.
911

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

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

    
917
Returns the cluster tags.
918

    
919
Example::
920

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

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

    
926
Adds 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

    
934
``DELETE``
935
~~~~~~~~~~
936

    
937
Deletes tags.
938

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

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

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

    
946

    
947
``/version``
948
++++++++++++
949

    
950
The version resource.
951

    
952
This resource should be used to determine the remote API version and to
953
adapt clients accordingly.
954

    
955
It supports the following commands: ``GET``.
956

    
957
``GET``
958
~~~~~~~
959

    
960
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0
961
returns ``2``.
962

    
963
.. vim: set textwidth=72 :
964
.. Local Variables:
965
.. mode: rst
966
.. fill-column: 72
967
.. End: