WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: Tom Wilkie <tom.wilkie@xxxxxxxxx>
Subject: Re: [Xen-API] trying to get some data out of XenAPI
From: "Henning Sprang" <henning_sprang@xxxxxx>
Date: Sun, 27 May 2007 22:37:10 +0200
Cc: xen-api@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sun, 27 May 2007 13:35:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <EF8F5294-F347-4C89-8855-52294D691969@xxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <20070527184831.219870@xxxxxxx> <EF8F5294-F347-4C89-8855-52294D691969@xxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
> 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.


> 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