rapi.rst 16.1 KB
Newer Older
1 2 3
Ganeti remote API
=================

Iustin Pop's avatar
Iustin Pop committed
4
Documents Ganeti version |version|
5 6 7 8 9 10 11 12 13 14 15 16 17 18

.. contents::

Introduction
------------

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

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

Users and passwords
-------------------

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

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

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

Example::

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

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

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


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


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

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

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

74 75 76
Generic parameters
------------------

77 78
A few parameter mean the same thing across all resources which implement
it.
79 80 81 82

``bulk``
++++++++

Iustin Pop's avatar
Iustin Pop committed
83 84 85 86 87
Bulk-mode means that for the resources which usually return just a list
of child resources (e.g. ``/2/instances`` which returns just instance
names), the output will instead contain detailed data for all these
subresources. This is more efficient than query-ing the sub-resources
themselves.
88 89 90 91 92 93 94 95

``dry-run``
+++++++++++

The optional *dry-run* argument, if provided and set to a positive
integer value (e.g. ``?dry-run=1``), signals to Ganeti that the job
should not be executed, only the pre-execution checks will be done.

Iustin Pop's avatar
Iustin Pop committed
96 97 98
This is useful in trying to determine (without guarantees though, as in
the meantime the cluster state could have changed) if the operation is
likely to succeed or at least start executing.
99

100 101 102 103 104 105
``force``
+++++++++++

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

106 107 108
Usage examples
--------------

Iustin Pop's avatar
Iustin Pop committed
109 110
You can access the API using your favorite programming language as long
as it supports network connections.
111 112 113 114

Shell
+++++

Iustin Pop's avatar
Iustin Pop committed
115 116
.. highlight:: sh

117 118
Using wget::

Iustin Pop's avatar
Iustin Pop committed
119
   wget -q -O - https://CLUSTERNAME:5080/2/info
120 121 122 123 124 125 126 127 128

or curl::

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


Python
++++++

Iustin Pop's avatar
Iustin Pop committed
129 130 131
.. highlight:: python

::
132 133

  import urllib2
Tim Boring's avatar
Tim Boring committed
134
  f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info')
135 136 137 138 139 140
  print f.read()


JavaScript
++++++++++

141
.. warning:: While it's possible to use JavaScript, it poses several
Iustin Pop's avatar
Iustin Pop committed
142 143 144
   potential problems, including browser blocking request due to
   non-standard ports or different domain names. Fetching the data on
   the webserver is easier.
145

Iustin Pop's avatar
Iustin Pop committed
146 147
.. highlight:: javascript

148 149
::

Tim Boring's avatar
Tim Boring committed
150
  var url = 'https://CLUSTERNAME:5080/2/info';
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
  var info;
  var xmlreq = new XMLHttpRequest();
  xmlreq.onreadystatechange = function () {
    if (xmlreq.readyState != 4) return;
    if (xmlreq.status == 200) {
      info = eval("(" + xmlreq.responseText + ")");
      alert(info);
    } else {
      alert('Error fetching cluster info');
    }
    xmlreq = null;
  };
  xmlreq.open('GET', url, true);
  xmlreq.send(null);

Resources
---------

Iustin Pop's avatar
Iustin Pop committed
169
.. highlight:: javascript
170

Iustin Pop's avatar
Iustin Pop committed
171 172
``/``
+++++
173

Iustin Pop's avatar
Iustin Pop committed
174
The root resource.
175

Iustin Pop's avatar
Iustin Pop committed
176
It supports the following commands: ``GET``.
177

Iustin Pop's avatar
Iustin Pop committed
178 179
``GET``
~~~~~~~
180

Iustin Pop's avatar
Iustin Pop committed
181
Shows the list of mapped resources.
182

Iustin Pop's avatar
Iustin Pop committed
183
Returns: a dictionary with 'name' and 'uri' keys for each of them.
184

Iustin Pop's avatar
Iustin Pop committed
185 186
``/2``
++++++
187

Iustin Pop's avatar
Iustin Pop committed
188
The ``/2`` resource, the root of the version 2 API.
189

