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-devel

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

Subject: 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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070402124217.GC28728@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Openpgp: id=98EF9A49
Organization: GPLHost
References: <460D6500.5000403@xxxxxxxxxx> <20070402124217.GC28728@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.4 (X11/20060722)
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

<Prev in Thread] Current Thread [Next in Thread>