|
|
|
|
|
|
|
|
|
|
xen-api
Re: [Xen-API] trying to get some data out of XenAPI
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
|
|
|
|
|