rapi.rst 18.2 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
- opstatus: OpCodes status as a list
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
- opresult: OpCodes results as a list

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

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

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

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

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

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

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

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

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

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

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

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

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

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

579

Iustin Pop's avatar
Iustin Pop committed
580 581
``DELETE``
~~~~~~~~~~
582

Iustin Pop's avatar
Iustin Pop committed
583
Cancel a not-yet-started job.
584

Iustin Pop's avatar
Iustin Pop committed
585 586
``/2/nodes``
++++++++++++
587

Iustin Pop's avatar
Iustin Pop committed
588
Nodes resource.
589

Iustin Pop's avatar
Iustin Pop committed
590
It supports the following commands: ``GET``.
591

Iustin Pop's avatar
Iustin Pop committed
592 593
``GET``
~~~~~~~
594

Iustin Pop's avatar
Iustin Pop committed
595
Returns a list of all nodes.
596

Iustin Pop's avatar
Iustin Pop committed
597
Example::
598 599 600 601

    [
      {
        "id": "node1.example.com",
Iustin Pop's avatar
Iustin Pop committed
602
        "uri": "\/nodes\/node1.example.com"
603 604 605
      },
      {
        "id": "node2.example.com",
Iustin Pop's avatar
Iustin Pop committed
606
        "uri": "\/nodes\/node2.example.com"
607 608 609
      }
    ]

Iustin Pop's avatar
Iustin Pop committed
610 611 612
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.
613

Iustin Pop's avatar
Iustin Pop committed
614
Example::
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631

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

632 633 634 635 636 637 638
``/2/nodes/[node_name]``
+++++++++++++++++++++++++++++++++

Returns information about a node.

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

639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
``/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]

655 656 657 658 659 660 661 662 663 664 665 666 667 668
``/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]

669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697
``/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.

698 699
The request is a string which should be PUT to this URI. The result will
be a job id.
700 701 702

It supports the ``force`` argument.

703 704 705 706 707 708 709 710 711 712
``/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
713 714
``output_fields``. The result will be a job id, using which the result
can be retrieved.
715

716 717 718 719 720 721 722 723
``/2/nodes/[node_name]/storage/modify``
+++++++++++++++++++++++++++++++++++++++

Modifies storage units on the node.

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

724 725 726 727 728
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.
729

730 731 732 733 734 735 736 737
``/2/nodes/[node_name]/storage/repair``
+++++++++++++++++++++++++++++++++++++++

Repairs a storage unit on the node.

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

738 739 740
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.
741

Iustin Pop's avatar
Iustin Pop committed
742 743
``/2/nodes/[node_name]/tags``
+++++++++++++++++++++++++++++
744

Iustin Pop's avatar
Iustin Pop committed
745
Manages per-node tags.
746

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

Iustin Pop's avatar
Iustin Pop committed
749 750
``GET``
~~~~~~~
751

Iustin Pop's avatar
Iustin Pop committed
752
Returns a list of tags.
753

Iustin Pop's avatar
Iustin Pop committed
754
Example::
755

Iustin Pop's avatar
Iustin Pop committed
756
    ["tag1", "tag2", "tag3"]
757

Iustin Pop's avatar
Iustin Pop committed
758 759
``PUT``
~~~~~~~
760

Iustin Pop's avatar
Iustin Pop committed
761
Add a set of tags.
762

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

766 767
It supports the ``dry-run`` argument.

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

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

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

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

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


Iustin Pop's avatar
Iustin Pop committed
781 782
``/2/os``
+++++++++
783

Iustin Pop's avatar
Iustin Pop committed
784
OS resource.
785

Iustin Pop's avatar
Iustin Pop committed
786
It supports the following commands: ``GET``.
787

Iustin Pop's avatar
Iustin Pop committed
788 789
``GET``
~~~~~~~
790

Iustin Pop's avatar
Iustin Pop committed
791
Return a list of all OSes.
792

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

Iustin Pop's avatar
Iustin Pop committed
796
Example::
797

Iustin Pop's avatar
Iustin Pop committed
798
    ["debian-etch"]
799

Iustin Pop's avatar
Iustin Pop committed
800 801
``/2/tags``
+++++++++++
802

Iustin Pop's avatar
Iustin Pop committed
803
Manages cluster tags.
804

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

Iustin Pop's avatar
Iustin Pop committed
807 808
``GET``
~~~~~~~
809

Iustin Pop's avatar
Iustin Pop committed
810
Returns the cluster tags.
811

Iustin Pop's avatar
Iustin Pop committed
812
Example::
813

Iustin Pop's avatar
Iustin Pop committed
814
    ["tag1", "tag2", "tag3"]
815

Iustin Pop's avatar
Iustin Pop committed
816 817
``PUT``
~~~~~~~
818

Iustin Pop's avatar
Iustin Pop committed
819
Adds a set of tags.
820

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

824 825 826
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
827 828
``DELETE``
~~~~~~~~~~
829

Iustin Pop's avatar
Iustin Pop committed
830
Deletes tags.
831

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

Iustin Pop's avatar
Iustin Pop committed
835
    /tags?tag=[tag]&tag=[tag]
836

837 838 839
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
840 841
``/version``
++++++++++++
842

Iustin Pop's avatar
Iustin Pop committed
843
The version resource.
844

Iustin Pop's avatar
Iustin Pop committed
845 846
This resource should be used to determine the remote API version and to
adapt clients accordingly.
847

Iustin Pop's avatar
Iustin Pop committed
848
It supports the following commands: ``GET``.
849

Iustin Pop's avatar
Iustin Pop committed
850 851
``GET``
~~~~~~~
852

Iustin Pop's avatar
Iustin Pop committed
853 854
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0
returns ``2``.
855 856

.. vim: set textwidth=72 :
Iustin Pop's avatar
Iustin Pop committed
857 858 859 860
.. Local Variables:
.. mode: rst
.. fill-column: 72
.. End: