rapi.rst 18.8 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

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
31 32
operations modifying the cluster. Lines starting with the hash sign
(``#``) are treated as comments.
33 34 35 36 37

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
38 39 40
'jack:Ganeti Remote API:abc123' | openssl md5``) [#pwhash]_ and prefix
it with ``{ha1}``. Using the scheme prefix for all passwords is
recommended. Scheme prefixes are not case sensitive.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

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


442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
``/2/instances/[instance_name]/activate-disks``
+++++++++++++++++++++++++++++++++++++++++++++++

Activate disks on an instance.

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

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

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


``/2/instances/[instance_name]/deactivate-disks``
+++++++++++++++++++++++++++++++++++++++++++++++++

Deactivate disks on an instance.

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

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

Takes no parameters.


Iustin Pop's avatar
Iustin Pop committed
469 470
``/2/instances/[instance_name]/tags``
+++++++++++++++++++++++++++++++++++++
471

Iustin Pop's avatar
Iustin Pop committed
472
Manages per-instance tags.
473

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

Iustin Pop's avatar
Iustin Pop committed
476 477
``GET``
~~~~~~~
478

Iustin Pop's avatar
Iustin Pop committed
479
Returns a list of tags.
480

Iustin Pop's avatar
Iustin Pop committed
481
Example::
482

Iustin Pop's avatar
Iustin Pop committed
483
    ["tag1", "tag2", "tag3"]
484

Iustin Pop's avatar
Iustin Pop committed
485 486
``PUT``
~~~~~~~
487

Iustin Pop's avatar
Iustin Pop committed
488
Add a set of tags.
489

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

493 494 495
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
496 497
``DELETE``
~~~~~~~~~~
498

Iustin Pop's avatar
Iustin Pop committed
499
Delete a tag.
500

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

Iustin Pop's avatar
Iustin Pop committed
504
    /tags?tag=[tag]&tag=[tag]
505

506 507 508
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
509 510
``/2/jobs``
+++++++++++
511

Iustin Pop's avatar
Iustin Pop committed
512
The ``/2/jobs`` resource.
513

Iustin Pop's avatar
Iustin Pop committed
514
It supports the following commands: ``GET``.
515

Iustin Pop's avatar
Iustin Pop committed
516 517
``GET``
~~~~~~~
518

Iustin Pop's avatar
Iustin Pop committed
519
Returns a dictionary of jobs.
520

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

Iustin Pop's avatar
Iustin Pop committed
523 524
``/2/jobs/[job_id]``
++++++++++++++++++++
525 526


Iustin Pop's avatar
Iustin Pop committed
527
Individual job URI.
528

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

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

Iustin Pop's avatar
Iustin Pop committed
534
Returns a job status.
535

Iustin Pop's avatar
Iustin Pop committed
536
Returns: a dictionary with job parameters.
537

Iustin Pop's avatar
Iustin Pop committed
538
The result includes:
539

Iustin Pop's avatar
Iustin Pop committed
540 541
- id: job ID as a number
- status: current job status as a string
Iustin Pop's avatar
Iustin Pop committed
542 543
- ops: involved OpCodes as a list of dictionaries for each opcodes in
  the job
Iustin Pop's avatar
Iustin Pop committed
544
- opstatus: OpCodes status as a list
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 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
- 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.

606

Iustin Pop's avatar
Iustin Pop committed
607 608
``DELETE``
~~~~~~~~~~
609

Iustin Pop's avatar
Iustin Pop committed
610
Cancel a not-yet-started job.
611

Iustin Pop's avatar
Iustin Pop committed
612 613
``/2/nodes``
++++++++++++
614

Iustin Pop's avatar
Iustin Pop committed
615
Nodes resource.
616

Iustin Pop's avatar
Iustin Pop committed
617
It supports the following commands: ``GET``.
618

Iustin Pop's avatar
Iustin Pop committed
619 620
``GET``
~~~~~~~
621

Iustin Pop's avatar
Iustin Pop committed
622
Returns a list of all nodes.
623

Iustin Pop's avatar
Iustin Pop committed
624
Example::
625 626 627 628

    [
      {
        "id": "node1.example.com",
Iustin Pop's avatar
Iustin Pop committed
629
        "uri": "\/nodes\/node1.example.com"
630 631 632
      },
      {
        "id": "node2.example.com",
Iustin Pop's avatar
Iustin Pop committed
633
        "uri": "\/nodes\/node2.example.com"
634 635 636
      }
    ]

Iustin Pop's avatar
Iustin Pop committed
637 638 639
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.
640

Iustin Pop's avatar
Iustin Pop committed
641
Example::
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658

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

659 660 661 662 663 664 665
``/2/nodes/[node_name]``
+++++++++++++++++++++++++++++++++

Returns information about a node.

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

666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
``/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]

