* remote xend - howto connect??
@ 2006-02-06 14:56 Michael Mey
2006-02-07 3:02 ` Anthony Liguori
0 siblings, 1 reply; 3+ messages in thread
From: Michael Mey @ 2006-02-06 14:56 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 2867 bytes --]
Hi,
currently, I am planning to implement a command line based tool to query more
than one xends for their running domains at the same time.
Unfortunately, I cannot connect to any other xend as the local one. This is
what I was trying to do:
----------------------------------------------------------------------------------------------------
#!/usr/bin/env python
# -*- mode: python; -*-
import sys
import os
# add fallback path for non-native python path installs if needed
sys.path.append('/usr/lib/python')
sys.path.append('/usr/lib64/python')
from xen.xend.XendClient import server
from xen.xend import sxp
def parse_doms_info(info):
def get_info(n, t, d):
return t(sxp.child_value(info, n, d))
return {
'dom' : get_info('domid', int, -1),
'name' : get_info('name', str, '??'),
'mem' : get_info('memory', int, 0),
'vcpus' : get_info('online_vcpus', int, 0),
'state' : get_info('state', str, '??'),
'cpu_time' : get_info('cpu_time', float, 0),
'ssidref' : get_info('ssidref', int, 0),
}
def xm_brief_list(doms):
print 'Name ID Mem(MiB) VCPUs State Time(s)'
for dom in doms:
d = parse_doms_info(dom)
if (d['ssidref'] != 0):
d['ssidstr'] = (" s:%04x/p:%04x" %
((d['ssidref'] >> 16) & 0xffff,
d['ssidref'] & 0xffff))
else:
d['ssidstr'] = ""
print ("%(name)-32s %(dom)3d %(mem)8d %(vcpus)5d %(state)5s
%(cpu_time)7.1f%(ssidstr)s" % d)
server.bind('192.168.111.18:8000',)
xm_brief_list(server.xend_list_domains())
----------------------------------------------------------------------------------------------------
I am running this script form my xenhost1 (192.168.111.17) and want to query
xenhost2 (192.168.111.18). But I only get the local informations.
Even if I manually hack
class Xend:
"""Client interface to Xend.
"""
"""Default location of the xend server."""
SRV_DEFAULT = "192.168.111.18:8000"
into xen/xend/XendClient.py it's still the same.
telnetting to 192.168.111.18 to port 8000 and do a manual
GET /xend/domain/?detail=1
works nicely.
Maybe someone could give me a hint how to query a remote xen host with
XendClient.py?
Regards, Michael
--
----------------------------------------------------------------------------------------
Michael Mey
Thinking Objects Software GmbH | mailto: michael.mey@to.com
Lilienthalstrasse 2/1 | phone: +49 711 88770-147
70825 Stuttgart-Korntal, Germany | fax: +49 711 88770-449
----------------------------------------------------------------------------------------
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: remote xend - howto connect??
2006-02-06 14:56 remote xend - howto connect?? Michael Mey
@ 2006-02-07 3:02 ` Anthony Liguori
2006-02-07 9:14 ` Michael Mey
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2006-02-07 3:02 UTC (permalink / raw)
To: Michael Mey; +Cc: xen-devel
Michael Mey wrote:
> Hi,
>
> currently, I am planning to implement a command line based tool to query more
> than one xends for their running domains at the same time.
>
> Unfortunately, I cannot connect to any other xend as the local one. This is
> what I was trying to do:
>
> ----------------------------------------------------------------------------------------------------
> #!/usr/bin/env python
> # -*- mode: python; -*-
> import sys
> import os
>
> # add fallback path for non-native python path installs if needed
> sys.path.append('/usr/lib/python')
> sys.path.append('/usr/lib64/python')
>
> from xen.xend.XendClient import server
>
from xen.xend.XendClient import getHttpServer
server = getHttpServer(...)
Of course, I'm not sure works all that well either.
I'd recommend using libvir (http://www.libvir.org). libvir speaks the
S-Expression/HTTP protocol pretty well. It also has python bindings.
Regards,
Anthony Liguori
> from xen.xend import sxp
>
> def parse_doms_info(info):
> def get_info(n, t, d):
> return t(sxp.child_value(info, n, d))
> return {
> 'dom' : get_info('domid', int, -1),
> 'name' : get_info('name', str, '??'),
> 'mem' : get_info('memory', int, 0),
> 'vcpus' : get_info('online_vcpus', int, 0),
> 'state' : get_info('state', str, '??'),
> 'cpu_time' : get_info('cpu_time', float, 0),
> 'ssidref' : get_info('ssidref', int, 0),
> }
>
> def xm_brief_list(doms):
> print 'Name ID Mem(MiB) VCPUs State Time(s)'
> for dom in doms:
> d = parse_doms_info(dom)
> if (d['ssidref'] != 0):
> d['ssidstr'] = (" s:%04x/p:%04x" %
> ((d['ssidref'] >> 16) & 0xffff,
> d['ssidref'] & 0xffff))
> else:
> d['ssidstr'] = ""
> print ("%(name)-32s %(dom)3d %(mem)8d %(vcpus)5d %(state)5s
> %(cpu_time)7.1f%(ssidstr)s" % d)
>
>
> server.bind('192.168.111.18:8000',)
> xm_brief_list(server.xend_list_domains())
> ----------------------------------------------------------------------------------------------------
>
> I am running this script form my xenhost1 (192.168.111.17) and want to query
> xenhost2 (192.168.111.18). But I only get the local informations.
> Even if I manually hack
>
> class Xend:
> """Client interface to Xend.
> """
>
> """Default location of the xend server."""
> SRV_DEFAULT = "192.168.111.18:8000"
>
> into xen/xend/XendClient.py it's still the same.
>
> telnetting to 192.168.111.18 to port 8000 and do a manual
> GET /xend/domain/?detail=1
> works nicely.
>
> Maybe someone could give me a hint how to query a remote xen host with
> XendClient.py?
>
>
> Regards, Michael
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: remote xend - howto connect??
2006-02-07 3:02 ` Anthony Liguori
@ 2006-02-07 9:14 ` Michael Mey
0 siblings, 0 replies; 3+ messages in thread
From: Michael Mey @ 2006-02-07 9:14 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 4056 bytes --]
On Tuesday 07 February 2006 04:02, Anthony Liguori wrote:
> Michael Mey wrote:
> > Hi,
> >
> > currently, I am planning to implement a command line based tool to query
> > more than one xends for their running domains at the same time.
> >
> > Unfortunately, I cannot connect to any other xend as the local one. This
> > is what I was trying to do:
> >
> > -------------------------------------------------------------------------
> >--------------------------- #!/usr/bin/env python
> > # -*- mode: python; -*-
> > import sys
> > import os
> >
> > # add fallback path for non-native python path installs if needed
> > sys.path.append('/usr/lib/python')
> > sys.path.append('/usr/lib64/python')
> >
> > from xen.xend.XendClient import server
>
> from xen.xend.XendClient import getHttpServer
>
> server = getHttpServer(...)
>
> Of course, I'm not sure works all that well either.
>
> I'd recommend using libvir (http://www.libvir.org). libvir speaks the
> S-Expression/HTTP protocol pretty well. It also has python bindings.
Thank you, I'll give it a try and otherwise have a look at libvir. :)
Regards,
Michael
> Regards,
>
> Anthony Liguori
>
> > from xen.xend import sxp
> >
> > def parse_doms_info(info):
> > def get_info(n, t, d):
> > return t(sxp.child_value(info, n, d))
> > return {
> > 'dom' : get_info('domid', int, -1),
> > 'name' : get_info('name', str, '??'),
> > 'mem' : get_info('memory', int, 0),
> > 'vcpus' : get_info('online_vcpus', int, 0),
> > 'state' : get_info('state', str, '??'),
> > 'cpu_time' : get_info('cpu_time', float, 0),
> > 'ssidref' : get_info('ssidref', int, 0),
> > }
> >
> > def xm_brief_list(doms):
> > print 'Name ID Mem(MiB) VCPUs State
> > Time(s)' for dom in doms:
> > d = parse_doms_info(dom)
> > if (d['ssidref'] != 0):
> > d['ssidstr'] = (" s:%04x/p:%04x" %
> > ((d['ssidref'] >> 16) & 0xffff,
> > d['ssidref'] & 0xffff))
> > else:
> > d['ssidstr'] = ""
> > print ("%(name)-32s %(dom)3d %(mem)8d %(vcpus)5d %(state)5s
> > %(cpu_time)7.1f%(ssidstr)s" % d)
> >
> >
> > server.bind('192.168.111.18:8000',)
> > xm_brief_list(server.xend_list_domains())
> > -------------------------------------------------------------------------
> >---------------------------
> >
> > I am running this script form my xenhost1 (192.168.111.17) and want to
> > query xenhost2 (192.168.111.18). But I only get the local informations.
> > Even if I manually hack
> >
> > class Xend:
> > """Client interface to Xend.
> > """
> >
> > """Default location of the xend server."""
> > SRV_DEFAULT = "192.168.111.18:8000"
> >
> > into xen/xend/XendClient.py it's still the same.
> >
> > telnetting to 192.168.111.18 to port 8000 and do a manual
> > GET /xend/domain/?detail=1
> > works nicely.
> >
> > Maybe someone could give me a hint how to query a remote xen host with
> > XendClient.py?
> >
> >
> > Regards, Michael
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
--
----------------------------------------------------------------------------------------
Michael Mey
Thinking Objects Software GmbH | mailto: michael.mey@to.com
Lilienthalstrasse 2/1 | phone: +49 711 88770-147
70825 Stuttgart-Korntal, Germany | fax: +49 711 88770-449
----------------------------------------------------------------------------------------
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-02-07 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-06 14:56 remote xend - howto connect?? Michael Mey
2006-02-07 3:02 ` Anthony Liguori
2006-02-07 9:14 ` Michael Mey
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.