Iustin Pop's avatar
Iustin Pop committed
190
It supports the following commands: ``GET``.
191

Iustin Pop's avatar
Iustin Pop committed
192 193
``GET``
~~~~~~~
194

Iustin Pop's avatar
Iustin Pop committed
195
Show the list of mapped resources.
196

Iustin Pop's avatar
Iustin Pop committed
197
Returns: a dictionary with ``name`` and ``uri`` keys for each of them.
198

Iustin Pop's avatar
Iustin Pop committed
199 200
``/2/info``
+++++++++++
201

Iustin Pop's avatar
Iustin Pop committed
202
Cluster information resource.
203

Iustin Pop's avatar
Iustin Pop committed
204
It supports the following commands: ``GET``.
205

Iustin Pop's avatar
Iustin Pop committed
206 207
``GET``
~~~~~~~
208

Iustin Pop's avatar
Iustin Pop committed
209
Returns cluster information.
210

Iustin Pop's avatar
Iustin Pop committed
211
Example::
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241

  {
    "config_version": 2000000,
    "name": "cluster",
    "software_version": "2.0.0~beta2",
    "os_api_version": 10,
    "export_version": 0,
    "candidate_pool_size": 10,
    "enabled_hypervisors": [
      "fake"
    ],
    "hvparams": {
      "fake": {}
     },
    "default_hypervisor": "fake",
    "master": "node1.example.com",
    "architecture": [
      "64bit",
      "x86_64"
    ],
    "protocol_version": 20,
    "beparams": {
      "default": {
        "auto_balance": true,
        "vcpus": 1,
        "memory": 128
       }
      }
    }

242 243 244 245 246 247 248 249 250 251 252 253 254 255

``/2/redistribute-config``
++++++++++++++++++++++++++

Redistribute configuration to all nodes.

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

``PUT``
~~~~~~~

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


Iustin Pop's avatar
Iustin Pop committed
256 257
``/2/instances``
++++++++++++++++
258

Iustin Pop's avatar
Iustin Pop committed
259
The instances resource.
260

Iustin Pop's avatar
Iustin Pop committed
261
It supports the following commands: ``GET``, ``POST``.
262

Iustin Pop's avatar
Iustin Pop committed
263 264
``GET``
~~~~~~~
265

Iustin Pop's avatar
Iustin Pop committed
266
Returns a list of all available instances.
267

Iustin Pop's avatar
Iustin Pop committed
268
Example::
269 270 271 272 273 274 275 276 277 278 279 280

    [
      {
        "name": "web.example.com",
        "uri": "\/instances\/web.example.com"
      },
      {
        "name": "mail.example.com",
        "uri": "\/instances\/mail.example.com"
      }
    ]

Iustin Pop's avatar
Iustin Pop committed
281 282 283
If the optional *bulk* argument is provided and set to a true value (i.e
``?bulk=1``), the output contains detailed information about instances
as a list.
284

Iustin Pop's avatar
Iustin Pop committed
285
Example::
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314

    [
      {
         "status": "running",
         "disk_usage": 20480,
         "nic.bridges": [
           "xen-br0"
          ],
         "name": "web.example.com",
         "tags": ["tag1", "tag2"],
         "beparams": {
           "vcpus": 2,
           "memory": 512
         },
         "disk.sizes": [
             20480
         ],
         "pnode": "node1.example.com",
         "nic.macs": ["01:23:45:67:89:01"],
         "snodes": ["node2.example.com"],
         "disk_template": "drbd",
         "admin_state": true,
         "os": "debian-etch",
         "oper_state": true
      },
      ...
    ]


Iustin Pop's avatar
Iustin Pop committed
315 316
``POST``
~~~~~~~~
317

Iustin Pop's avatar
Iustin Pop committed
318
Creates an instance.
319

320 321
If the optional *dry-run* argument is provided and set to a positive
integer valu (e.g. ``?dry-run=1``), the job will not be actually
Iustin Pop's avatar
Iustin Pop committed
322 323 324
executed, only the pre-execution checks will be done. Query-ing the job
result will return, in both dry-run and normal case, the list of nodes
selected for the instance.
325

