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

Re: [Xen-devel] Getting domain information in xen 3.0.4-1


  • From: Thomas Goirand <thomas@xxxxxxxxxx>
  • Date: Mon, 02 Apr 2007 21:37:51 +0800
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 04 Apr 2007 03:46:33 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Openpgp: id=98EF9A49

Ewan Mellor wrote:
> On Sat, Mar 31, 2007 at 03:29:04AM +0800, Thomas Goirand wrote:
> 
>> import xen.xm.main as xenxm
>> try:
>>      if xen_version == 3:
>>              info = xenxm.server.xend.domain(vpsname)
>>              return info
>>      else:
>>              info = xenxm.server.xend_domain(vpsname)
>>              return info
>>
>> The problem is that if I try this:
>> print xenxm.server.xend.domain( 'xen01' )
>>
>> python returns: object has no attribute 'xend'
>>
>> and if I try this:
>> print xenxm.server.xend_domain( 'xen01' )
>>
>> python returns: object has no attribute 'xend_domain'
>
> Firstly, no, that's not meant to be your programming interface!  You are
> delving into the internals of xm, the command line interface, and pulling an
> internal variable (server) and expecting that to be the thing that you want.
> This certainly isn't supported, and it wouldn't be surprising if it broke at
> any time.

Yes, but as the XenAPI is not released yet... no choice! And spawning a
new process for every command is quite a bad idea. So even if it breaks,
SOMETIMES, then it's still better.

> That said, I don't think that it's the cause of your problem.  It sounds to me
> like something more fundamental is at fault -- that xenxm.server object that
> you are dereferencing is a "magic" object, and so the xend.domain() call is
> actually being proxied through as a call to Xend.  It's possible that your
> server is at fault, rather than your client.

I have found the solution in fact! :)
It took me quite a long time to do it, but now I have found it. The
following code DO work:

#!/usr/bin/env python

import sys
sys.path.append( '/usr/lib/python' )
from xen.xend.XendClient import server
print server.xend.domain('xen01')

>> Last: as far as I could see, the Xen API is still not ready, right?
> 
> It will be released as Xen-API 1.0 in Xen 3.0.5, which will happen in the next
> couple of weeks.

Great. I'd love to have something for the long therms using this API.
Where can I found the feature list? GPLHost would be one of the big
users of this API if it has the things we need!

Thomas Goirand

P.S: For those that are interested in it, I'll try to send the patched
version of dtc-xen to Debian SID asap.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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