4 Documents Ganeti version |version|
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
23 ``ganeti-rapi`` reads users and passwords from a file (usually
24 ``/var/lib/ganeti/rapi/users``) on startup. Changes to the file will be
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.
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.
44 # Give Jack and Fred read-only access
46 fred {cleartext}foo555
48 # Give write access to an imaginary instance creation script
49 autocreator xyz789 write
51 # Hashed password for Jessica
52 jessica {HA1}7046452df2cbb530877058712cf17bd4 write
55 .. [#pwhash] Using the MD5 hash of username, realm and password is
56 described in :rfc:`2617` ("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.
67 The protocol used is JSON_ over HTTP designed after the REST_ principle.
68 HTTP Basic authentication as per :rfc:`2617` is supported.
70 .. _JSON: http://www.json.org/
71 .. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer
73 HTTP requests with a body (e.g. ``PUT`` or ``POST``) require the request
74 header ``Content-type`` be set to ``application/json`` (see :rfc:`2616`
75 (HTTP/1.1), section 7.2.1).
78 A note on JSON as used by RAPI
79 ++++++++++++++++++++++++++++++
81 JSON_ as used by Ganeti RAPI does not conform to the specification in
82 :rfc:`4627`. Section 2 defines a JSON text to be either an object
83 (``{"key": "value", …}``) or an array (``[1, 2, 3, …]``). In violation
84 of this RAPI uses plain strings (``"master-candidate"``, ``"1234"``) for
85 some requests or responses. Changing this now would likely break
86 existing clients and cause a lot of trouble.
90 Unlike Python's `JSON encoder and decoder
91 <http://docs.python.org/library/json.html>`_, other programming
92 languages or libraries may only provide a strict implementation, not
93 allowing plain values. For those, responses can usually be wrapped in an
94 array whose first element is then used, e.g. the response ``"1234"``
95 becomes ``["1234"]``. This works equally well for more complex values.
100 # Insert code to get response here
101 response = "\"1234\""
103 decoded = JSON.parse("[#{response}]").first
105 Short of modifying the encoder to allow encoding to a less strict
106 format, requests will have to be formatted by hand. Newer RAPI requests
107 already use a dictionary as their input data and shouldn't cause any
114 According to :rfc:`2616` the main difference between PUT and POST is
115 that POST can create new resources but PUT can only create the resource
116 the URI was pointing to on the PUT request.
118 Unfortunately, due to historic reasons, the Ganeti RAPI library is not
119 consistent with this usage, so just use the methods as documented below
122 For more details have a look in the source code at
123 ``lib/rapi/rlib2.py``.
126 Generic parameter types
127 -----------------------
129 A few generic refered parameter types and the values they allow.
134 A boolean option will accept ``1`` or ``0`` as numbers but not
135 i.e. ``True`` or ``False``.
140 A few parameter mean the same thing across all resources which implement
146 Bulk-mode means that for the resources which usually return just a list
147 of child resources (e.g. ``/2/instances`` which returns just instance
148 names), the output will instead contain detailed data for all these
149 subresources. This is more efficient than query-ing the sub-resources
155 The boolean *dry-run* argument, if provided and set, signals to Ganeti
156 that the job should not be executed, only the pre-execution checks will
159 This is useful in trying to determine (without guarantees though, as in
160 the meantime the cluster state could have changed) if the operation is
161 likely to succeed or at least start executing.
166 Force operation to continue even if it will cause the cluster to become
167 inconsistent (e.g. because there are not enough master candidates).
172 You can access the API using your favorite programming language as long
173 as it supports network connections.
178 Ganeti includes a standalone RAPI client, ``lib/rapi/client.py``.
187 wget -q -O - https://CLUSTERNAME:5080/2/info
191 curl https://CLUSTERNAME:5080/2/info
197 .. highlight:: python
202 f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info')
209 .. warning:: While it's possible to use JavaScript, it poses several
210 potential problems, including browser blocking request due to
211 non-standard ports or different domain names. Fetching the data on
212 the webserver is easier.
214 .. highlight:: javascript
218 var url = 'https://CLUSTERNAME:5080/2/info';
220 var xmlreq = new XMLHttpRequest();
221 xmlreq.onreadystatechange = function () {
222 if (xmlreq.readyState != 4) return;
223 if (xmlreq.status == 200) {
224 info = eval("(" + xmlreq.responseText + ")");
227 alert('Error fetching cluster info');
231 xmlreq.open('GET', url, true);
237 .. highlight:: javascript
244 It supports the following commands: ``GET``.
249 Shows the list of mapped resources.
251 Returns: a dictionary with 'name' and 'uri' keys for each of them.
256 The ``/2`` resource, the root of the version 2 API.
258 It supports the following commands: ``GET``.
263 Show the list of mapped resources.
265 Returns: a dictionary with ``name`` and ``uri`` keys for each of them.
270 Cluster information resource.
272 It supports the following commands: ``GET``.
277 Returns cluster information.
282 "config_version": 2000000,
284 "software_version": "2.0.0~beta2",
285 "os_api_version": 10,
287 "candidate_pool_size": 10,
288 "enabled_hypervisors": [
294 "default_hypervisor": "fake",
295 "master": "node1.example.com",
300 "protocol_version": 20,
303 "auto_balance": true,
311 ``/2/redistribute-config``
312 ++++++++++++++++++++++++++
314 Redistribute configuration to all nodes.
316 It supports the following commands: ``PUT``.
321 Redistribute configuration to all nodes. The result will be a job id.
330 Returns a list of features supported by the RAPI server. Available
335 rlib2.ALL_FEATURES == set([rlib2._INST_CREATE_REQV1,
336 rlib2._INST_REINSTALL_REQV1,
337 rlib2._NODE_MIGRATE_REQV1,
338 rlib2._NODE_EVAC_RES1])
340 :pyeval:`rlib2._INST_CREATE_REQV1`
341 Instance creation request data version 1 supported.
342 :pyeval:`rlib2._INST_REINSTALL_REQV1`
343 Instance reinstall supports body parameters.
344 :pyeval:`rlib2._NODE_MIGRATE_REQV1`
345 Whether migrating a node (``/2/nodes/[node_name]/migrate``) supports
346 request body parameters.
347 :pyeval:`rlib2._NODE_EVAC_RES1`
348 Whether evacuating a node (``/2/nodes/[node_name]/evacuate``) returns
349 a new-style result (see resource description)
353 ++++++++++++++++++++++++++++++++++++++++
355 Modifies cluster parameters.
357 Supports the following commands: ``PUT``.
366 .. opcode_params:: OP_CLUSTER_SET_PARAMS
374 It supports the following commands: ``GET``, ``POST``.
379 Returns a list of all existing node groups.
386 "uri": "\/2\/groups\/group1"
390 "uri": "\/2\/groups\/group2"
394 If the optional bool *bulk* argument is provided and set to a true value
395 (i.e ``?bulk=1``), the output contains detailed information about node
408 "uuid": "0d7d407c-262e-49af-881a-6a430034bf43"
416 "uuid": "f5a277e7-68f9-44d3-a378-4b25ecb5df5c"
423 Creates a node group.
425 If the optional bool *dry-run* argument is provided, the job will not be
426 actually executed, only the pre-execution checks will be done.
428 Returns: a job ID that can be used later for polling.
432 .. opcode_params:: OP_GROUP_ADD
434 Earlier versions used a parameter named ``name`` which, while still
435 supported, has been renamed to ``group_name``.
438 ``/2/groups/[group_name]``
439 ++++++++++++++++++++++++++
441 Returns information about a node group.
443 It supports the following commands: ``GET``, ``DELETE``.
448 Returns information about a node group, similar to the bulk output from
454 Deletes a node group.
456 It supports the ``dry-run`` argument.
459 ``/2/groups/[group_name]/modify``
460 +++++++++++++++++++++++++++++++++
462 Modifies the parameters of a node group.
464 Supports the following commands: ``PUT``.
473 .. opcode_params:: OP_GROUP_SET_PARAMS
477 ``/2/groups/[group_name]/rename``
478 +++++++++++++++++++++++++++++++++
480 Renames a node group.
482 Supports the following commands: ``PUT``.
491 .. opcode_params:: OP_GROUP_RENAME
495 ``/2/groups/[group_name]/assign-nodes``
496 +++++++++++++++++++++++++++++++++++++++
498 Assigns nodes to a group.
500 Supports the following commands: ``PUT``.
505 Returns a job ID. It supports the ``dry-run`` and ``force`` arguments.
509 .. opcode_params:: OP_GROUP_ASSIGN_NODES
510 :exclude: group_name, force, dry_run
513 ``/2/groups/[group_name]/tags``
514 +++++++++++++++++++++++++++++++
516 Manages per-nodegroup tags.
518 Supports the following commands: ``GET``, ``PUT``, ``DELETE``.
523 Returns a list of tags.
527 ["tag1", "tag2", "tag3"]
534 The request as a list of strings should be ``PUT`` to this URI. The
535 result will be a job id.
537 It supports the ``dry-run`` argument.
545 In order to delete a set of tags, the DELETE request should be addressed
548 /tags?tag=[tag]&tag=[tag]
550 It supports the ``dry-run`` argument.
556 The instances resource.
558 It supports the following commands: ``GET``, ``POST``.
563 Returns a list of all available instances.
569 "name": "web.example.com",
570 "uri": "\/instances\/web.example.com"
573 "name": "mail.example.com",
574 "uri": "\/instances\/mail.example.com"
578 If the optional bool *bulk* argument is provided and set to a true value
579 (i.e ``?bulk=1``), the output contains detailed information about
591 "name": "web.example.com",
592 "tags": ["tag1", "tag2"],
600 "pnode": "node1.example.com",
601 "nic.macs": ["01:23:45:67:89:01"],
602 "snodes": ["node2.example.com"],
603 "disk_template": "drbd",
617 If the optional bool *dry-run* argument is provided, the job will not be
618 actually executed, only the pre-execution checks will be done. Query-ing
619 the job result will return, in both dry-run and normal case, the list of
620 nodes selected for the instance.
622 Returns: a job ID that can be used later for polling.
626 ``__version__`` (int, required)
627 Must be ``1`` (older Ganeti versions used a different format for
628 instance creation requests, version ``0``, but that format is no
631 .. opcode_params:: OP_INSTANCE_CREATE
633 Earlier versions used parameters named ``name`` and ``os``. These have
634 been replaced by ``instance_name`` and ``os_type`` to match the
635 underlying opcode. The old names can still be used.
638 ``/2/instances/[instance_name]``
639 ++++++++++++++++++++++++++++++++
641 Instance-specific resource.
643 It supports the following commands: ``GET``, ``DELETE``.
648 Returns information about an instance, similar to the bulk output from
656 It supports the ``dry-run`` argument.
659 ``/2/instances/[instance_name]/info``
660 +++++++++++++++++++++++++++++++++++++++
662 It supports the following commands: ``GET``.
667 Requests detailed information about the instance. An optional parameter,
668 ``static`` (bool), can be set to return only static information from the
669 configuration without querying the instance's nodes. The result will be
673 ``/2/instances/[instance_name]/reboot``
674 +++++++++++++++++++++++++++++++++++++++
676 Reboots URI for an instance.
678 It supports the following commands: ``POST``.
683 Reboots the instance.
685 The URI takes optional ``type=soft|hard|full`` and
686 ``ignore_secondaries=0|1`` parameters.
688 ``type`` defines the reboot type. ``soft`` is just a normal reboot,
689 without terminating the hypervisor. ``hard`` means full shutdown
690 (including terminating the hypervisor process) and startup again.
691 ``full`` is like ``hard`` but also recreates the configuration from
692 ground up as if you would have done a ``gnt-instance shutdown`` and
693 ``gnt-instance start`` on it.
695 ``ignore_secondaries`` is a bool argument indicating if we start the
696 instance even if secondary disks are failing.
698 It supports the ``dry-run`` argument.
701 ``/2/instances/[instance_name]/shutdown``
702 +++++++++++++++++++++++++++++++++++++++++
704 Instance shutdown URI.
706 It supports the following commands: ``PUT``.
711 Shutdowns an instance.
713 It supports the ``dry-run`` argument.
715 .. opcode_params:: OP_INSTANCE_SHUTDOWN
716 :exclude: instance_name, dry_run
719 ``/2/instances/[instance_name]/startup``
720 ++++++++++++++++++++++++++++++++++++++++
722 Instance startup URI.
724 It supports the following commands: ``PUT``.
731 The URI takes an optional ``force=1|0`` parameter to start the
732 instance even if secondary disks are failing.
734 It supports the ``dry-run`` argument.
736 ``/2/instances/[instance_name]/reinstall``
737 ++++++++++++++++++++++++++++++++++++++++++++++
739 Installs the operating system again.
741 It supports the following commands: ``POST``.
750 ``os`` (string, required)
751 Instance operating system.
752 ``start`` (bool, defaults to true)
753 Whether to start instance after reinstallation.
755 Dictionary with (temporary) OS parameters.
757 For backwards compatbility, this resource also takes the query
758 parameters ``os`` (OS template name) and ``nostartup`` (bool). New
759 clients should use the body parameters.
762 ``/2/instances/[instance_name]/replace-disks``
763 ++++++++++++++++++++++++++++++++++++++++++++++
765 Replaces disks on an instance.
767 It supports the following commands: ``POST``.
772 Takes the parameters ``mode`` (one of ``replace_on_primary``,
773 ``replace_on_secondary``, ``replace_new_secondary`` or
774 ``replace_auto``), ``disks`` (comma separated list of disk indexes),
775 ``remote_node`` and ``iallocator``.
777 Either ``remote_node`` or ``iallocator`` needs to be defined when using
778 ``mode=replace_new_secondary``.
780 ``mode`` is a mandatory parameter. ``replace_auto`` tries to determine
781 the broken disk(s) on its own and replacing it.
784 ``/2/instances/[instance_name]/activate-disks``
785 +++++++++++++++++++++++++++++++++++++++++++++++
787 Activate disks on an instance.
789 It supports the following commands: ``PUT``.
794 Takes the bool parameter ``ignore_size``. When set ignore the recorded
795 size (useful for forcing activation when recorded size is wrong).
798 ``/2/instances/[instance_name]/deactivate-disks``
799 +++++++++++++++++++++++++++++++++++++++++++++++++
801 Deactivate disks on an instance.
803 It supports the following commands: ``PUT``.
811 ``/2/instances/[instance_name]/disk/[disk_index]/grow``
812 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
814 Grows one disk of an instance.
816 Supports the following commands: ``POST``.
825 .. opcode_params:: OP_INSTANCE_GROW_DISK
826 :exclude: instance_name, disk
829 ``/2/instances/[instance_name]/prepare-export``
830 +++++++++++++++++++++++++++++++++++++++++++++++++
832 Prepares an export of an instance.
834 It supports the following commands: ``PUT``.
839 Takes one parameter, ``mode``, for the export mode. Returns a job ID.
842 ``/2/instances/[instance_name]/export``
843 +++++++++++++++++++++++++++++++++++++++++++++++++
847 It supports the following commands: ``PUT``.
856 .. opcode_params:: OP_BACKUP_EXPORT
857 :exclude: instance_name
858 :alias: target_node=destination
861 ``/2/instances/[instance_name]/migrate``
862 ++++++++++++++++++++++++++++++++++++++++
864 Migrates an instance.
866 Supports the following commands: ``PUT``.
875 .. opcode_params:: OP_INSTANCE_MIGRATE
876 :exclude: instance_name, live
879 ``/2/instances/[instance_name]/rename``
880 ++++++++++++++++++++++++++++++++++++++++
884 Supports the following commands: ``PUT``.
893 .. opcode_params:: OP_INSTANCE_RENAME
894 :exclude: instance_name
897 ``/2/instances/[instance_name]/modify``
898 ++++++++++++++++++++++++++++++++++++++++
900 Modifies an instance.
902 Supports the following commands: ``PUT``.
911 .. opcode_params:: OP_INSTANCE_SET_PARAMS
912 :exclude: instance_name
915 ``/2/instances/[instance_name]/console``
916 ++++++++++++++++++++++++++++++++++++++++
918 Request information for connecting to instance's console.
920 Supports the following commands: ``GET``.
925 Returns a dictionary containing information about the instance's
926 console. Contained keys:
931 Console type, one of ``ssh``, ``vnc`` or ``msg``.
933 Message to display (``msg`` type only).
935 Host to connect to (``ssh`` and ``vnc`` only).
937 TCP port to connect to (``vnc`` only).
939 Username to use (``ssh`` only).
941 Command to execute on machine (``ssh`` only)
943 VNC display number (``vnc`` only).
946 ``/2/instances/[instance_name]/tags``
947 +++++++++++++++++++++++++++++++++++++
949 Manages per-instance tags.
951 It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
956 Returns a list of tags.
960 ["tag1", "tag2", "tag3"]
967 The request as a list of strings should be ``PUT`` to this URI. The
968 result will be a job id.
970 It supports the ``dry-run`` argument.
978 In order to delete a set of tags, the DELETE request should be addressed
981 /tags?tag=[tag]&tag=[tag]
983 It supports the ``dry-run`` argument.
989 The ``/2/jobs`` resource.
991 It supports the following commands: ``GET``.
996 Returns a dictionary of jobs.
998 Returns: a dictionary with jobs id and uri.
1000 ``/2/jobs/[job_id]``
1001 ++++++++++++++++++++
1006 It supports the following commands: ``GET``, ``DELETE``.
1011 Returns a job status.
1013 Returns: a dictionary with job parameters.
1015 The result includes:
1017 - id: job ID as a number
1018 - status: current job status as a string
1019 - ops: involved OpCodes as a list of dictionaries for each opcodes in
1021 - opstatus: OpCodes status as a list
1022 - opresult: OpCodes results as a list
1024 For a successful opcode, the ``opresult`` field corresponding to it will
1025 contain the raw result from its :term:`LogicalUnit`. In case an opcode
1026 has failed, its element in the opresult list will be a list of two
1029 - first element the error type (the Ganeti internal error name)
1030 - second element a list of either one or two elements:
1032 - the first element is the textual error description
1033 - the second element, if any, will hold an error classification
1035 The error classification is most useful for the ``OpPrereqError``
1036 error type - these errors happen before the OpCode has started
1037 executing, so it's possible to retry the OpCode without side
1038 effects. But whether it make sense to retry depends on the error
1043 errors.ECODE_ALL == set([errors.ECODE_RESOLVER, errors.ECODE_NORES,
1044 errors.ECODE_INVAL, errors.ECODE_STATE, errors.ECODE_NOENT,
1045 errors.ECODE_EXISTS, errors.ECODE_NOTUNIQUE, errors.ECODE_FAULT,
1046 errors.ECODE_ENVIRON])
1048 :pyeval:`errors.ECODE_RESOLVER`
1049 Resolver errors. This usually means that a name doesn't exist in DNS,
1050 so if it's a case of slow DNS propagation the operation can be retried
1053 :pyeval:`errors.ECODE_NORES`
1054 Not enough resources (iallocator failure, disk space, memory,
1055 etc.). If the resources on the cluster increase, the operation might
1058 :pyeval:`errors.ECODE_INVAL`
1059 Wrong arguments (at syntax level). The operation will not ever be
1060 accepted unless the arguments change.
1062 :pyeval:`errors.ECODE_STATE`
1063 Wrong entity state. For example, live migration has been requested for
1064 a down instance, or instance creation on an offline node. The
1065 operation can be retried once the resource has changed state.
1067 :pyeval:`errors.ECODE_NOENT`
1068 Entity not found. For example, information has been requested for an
1071 :pyeval:`errors.ECODE_EXISTS`
1072 Entity already exists. For example, instance creation has been
1073 requested for an already-existing instance.
1075 :pyeval:`errors.ECODE_NOTUNIQUE`
1076 Resource not unique (e.g. MAC or IP duplication).
1078 :pyeval:`errors.ECODE_FAULT`
1079 Internal cluster error. For example, a node is unreachable but not set
1080 offline, or the ganeti node daemons are not working, etc. A
1081 ``gnt-cluster verify`` should be run.
1083 :pyeval:`errors.ECODE_ENVIRON`
1084 Environment error (e.g. node disk error). A ``gnt-cluster verify``
1087 Note that in the above list, by entity we refer to a node or instance,
1088 while by a resource we refer to an instance's disk, or NIC, etc.
1094 Cancel a not-yet-started job.
1097 ``/2/jobs/[job_id]/wait``
1098 +++++++++++++++++++++++++
1103 Waits for changes on a job. Takes the following body parameters in a
1107 The job fields on which to watch for changes.
1109 ``previous_job_info``
1110 Previously received field values or None if not yet available.
1112 ``previous_log_serial``
1113 Highest log serial number received so far or None if not yet
1116 Returns None if no changes have been detected and a dict with two keys,
1117 ``job_info`` and ``log_entries`` otherwise.
1125 It supports the following commands: ``GET``.
1130 Returns a list of all nodes.
1136 "id": "node1.example.com",
1137 "uri": "\/nodes\/node1.example.com"
1140 "id": "node2.example.com",
1141 "uri": "\/nodes\/node2.example.com"
1145 If the optional 'bulk' argument is provided and set to 'true' value (i.e
1146 '?bulk=1'), the output contains detailed information about nodes as a
1156 "name": "www.example.com",
1167 ``/2/nodes/[node_name]``
1168 +++++++++++++++++++++++++++++++++
1170 Returns information about a node.
1172 It supports the following commands: ``GET``.
1174 ``/2/nodes/[node_name]/evacuate``
1175 +++++++++++++++++++++++++++++++++
1177 Evacuates instances off a node.
1179 It supports the following commands: ``POST``.
1184 Returns a job ID. The result of the job will contain the IDs of the
1185 individual jobs submitted to evacuate the node.
1189 .. opcode_params:: OP_NODE_EVACUATE
1192 Up to and including Ganeti 2.4 query arguments were used. Those are no
1193 longer supported. The new request can be detected by the presence of the
1194 :pyeval:`rlib2._NODE_EVAC_RES1` feature string.
1197 ``/2/nodes/[node_name]/migrate``
1198 +++++++++++++++++++++++++++++++++
1200 Migrates all primary instances from a node.
1202 It supports the following commands: ``POST``.
1207 If no mode is explicitly specified, each instances' hypervisor default
1208 migration mode will be used. Body parameters:
1210 .. opcode_params:: OP_NODE_MIGRATE
1213 The query arguments used up to and including Ganeti 2.4 are deprecated
1214 and should no longer be used. The new request format can be detected by
1215 the presence of the :pyeval:`rlib2._NODE_MIGRATE_REQV1` feature string.
1218 ``/2/nodes/[node_name]/role``
1219 +++++++++++++++++++++++++++++
1223 It supports the following commands: ``GET``, ``PUT``.
1225 The role is always one of the following:
1232 Note that the 'master' role is a special, and currently it can't be
1233 modified via RAPI, only via the command line (``gnt-cluster
1239 Returns the current node role.
1248 Change the node role.
1250 The request is a string which should be PUT to this URI. The result will
1253 It supports the bool ``force`` argument.
1255 ``/2/nodes/[node_name]/storage``
1256 ++++++++++++++++++++++++++++++++
1258 Manages storage units on the node.
1265 constants.VALID_STORAGE_TYPES == set([constants.ST_FILE,
1266 constants.ST_LVM_PV,
1267 constants.ST_LVM_VG])
1269 Requests a list of storage units on a node. Requires the parameters
1270 ``storage_type`` (one of :pyeval:`constants.ST_FILE`,
1271 :pyeval:`constants.ST_LVM_PV` or :pyeval:`constants.ST_LVM_VG`) and
1272 ``output_fields``. The result will be a job id, using which the result
1275 ``/2/nodes/[node_name]/storage/modify``
1276 +++++++++++++++++++++++++++++++++++++++
1278 Modifies storage units on the node.
1283 Modifies parameters of storage units on the node. Requires the
1284 parameters ``storage_type`` (one of :pyeval:`constants.ST_FILE`,
1285 :pyeval:`constants.ST_LVM_PV` or :pyeval:`constants.ST_LVM_VG`)
1286 and ``name`` (name of the storage unit). Parameters can be passed
1287 additionally. Currently only :pyeval:`constants.SF_ALLOCATABLE` (bool)
1288 is supported. The result will be a job id.
1290 ``/2/nodes/[node_name]/storage/repair``
1291 +++++++++++++++++++++++++++++++++++++++
1293 Repairs a storage unit on the node.
1300 constants.VALID_STORAGE_OPERATIONS == {
1301 constants.ST_LVM_VG: set([constants.SO_FIX_CONSISTENCY]),
1304 Repairs a storage unit on the node. Requires the parameters
1305 ``storage_type`` (currently only :pyeval:`constants.ST_LVM_VG` can be
1306 repaired) and ``name`` (name of the storage unit). The result will be a
1309 ``/2/nodes/[node_name]/tags``
1310 +++++++++++++++++++++++++++++
1312 Manages per-node tags.
1314 It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
1319 Returns a list of tags.
1323 ["tag1", "tag2", "tag3"]
1330 The request as a list of strings should be PUT to this URI. The result
1333 It supports the ``dry-run`` argument.
1340 In order to delete a set of tags, the DELETE request should be addressed
1343 /tags?tag=[tag]&tag=[tag]
1345 It supports the ``dry-run`` argument.
1348 ``/2/query/[resource]``
1349 +++++++++++++++++++++++
1351 Requests resource information. Available fields can be found in man
1352 pages and using ``/2/query/[resource]/fields``. The resource is one of
1353 :pyeval:`utils.CommaJoin(constants.QR_VIA_RAPI)`. See the :doc:`query2
1354 design document <design-query2>` for more details.
1356 Supports the following commands: ``GET``, ``PUT``.
1361 Returns list of included fields and actual data. Takes a query parameter
1362 named "fields", containing a comma-separated list of field names. Does
1363 not support filtering.
1368 Returns list of included fields and actual data. The list of requested
1369 fields can either be given as the query parameter "fields" or as a body
1370 parameter with the same name. The optional body parameter "filter" can
1371 be given and must be either ``null`` or a list containing filter
1375 ``/2/query/[resource]/fields``
1376 ++++++++++++++++++++++++++++++
1378 Request list of available fields for a resource. The resource is one of
1379 :pyeval:`utils.CommaJoin(constants.QR_VIA_RAPI)`. See the
1380 :doc:`query2 design document <design-query2>` for more details.
1382 Supports the following commands: ``GET``.
1387 Returns a list of field descriptions for available fields. Takes an
1388 optional query parameter named "fields", containing a comma-separated
1389 list of field names.
1397 It supports the following commands: ``GET``.
1402 Return a list of all OSes.
1404 Can return error 500 in case of a problem. Since this is a costly
1405 operation for Ganeti 2.0, it is not recommended to execute it too often.
1414 Manages cluster tags.
1416 It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
1421 Returns the cluster tags.
1425 ["tag1", "tag2", "tag3"]
1432 The request as a list of strings should be PUT to this URI. The result
1435 It supports the ``dry-run`` argument.
1443 In order to delete a set of tags, the DELETE request should be addressed
1446 /tags?tag=[tag]&tag=[tag]
1448 It supports the ``dry-run`` argument.
1454 The version resource.
1456 This resource should be used to determine the remote API version and to
1457 adapt clients accordingly.
1459 It supports the following commands: ``GET``.
1464 Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0
1467 .. vim: set textwidth=72 :