682 683 684 685 686 687 688 689 690 691 692 693 694 695
``/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]

696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
``/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.

725 726
The request is a string which should be PUT to this URI. The result will
be a job id.
727 728 729

It supports the ``force`` argument.

730 731 732 733 734 735 736 737 738 739
``/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
740 741
``output_fields``. The result will be a job id, using which the result
can be retrieved.
742

743 744 745 746 747 748 749 750
``/2/nodes/[node_name]/storage/modify``
+++++++++++++++++++++++++++++++++++++++

Modifies storage units on the node.

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

751 752 753 754 755
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.
756

757 758 759 760 761 762 763 764
``/2/nodes/[node_name]/storage/repair``
+++++++++++++++++++++++++++++++++++++++

Repairs a storage unit on the node.

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

765 766 767
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.
768

Iustin Pop's avatar
Iustin Pop committed
769 770
``/2/nodes/[node_name]/tags``
+++++++++++++++++++++++++++++
771

Iustin Pop's avatar
Iustin Pop committed
772
Manages per-node tags.
773

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

Iustin Pop's avatar
Iustin Pop committed
776 777
``GET``
~~~~~~~
778

Iustin Pop's avatar
Iustin Pop committed
779
Returns a list of tags.
780

Iustin Pop's avatar
Iustin Pop committed
781
Example::
782

Iustin Pop's avatar
Iustin Pop committed
783
    ["tag1", "tag2", "tag3"]
784

Iustin Pop's avatar
Iustin Pop committed
785 786
``PUT``
~~~~~~~
787

Iustin Pop's avatar
Iustin Pop committed
788
Add a set of tags.
789

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

793 794
It supports the ``dry-run`` argument.

Iustin Pop's avatar
Iustin Pop committed
795 796
``DELETE``
~~~~~~~~~~
797

Iustin Pop's avatar
Iustin Pop committed
798
Deletes tags.
799

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

Iustin Pop's avatar
Iustin Pop committed
803
    /tags?tag=[tag]&tag=[tag]
804

805 806 807
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
808 809
``/2/os``
+++++++++
810

Iustin Pop's avatar
Iustin Pop committed
811
OS resource.
812

Iustin Pop's avatar
Iustin Pop committed
813
It supports the following commands: ``GET``.
814

Iustin Pop's avatar
Iustin Pop committed
815 816
``GET``
~~~~~~~
817

Iustin Pop's avatar
Iustin Pop committed
818
Return a list of all OSes.
819

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

Iustin Pop's avatar
Iustin Pop committed
823
Example::
824

Iustin Pop's avatar
Iustin Pop committed
825
    ["debian-etch"]
826

Iustin Pop's avatar
Iustin Pop committed
827 828
``/2/tags``
+++++++++++
829

Iustin Pop's avatar
Iustin Pop committed
830
Manages cluster tags.
831

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

Iustin Pop's avatar
Iustin Pop committed
834 835
``GET``
~~~~~~~
836

Iustin Pop's avatar
Iustin Pop committed
837
Returns the cluster tags.
838

Iustin Pop's avatar
Iustin Pop committed
839
Example::
840

Iustin Pop's avatar
Iustin Pop committed
841
    ["tag1", "tag2", "tag3"]
842

Iustin Pop's avatar
Iustin Pop committed
843 844
``PUT``
~~~~~~~
845

Iustin Pop's avatar
Iustin Pop committed
846
Adds a set of tags.
847

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

851 852 853
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
854 855
``DELETE``
~~~~~~~~~~
856

Iustin Pop's avatar
Iustin Pop committed
857
Deletes tags.
858

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

Iustin Pop's avatar
Iustin Pop committed
862
    /tags?tag=[tag]&tag=[tag]
863

864 865 866
It supports the ``dry-run`` argument.


Iustin Pop's avatar
Iustin Pop committed
867 868
``/version``
++++++++++++
869

Iustin Pop's avatar
Iustin Pop committed
870
The version resource.
871

Iustin Pop's avatar
Iustin Pop committed
872 873
This resource should be used to determine the remote API version and to
adapt clients accordingly.
874

Iustin Pop's avatar
Iustin Pop committed
875
It supports the following commands: ``GET``.
876

Iustin Pop's avatar
Iustin Pop committed
877 878
``GET``
~~~~~~~
879

Iustin Pop's avatar
Iustin Pop committed
880 881
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0
returns ``2``.
882 883

.. vim: set textwidth=72 :
Iustin Pop's avatar
Iustin Pop committed
884 885 886 887
.. Local Variables:
.. mode: rst
.. fill-column: 72
.. End: