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

Re: [Xen-API] trying to get some data out of XenAPI


  • To: "Henning Sprang" <henning_sprang@xxxxxx>
  • From: Tom Wilkie <tom.wilkie@xxxxxxxxx>
  • Date: Sun, 27 May 2007 21:44:42 +0100
  • Cc: xen-api@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Sun, 27 May 2007 13:42:42 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:x-priority:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=gjVudk5k0WPU6fOt0fMkKxIAuEpVond3oZsFaEWNbZv0T2eWoScPdvcmMIeuzsopqkPE1nECBXA8jXlbAo8RAln2gfGEf4o957Zy2aLqWOAZ0kA3nPK3t7DNIBIZdsTBxS8XEhYZjsb58fS+WNP391lX36UPIKG6Vl98a5X3Ur0=
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

The python bindings 'magically' put in the session variable for you.

Is the Python API documented somewhere? I can't find all the stuff from the RPC docs in the Python sources. And it's quite hard to figure the python stuff out from the xml rpc descriptions.

The python API works reflectively, so it doesn't actually declare any of the api. I don't think theres any documentation, but if you look in tools/python/xen/xm/main.py it should show see how xm sets up its xenapi connection. And theres the language independent XenAPI docs in docs/xen-api or on the wiki.

If you want to get started quickly I wrote some java bindings with a simple example and javadocs which might help - http:// www.cl.cam.ac.uk/~tw275/

Cheers

Tom

Give it a try without passing the session variable to VM.get_record.

Also, print out the vm_list variable and check its a list of uuids.

Now I have:

#!/usr/bin/python

import sys
sys.path.append('/usr/lib/python')
from xen.xm.XenAPI import Session
session = Session('http://localhost:9363/')
session.login_with_password(' ', ' ')
print session
host_ref = session.get_this_host
vm_list = session.xenapi.VM.get_all()
print vm_list
for vm_ref in vm_list:
        vm_record = session.xenapi.VM.get_record(vm_ref)
        print vm_record
        print "VM name:" + vm_record["name_label"]


I'll see how far I can come with this. I guess it will take me some fiddling to find the measures I want to have. It's quite hard to get through this currently...

Henning


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


 


Rackspace

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