Iustin Pop's avatar
Iustin Pop committed
326
Returns: a job ID that can be used later for polling.
327

Iustin Pop's avatar
Iustin Pop committed
328 329
``/2/instances/[instance_name]``
++++++++++++++++++++++++++++++++
330

Iustin Pop's avatar
Iustin Pop committed
331
Instance-specific resource.
332

Iustin Pop's avatar
Iustin Pop committed
333
It supports the following commands: ``GET``, ``DELETE``.
334

Iustin Pop's avatar
Iustin Pop committed
335 336
``GET``
~~~~~~~
337

Iustin Pop's avatar
Iustin Pop committed
338 339
Returns information about an instance, similar to the bulk output from
the instance list.
340

Iustin Pop's avatar
Iustin Pop committed
341 342
``DELETE``
~~~~~~~~~~
343

Iustin Pop's avatar
Iustin Pop committed
344
Deletes an instance.
345

346 347
It supports the ``dry-run`` argument.

348

349 350 351 352 353 354 355 356 357 358
``/2/instances/[instance_name]/info``
+++++++++++++++++++++++++++++++++++++++

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

``GET``
~~~~~~~

Requests detailed information about the instance. An optional parameter,
``static`` (bool), can be set to return only static information from the
359 360
configuration without querying the instance's nodes. The result will be
a job id.
361 362


Iustin Pop's avatar
Iustin Pop committed
363 364
``/2/instances/[instance_name]/reboot``
+++++++++++++++++++++++++++++++++++++++
365

Iustin Pop's avatar
Iustin Pop committed
366
Reboots URI for an instance.
367

Iustin Pop's avatar
Iustin Pop committed
368
It supports the following commands: ``POST``.
369

Iustin Pop's avatar
Iustin Pop committed
370 371
``POST``
~~~~~~~~
372

Iustin Pop's avatar
Iustin Pop committed
373
Reboots the instance.
374

Iustin Pop's avatar
Iustin Pop committed
375 376
The URI takes optional ``type=hard|soft|full`` and
``ignore_secondaries=False|True`` parameters.
377

378 379 380
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
381 382
``/2/instances/[instance_name]/shutdown``
+++++++++++++++++++++++++++++++++++++++++
383

Iustin Pop's avatar
Iustin Pop committed
384
Instance shutdown URI.
385

Iustin Pop's avatar
Iustin Pop committed
386
It supports the following commands: ``PUT``.
387

Iustin Pop's avatar
Iustin Pop committed
388 389
``PUT``
~~~~~~~
390

Iustin Pop's avatar
Iustin Pop committed
391
Shutdowns an instance.
392

393 394
It supports the ``dry-run`` argument.

395

Iustin Pop's avatar
Iustin Pop committed
396 397
``/2/instances/[instance_name]/startup``
++++++++++++++++++++++++++++++++++++++++
398

Iustin Pop's avatar
Iustin Pop committed
399
Instance startup URI.
400

Iustin Pop's avatar
Iustin Pop committed
401
It supports the following commands: ``PUT``.
402

Iustin Pop's avatar
Iustin Pop committed
403 404
``PUT``
~~~~~~~
405

Iustin Pop's avatar
Iustin Pop committed
406
Startup an instance.
407

Iustin Pop's avatar
Iustin Pop committed
408 409
The URI takes an optional ``force=False|True`` parameter to start the
instance if even if secondary disks are failing.
410

411 412
It supports the ``dry-run`` argument.

413 414 415 416 417 418 419 420 421 422 423 424
``/2/instances/[instance_name]/reinstall``
++++++++++++++++++++++++++++++++++++++++++++++

Installs the operating system again.

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

``POST``
~~~~~~~~

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

425

426 427 428 429 430 431 432 433 434 435 436
``/2/instances/[instance_name]/replace-disks``
++++++++++++++++++++++++++++++++++++++++++++++

Replaces disks on an instance.

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

``POST``
~~~~~~~~

