Ewan Mellor wrote:
> On Sat, Mar 31, 2007 at 03:29:04AM +0800, Thomas Goirand wrote:
>> import xen.xm.main as xenxm
>> if xen_version == 3:
>> info = xenxm.server.xend.domain(vpsname)
>> return info
>> 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:
sys.path.append( '/usr/lib/python' )
from xen.xend.XendClient import server
>> 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!
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