which is used by default, can also be disabled by passing command line
parameters.
+.. _rapi-users:
Users and passwords
-------------------
jessica {HA1}7046452df2cbb530877058712cf17bd4 write
# Monitoring can query for values
- monitoring {HA1}ec018ffe72b8e75bb4d508ed5b6d079c query
+ monitoring {HA1}ec018ffe72b8e75bb4d508ed5b6d079c read
- # A user who can query and write
- superuser {HA1}ec018ffe72b8e75bb4d508ed5b6d079c query,write
+ # A user who can read and write (the former is implied by granting
+ # write access)
+ superuser {HA1}ec018ffe72b8e75bb4d508ed5b6d079c read,write
+When using the RAPI, username and password can be sent to the server
+by using the standard HTTP basic access authentication. This means that
+for accessing the protected URL ``https://cluster.example.com/resource``,
+the address ``https://username:password@cluster.example.com/resource`` should
+be used instead. Alternatively, the appropriate parameter of your HTTP client
+(such as ``-u`` for ``curl``) can be used.
.. [#pwhash] Using the MD5 hash of username, realm and password is
described in :rfc:`2617` ("HTTP Authentication"), sections 3.2.2.2
.. highlight:: shell-example
-Using wget::
+Using ``wget``::
$ wget -q -O - https://%CLUSTERNAME%:5080/2/info
-or curl::
+or ``curl``::
$ curl https://%CLUSTERNAME%:5080/2/info
+Note: with ``curl``, the request method (GET, POST, PUT) can be specified
+using the ``-X`` command line option, and the username/password can be
+specified with the ``-u`` option. In case of POST requests with a body, the
+Content-Type can be set to JSON (as per the Protocol_ section) using the
+parameter ``-H "Content-Type: application/json"``.
Python
++++++
"vcpus": 1,
"memory": 128
}
- }
- }
+ },
+ …
+ }
``/2/redistribute-config``
"node1.example.com",
"node2.example.com"
],
- "uuid": "0d7d407c-262e-49af-881a-6a430034bf43"
+ "uuid": "0d7d407c-262e-49af-881a-6a430034bf43",
+ …
},
{
"name": "group2",
"node_list": [
"node3.example.com"
],
- "uuid": "f5a277e7-68f9-44d3-a378-4b25ecb5df5c"
- }
+ "uuid": "f5a277e7-68f9-44d3-a378-4b25ecb5df5c",
+ …
+ },
+ …
]
``POST``
'name': 'nat',
'network': '10.0.0.0/28',
'network6': None,
- 'network_type': 'private',
'reserved_count': 3,
- 'tags': ['nfdhcpd']
+ 'tags': ['nfdhcpd'],
+ …
},
+ …
]
``POST``
[
{
- "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
+ "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,
+ …
},
- ...
+ …
]
errors.ECODE_ALL == set([errors.ECODE_RESOLVER, errors.ECODE_NORES,
errors.ECODE_INVAL, errors.ECODE_STATE, errors.ECODE_NOENT,
errors.ECODE_EXISTS, errors.ECODE_NOTUNIQUE, errors.ECODE_FAULT,
- errors.ECODE_ENVIRON])
+ errors.ECODE_ENVIRON, errors.ECODE_TEMP_NORES])
:pyeval:`errors.ECODE_RESOLVER`
Resolver errors. This usually means that a name doesn't exist in DNS,
etc.). If the resources on the cluster increase, the operation might
succeed.
+:pyeval:`errors.ECODE_TEMP_NORES`
+ Simliar to :pyeval:`errors.ECODE_NORES`, but indicating the operation
+ should be attempted again after some time.
+
:pyeval:`errors.ECODE_INVAL`
Wrong arguments (at syntax level). The operation will not ever be
accepted unless the arguments change.
"dtotal": 5246208,
"sinst_cnt": 2,
"dfree": 5171712,
- "offline": false
+ "offline": false,
+ …
},
- ...
+ …
]
``/2/nodes/[node_name]``