[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-API] Diferences in Xen API languages bindings ou implementations?



Hi Erick,

XenAPI.py is a thin layer on top of the raw XMLRPC which hides some aspects of 
the session handling and error checking. I don't think it's documented anywhere 
as far as I know, so figuring out how to get some things to work involves 
looking at the source. I often use the standard 'xmlrpclib' module instead, 
which you might find is closer to the documented API.

For reference, here's how to call session.get_this_host using both libraries:

First, using XenAPI.py:

import XenAPI
session = XenAPI.Session("http://localhost/";)
session.login_with_password("root","myultrasecurepassword")
session.xenapi.session.get_this_host(session._session)


Secondly, using xmlrpclib:

import xmlrpclib
s=xmlrpclib.Server("http://localhost/";)
session_ref=s.session.login_with_password("root","myultrasecurepassword")['Value']
s.session.get_this_host(session_ref,session_ref)['Value']

Hope this helps!

Jon

On 15 Sep 2010, at 22:17, Erick Gomes wrote:

> Hi,
> 
> I'm new in Xen and here.
> 
> I have studied the Xen API and some questions happened, but i will try 
> to resume all in one question:
> 
> I understood that the xenapi is like an set of XML-RPC's that can be 
> used as libraries for some languages, like XenAPI.py, etc. My question 
> is, there are any possibility that the implementation of those libraries 
> doesn't implement the full capabilities of Xen Management API? Or there 
> are diferentes APIs implementations?
> 
> I sad this because i am try to execute "session.get_this_host(session 
> id, session ref)" using XenAPI.py or directly using xmlrpclib for 
> python, and only with the xmlrpc i can execute with sucess.
> 
> 
> Thank's
> Erick
> 
> <ATT00001..txt>


_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.