Takes the parameters ``mode`` (one of ``replace_on_primary``,
437 438 439
``replace_on_secondary``, ``replace_new_secondary`` or
``replace_auto``), ``disks`` (comma separated list of disk indexes),
``remote_node`` and ``iallocator``.
440 441


Iustin Pop's avatar
Iustin Pop committed
442 443
``/2/instances/[instance_name]/tags``
+++++++++++++++++++++++++++++++++++++
444

Iustin Pop's avatar
Iustin Pop committed
445
Manages per-instance tags.
446

Iustin Pop's avatar
Iustin Pop committed
447
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
448

Iustin Pop's avatar
Iustin Pop committed
449 450
``GET``
~~~~~~~
451

Iustin Pop's avatar
Iustin Pop committed
452
Returns a list of tags.
453

Iustin Pop's avatar
Iustin Pop committed
454
Example::
455

Iustin Pop's avatar
Iustin Pop committed
456
    ["tag1", "tag2", "tag3"]
457

Iustin Pop's avatar
Iustin Pop committed
458 459
``PUT``
~~~~~~~
460

Iustin Pop's avatar
Iustin Pop committed
461
Add a set of tags.
462

Iustin Pop's avatar
Iustin Pop committed
463
The request as a list of strings should be ``PUT`` to this URI. The
464
result will be a job id.
465

466 467 468
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
469 470
``DELETE``
~~~~~~~~~~
471

Iustin Pop's avatar
Iustin Pop committed
472
Delete a tag.
473

Iustin Pop's avatar
Iustin Pop committed
474 475
In order to delete a set of tags, the DELETE request should be addressed
to URI like::
476

Iustin Pop's avatar
Iustin Pop committed
477
    /tags?tag=[tag]&tag=[tag]
478

479 480 481
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
482 483
``/2/jobs``
+++++++++++
484

Iustin Pop's avatar
Iustin Pop committed
485
The ``/2/jobs`` resource.
486

Iustin Pop's avatar
Iustin Pop committed
487
It supports the following commands: ``GET``.
488

Iustin Pop's avatar
Iustin Pop committed
489 490
``GET``
~~~~~~~
491

Iustin Pop's avatar
Iustin Pop committed
492
Returns a dictionary of jobs.
493

Iustin Pop's avatar
Iustin Pop committed
494
Returns: a dictionary with jobs id and uri.
495

Iustin Pop's avatar
Iustin Pop committed
496 497
``/2/jobs/[job_id]``
++++++++++++++++++++
498 499


Iustin Pop's avatar
Iustin Pop committed
500
Individual job URI.
501

Iustin Pop's avatar
Iustin Pop committed
502
It supports the following commands: ``GET``, ``DELETE``.
503

Iustin Pop's avatar
Iustin Pop committed
504 505
``GET``
~~~~~~~
506

Iustin Pop's avatar
Iustin Pop committed
507
Returns a job status.
508

Iustin Pop's avatar
Iustin Pop committed
509
Returns: a dictionary with job parameters.
510

Iustin Pop's avatar
Iustin Pop committed
511
The result includes:
512

Iustin Pop's avatar
Iustin Pop committed
513 514
- id: job ID as a number
- status: current job status as a string
Iustin Pop's avatar
Iustin Pop committed
515 516
- ops: involved OpCodes as a list of dictionaries for each opcodes in
  the job
Iustin Pop's avatar
Iustin Pop committed
517 518
- opstatus: OpCodes status as a list
- opresult: OpCodes results as a list of lists
519

Iustin Pop's avatar
Iustin Pop committed
520 521
``DELETE``
~~~~~~~~~~
522

Iustin Pop's avatar
Iustin Pop committed
523
Cancel a not-yet-started job.
524

Iustin Pop's avatar
Iustin Pop committed
525 526
``/2/nodes``
++++++++++++
527

Iustin Pop's avatar
Iustin Pop committed
528
Nodes resource.
529

Iustin Pop's avatar
Iustin Pop committed
530
It supports the following commands: ``GET``.
531

