<title>Ganeti remote API</title>
</articleinfo>
-<para>Documents Ganeti version 1.2</para>
+<para>Documents Ganeti version 2.0</para>
<sect1>
<title>Introduction</title>
- <para>Ganeti supports a remote API for enable external tools to easily
- retrieve information about a cluster's state. The remote API daemon,
- <computeroutput>ganeti-rapi</computeroutput>, is automatically started on
- the master node if the <computeroutput>--enable-rapi</computeroutput>
- parameter is passed to the <computeroutput>configure</computeroutput>
- script. Alternatively you can start it manually. By default it runs on TCP
- port 5080, but this can be changed either in
- <filename>…/constants.py</filename> or via the command line
- parameter <computeroutput>-p</computeroutput>. SSL support can also be
- enabled by passing command line parameters.</para>
+ <para>Ganeti supports a remote API for enable external tools to
+ easily retrieve information about a cluster's state. The remote API
+ daemon, <command>ganeti-rapi</command>, is automatically started on
+ the master node. By default it runs on TCP port 5080, but this can
+ be changed either in <filename>…/constants.py</filename> or
+ via the command line parameter <option>-p</option>. SSL support can
+ also be enabled by passing command line parameters.</para>
- <note>
- <para>Ganeti 1.2 only supports a limited set of calls, all of them
- read-only. The next major version will have support for write
- operations.</para>
- </note>
</sect1>
<sect1>
- <title>Protocol</title>
+ <title>Protocol</title>
<para>The protocol used is <ulink url="&JsonLink;">JSON</ulink> over HTTP
designed after the <ulink url="&WikipediaRESTLink;">REST</ulink> principle.
as it supports network connections.</para>
<sect2>
- <title>Shell</title>
- <screen>wget -q -O - http://<replaceable>CLUSTERNAME</replaceable>:5080/info</screen>
+ <title>Shell</title>
+ <screen>wget -q -O - https://<replaceable>CLUSTERNAME</replaceable>:5080/2/info</screen>
+ <para>or</para>
+ <screen>curl https://<replaceable>CLUSTERNAME</replaceable>:5080/2/info</screen>
</sect2>
<sect2>
<title>Python</title>
<screen>import urllib2
-f = urllib2.urlopen('http://<replaceable>CLUSTERNAME</replaceable>:5080/info')
+f = urllib2.urlopen('https://<replaceable>CLUSTERNAME</replaceable>:5080/info')
print f.read()</screen>
</sect2>
or different domain names. Fetching the data on the webserver is
easier.</para>
</note>
- <screen>var url = 'http://<replaceable>CLUSTERNAME</replaceable>:5080/info';
+ <screen>var url = 'https://<replaceable>CLUSTERNAME</replaceable>:5080/info';
var info;
var xmlreq = new XMLHttpRequest();
Example::
- {
- "config_version": 3,
- "name": "cluster1.example.com",
- "software_version": "1.2.4",
- "os_api_version": 5,
- "export_version": 0,
- "master": "node1.example.com",
- "architecture": [
- "64bit",
- "x86_64"
- ],
- "hypervisor_type": "xen-pvm",
- "protocol_version": 12
+ {
+ "config_version": 2000000,
+ "name": "cluster",
+ "software_version": "2.0.0~beta1",
+ "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
+ }
+ }
}
"""
[
{
"status": "running",
- "bridge": "xen-br0",
+ "disk_usage": 20480,
+ "nic.bridges": [
+ "xen-br0"
+ ],
"name": "web.example.com",
"tags": ["tag1", "tag2"],
- "admin_ram": 512,
- "sda_size": 20480,
+ "beparams": {
+ "vcpus": 2,
+ "memory": 512
+ },
+ "disk.sizes": [
+ 20480
+ ],
"pnode": "node1.example.com",
- "mac": "01:23:45:67:89:01",
- "sdb_size": 4096,
+ "nic.macs": ["01:23:45:67:89:01"],
"snodes": ["node2.example.com"],
"disk_template": "drbd",
- "ip": null,
"admin_state": true,
"os": "debian-etch",
- "vcpus": 2,
"oper_state": true
},
...