From bf4a90afe25a7357b9e544bf8d3ad0c22dfcf673 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 13 Feb 2009 16:17:05 +0000 Subject: [PATCH] RAPI: documentation updates This patch fixes the version and does some update to the RAPI resources docs. Reviewed-by: imsnah --- doc/rapi.sgml | 36 +++++++++++--------------- lib/rapi/connector.py | 2 +- lib/rapi/rlib2.py | 59 ++++++++++++++++++++++++++++--------------- 3 files changed, 55 insertions(+), 42 deletions(-) diff --git a/doc/rapi.sgml b/doc/rapi.sgml index 12e7e556b..4f8e08a5f 100644 --- a/doc/rapi.sgml +++ b/doc/rapi.sgml @@ -8,31 +8,23 @@ <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. @@ -46,14 +38,16 @@ 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> @@ -65,7 +59,7 @@ print f.read()</screen> 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(); diff --git a/lib/rapi/connector.py b/lib/rapi/connector.py index 0d3a961ce..fcc4f2d4e 100644 --- a/lib/rapi/connector.py +++ b/lib/rapi/connector.py @@ -134,7 +134,7 @@ def _getResources(id): class R_2(baserlib.R_Generic): - """ /2 resourse. + """ /2 resource, the root of the version 2 API. """ DOC_URI = "/2" diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index 1566e1d92..4b8e8c829 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -74,19 +74,33 @@ class R_2_info(baserlib.R_Generic): 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 + } + } } """ @@ -284,20 +298,25 @@ class R_2_instances(baserlib.R_Generic): [ { "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 }, ... -- GitLab