Iustin Pop's avatar
Iustin Pop committed
532 533
``GET``
~~~~~~~
534

Iustin Pop's avatar
Iustin Pop committed
535
Returns a list of all nodes.
536

Iustin Pop's avatar
Iustin Pop committed
537
Example::
538 539 540 541 542 543 544 545 546 547 548 549

    [
      {
        "id": "node1.example.com",
        "uri": "\/instances\/node1.example.com"
      },
      {
        "id": "node2.example.com",
        "uri": "\/instances\/node2.example.com"
      }
    ]

Iustin Pop's avatar
Iustin Pop committed
550 551 552
If the optional 'bulk' argument is provided and set to 'true' value (i.e
'?bulk=1'), the output contains detailed information about nodes as a
list.
553

Iustin Pop's avatar
Iustin Pop committed
554
Example::
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571

    [
      {
        "pinst_cnt": 1,
        "mfree": 31280,
        "mtotal": 32763,
        "name": "www.example.com",
        "tags": [],
        "mnode": 512,
        "dtotal": 5246208,
        "sinst_cnt": 2,
        "dfree": 5171712,
        "offline": false
      },
      ...
    ]

572 573 574 575 576 577 578
``/2/nodes/[node_name]``
+++++++++++++++++++++++++++++++++

Returns information about a node.

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

579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
``/2/nodes/[node_name]/evacuate``
+++++++++++++++++++++++++++++++++

Evacuates all secondary instances off a node.

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

``POST``
~~~~~~~~

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

    evacuate?iallocator=[iallocator]
    evacuate?remote_node=[nodeX.example.com]

595 596 597 598 599 600 601 602 603 604 605 606 607 608
``/2/nodes/[node_name]/migrate``
+++++++++++++++++++++++++++++++++

Migrates all primary instances from a node.

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

``POST``
~~~~~~~~

No parameters are required, but ``live`` can be set to a boolean value.

    migrate?live=[0|1]

609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637
``/2/nodes/[node_name]/role``
+++++++++++++++++++++++++++++

Manages node role.

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

The role is always one of the following:

  - drained
  - master
  - master-candidate
  - offline
  - regular

``GET``
~~~~~~~

Returns the current node role.

Example::

    "master-candidate"

``PUT``
~~~~~~~

Change the node role.

638 639
The request is a string which should be PUT to this URI. The result will
be a job id.
640 641 642

It supports the ``force`` argument.

643 644 645 646 647 648 649 650 651 652
``/2/nodes/[node_name]/storage``
++++++++++++++++++++++++++++++++

Manages storage units on the node.

``GET``
~~~~~~~

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

656 657 658 659 660 661 662 663
``/2/nodes/[node_name]/storage/modify``
+++++++++++++++++++++++++++++++++++++++

Modifies storage units on the node.

``PUT``
~~~~~~~

664 665 666 667 668
Modifies parameters of storage units on the node. Requires the
parameters ``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``)
and ``name`` (name of the storage unit).  Parameters can be passed
additionally. Currently only ``allocatable`` (bool) is supported. The
result will be a job id.
669

670 671 672 673 674 675 676 677
``/2/nodes/[node_name]/storage/repair``
+++++++++++++++++++++++++++++++++++++++

Repairs a storage unit on the node.

``PUT``
~~~~~~~

678 679 680
Repairs a storage unit on the node. Requires the parameters
``storage_type`` (currently only ``lvm-vg`` can be repaired) and
``name`` (name of the storage unit). The result will be a job id.
681

Iustin Pop's avatar
Iustin Pop committed
682 683
``/2/nodes/[node_name]/tags``
+++++++++++++++++++++++++++++
684

Iustin Pop's avatar
Iustin Pop committed
685
Manages per-node tags.
686

Iustin Pop's avatar
Iustin Pop committed
687
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
688

Iustin Pop's avatar
Iustin Pop committed
689 690
``GET``
~~~~~~~
691

Iustin Pop's avatar
Iustin Pop committed
692
Returns a list of tags.
693

Iustin Pop's avatar
Iustin Pop committed
694
Example::
695

Iustin Pop's avatar
Iustin Pop committed
696
    ["tag1", "tag2", "tag3"]
697

Iustin Pop's avatar
Iustin Pop committed
698 699
``PUT``
~~~~~~~
700

Iustin Pop's avatar
Iustin Pop committed
701
Add a set of tags.
702

Iustin Pop's avatar
Iustin Pop committed
703 704
The request as a list of strings should be PUT to this URI. The result
will be a job id.
705

706 707
It supports the ``dry-run`` argument.

Iustin Pop's avatar
Iustin Pop committed
708 709
``DELETE``
~~~~~~~~~~
710

Iustin Pop's avatar
Iustin Pop committed
711
Deletes tags.
712

Iustin Pop's avatar
Iustin Pop committed
713 714
In order to delete a set of tags, the DELETE request should be addressed
to URI like::
715

Iustin Pop's avatar
Iustin Pop committed
716
    /tags?tag=[tag]&tag=[tag]
717

718 719 720
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
721 722
``/2/os``
+++++++++
723

Iustin Pop's avatar
Iustin Pop committed
724
OS resource.
725

Iustin Pop's avatar
Iustin Pop committed
726
It supports the following commands: ``GET``.
727

Iustin Pop's avatar
Iustin Pop committed
728 729
``GET``
~~~~~~~
730

Iustin Pop's avatar
Iustin Pop committed
731
Return a list of all OSes.
732

Iustin Pop's avatar
Iustin Pop committed
733
Can return error 500 in case of a problem. Since this is a costly
Iustin Pop's avatar
Iustin Pop committed
734
operation for Ganeti 2.0, it is not recommended to execute it too often.
735

Iustin Pop's avatar
Iustin Pop committed
736
Example::
737

Iustin Pop's avatar
Iustin Pop committed
738
    ["debian-etch"]
739

Iustin Pop's avatar
Iustin Pop committed
740 741
``/2/tags``
+++++++++++
742

Iustin Pop's avatar
Iustin Pop committed
743
Manages cluster tags.
744

Iustin Pop's avatar
Iustin Pop committed
745
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
746

Iustin Pop's avatar
Iustin Pop committed
747 748
``GET``
~~~~~~~
749

Iustin Pop's avatar
Iustin Pop committed
750
Returns the cluster tags.
751

Iustin Pop's avatar
Iustin Pop committed
752
Example::
753

Iustin Pop's avatar
Iustin Pop committed
754
    ["tag1", "tag2", "tag3"]
755

Iustin Pop's avatar
Iustin Pop committed
756 757
``PUT``
~~~~~~~
758

Iustin Pop's avatar
Iustin Pop committed
759
Adds a set of tags.
760

Iustin Pop's avatar
Iustin Pop committed
761 762
The request as a list of strings should be PUT to this URI. The result
will be a job id.
763

764 765 766
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
767 768
``DELETE``
~~~~~~~~~~
769

Iustin Pop's avatar
Iustin Pop committed
770
Deletes tags.
771

Iustin Pop's avatar
Iustin Pop committed
772 773
In order to delete a set of tags, the DELETE request should be addressed
to URI like::
774

Iustin Pop's avatar
Iustin Pop committed
775
    /tags?tag=[tag]&tag=[tag]
776

777 778 779
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
780 781
``/version``
++++++++++++
782

Iustin Pop's avatar
Iustin Pop committed
783
The version resource.
784

Iustin Pop's avatar
Iustin Pop committed
785 786
This resource should be used to determine the remote API version and to
adapt clients accordingly.
787

Iustin Pop's avatar
Iustin Pop committed
788
It supports the following commands: ``GET``.
789

Iustin Pop's avatar
Iustin Pop committed
790 791
``GET``
~~~~~~~
792

Iustin Pop's avatar
Iustin Pop committed
793 794
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0
returns ``2``.
795 796

.. vim: set textwidth=72 :
Iustin Pop's avatar
Iustin Pop committed
797 798 799 800
.. Local Variables:
.. mode: rst
.. fill-column: 72
.. End: