Skip to contentSkip to conversation

Accessing Xen on remote machine

DISCUSSION jd sw 2 participants 5 messages Jun 26, 2006 – Jun 30, 2006

lore
Share & tools
lore

jd sw

author
#0 lore raw

Hi
What do I need to do to access Xen on a remote machine ? Currently my program is using the 'server' object from the XendClient.py.

There seems to be http, unix, tcp-xmlrpc, unix-xmlrpc servers. When should each one of them be enabled/used. What port do they listen to ? Also, relocation server uses which protocol. I would really appreciate if someone can point me to some document/details.

Check out the details on what I tried below.

Thanks
/Jd
--------
# test code
s = ServerProxy("http://192.168.0.103:8000/xend", None, None, 1, 1) domain_list = s.xend.domains(0)
print domain_list

-----------
Output
--------connect: (192.168.0.103, 8000)
send: 'POST /xend HTTP/1.0\r\nHost: 192.168.0.103:8000\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length: 151\r\n\r\n'
send: "<?xml version='1.0'?>\n<methodCall>\n<methodName>xend.domains</methodName>\n<params>\n<param>\n<value><int>0</int></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-length: 4
header: Expires: -1
header: Content-type: text/plain
header: Pragma: no-cache
header: Cache-control: no-cache
body: 'POST'
Traceback (most recent call last):
File "test.py", line 143, in ?

    main()
  File "test.py", line 88, in main
    domain_list = s.xend.domains(0)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.4/site-packages/xen/util/xmlrpclib2.py", line 83, in __request
    response = xmlrpclib.ServerProxy.__request(self, methodname, params)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1284, in _parse_response
    p.close()
  File "/usr/lib/python2.4/xmlrpclib.py", line 530, in close
    self._parser.Parse("", 1) # end of data

xml.parsers.expat.ExpatError: syntax error: line 1, column 0

---------------------------------
Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · jd sw

Hi
What do I need to do to access Xen on a remote machine ? Currently my
program is using the 'server' object from the XendClient.py.

There seems to be http, unix, tcp-xmlrpc, unix-xmlrpc servers. When
should each one of them be enabled/used. What port do they listen to ?

http and unix are s-expressions or HTML pages over HTTP/TCP or HTTP over Unix domain sockets respectively. These are deprecated.

tcp-xmlrpc and unix-xmlrpc is XML-RPC over HTTP/TCP or HTTP/Unix respectively. These are what you want to use. You can:

a) use unix-xmlrpc, with Anthony Liguori's recent patch to transparently SSH into your local machine and issue commands to the Unix socket. This uses your SSH authentication scheme. See xm serve for details.

b) enable and use tcp-xmlrpc, using the attached patch. This will listen on port 8005, and will use no authentication / encryption at all (SSL support is planned). Only use this on a secure network, obviously.

Quoted 2 lines

Also, relocation server uses which protocol. I would really appreciate if someone can point me to some document/details.

It's a proprietary protocol -- a small handshake and exchange of VM config, and then a dump of all the pages in memory. You'll have to dig into the code for details -- tools/python/xen/xend/{XendCheckpoint,XendDomainInfo}.py and tools/libxc/xc_linux_save.c should start you off.

Ewan.

tools/python/xen/xend/XendClient.py +1 -1
diff -r 187180382772 tools/python/xen/xend/XendClient.py
@@ -25,4 +25,4 @@ ERROR_GENERIC = 2
 ERROR_GENERIC = 2
 ERROR_INVALID_DOMAIN = 3
 
-server = ServerProxy('httpu:///var/run/xend/xmlrpc.sock')
+server = ServerProxy('http://<your server name here>:8005/RPC2')
tools/python/xen/xend/server/XMLRPCServer.py +1 -1
diff -r 187180382772 tools/python/xen/xend/server/XMLRPCServer.py
@@ -89,7 +89,7 @@ class XMLRPCServer:
         if self.use_tcp:
             # bind to something fixed for now as we may eliminate
             # tcp support completely.
-            self.server = TCPXMLRPCServer(("localhost", 8005), logRequests=False)
+            self.server = TCPXMLRPCServer(('', 8005), logRequests=False)
         else:
             self.server = UnixXMLRPCServer(XML_RPC_SOCKET, False)
 
tools/examples/xend-config.sxp +1 -1
diff -r 187180382772 tools/examples/xend-config.sxp
@@ -16,7 +16,7 @@
 
 #(xend-http-server no)
 #(xend-unix-server no)
-#(xend-tcp-xmlrpc-server no)
+(xend-tcp-xmlrpc-server yes)
 #(xend-unix-xmlrpc-server yes)
 #(xend-relocation-server no)
 (xend-relocation-server yes)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#2 lore raw

Thanks much. I really appreciate the prompt reply. I tried the tcp-xml rpc and it worked. (I will look in to Unix based scheme next)

Now, with the modification I can get stats, stop, kill remote vm. I have couple of related questions..

a. How do I start a VM on a remote machine, given a (remote or local) conf file . (currently for local machine I use xen.xm.create.main(filename) )

b. Is it possible to get console of a remote domu ? currently I am spawning, xm console with domid which works locally but not for remote doms.

c. Is it possible to save snapshot of a remote dom on a local machine directly? (This is similar to migrating to local machine and saving snapshot.)

Thanks in advance.
/Jd

Quoted 6 lines · jd sw

Hi
What do I need to do to access Xen on a remote machine ? Currently my
program is using the 'server' object from the XendClient.py.

There seems to be http, unix, tcp-xmlrpc, unix-xmlrpc servers. When
should each one of them be enabled/used. What port do they listen to ?

http and unix are s-expressions or HTML pages over HTTP/TCP or HTTP over Unix domain sockets respectively. These are deprecated.

tcp-xmlrpc and unix-xmlrpc is XML-RPC over HTTP/TCP or HTTP/Unix respectively. These are what you want to use. You can:

a) use unix-xmlrpc, with Anthony Liguori's recent patch to transparently SSH into your local machine and issue commands to the Unix socket. This uses your SSH authentication scheme. See xm serve for details.

b) enable and use tcp-xmlrpc, using the attached patch. This will listen on port 8005, and will use no authentication / encryption at all (SSL support is planned). Only use this on a secure network, obviously.

Quoted 2 lines

Also, relocation server uses which protocol. I would really appreciate if someone can point me to some document/details.

It's a proprietary protocol -- a small handshake and exchange of VM config, and then a dump of all the pages in memory. You'll have to dig into the code for details -- tools/python/xen/xend/{XendCheckpoint,XendDomainInfo}.py and tools/libxc/xc_linux_save.c should start you off.

Ewan.

tools/python/xen/xend/XendClient.py Sun May 28 17:54:47 2006 +0100 renamed from tools/python/xen/xend/XendClient.py Tue May 23 16:23:10 2006 +0100 +1 -1
diff -r 187180382772 tools/python/xen/xend/XendClient.py
@@ -25,4 +25,4 @@ ERROR_GENERIC = 2
 ERROR_GENERIC = 2
 ERROR_INVALID_DOMAIN = 3
 
-server = ServerProxy('httpu:///var/run/xend/xmlrpc.sock')
+server = ServerProxy('http://:8005/RPC2')
tools/python/xen/xend/server/XMLRPCServer.py Sun May 28 17:54:47 2006 +0100 renamed from tools/python/xen/xend/server/XMLRPCServer.py Tue May 23 16:23:10 2006 +0100 +1 -1
diff -r 187180382772 tools/python/xen/xend/server/XMLRPCServer.py
@@ -89,7 +89,7 @@ class XMLRPCServer:
         if self.use_tcp:
             # bind to something fixed for now as we may eliminate
             # tcp support completely.
-            self.server = TCPXMLRPCServer(("localhost", 8005), logRequests=False)
+            self.server = TCPXMLRPCServer(('', 8005), logRequests=False)
         else:
             self.server = UnixXMLRPCServer(XML_RPC_SOCKET, False)
 
tools/examples/xend-config.sxp Sun May 28 17:55:54 2006 +0100 renamed from tools/examples/xend-config.sxp Tue May 23 16:23:10 2006 +0100 +1 -1
diff -r 187180382772 tools/examples/xend-config.sxp
@@ -16,7 +16,7 @@
 
 #(xend-http-server no)
 #(xend-unix-server no)
-#(xend-tcp-xmlrpc-server no)
+(xend-tcp-xmlrpc-server yes)
 #(xend-unix-xmlrpc-server yes)
 #(xend-relocation-server no)
 (xend-relocation-server yes)

---------------------------------
How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 8 lines · jd sw

Thanks much. I really appreciate the prompt reply. I tried the tcp-xml rpc and it worked. (I will look in to Unix based scheme next)

Now, with the modification I can get stats, stop, kill remote vm. I have couple of related questions..

a. How do I start a VM on a remote machine, given a (remote or local) conf file . (currently for local machine I use xen.xm.create.main(filename) )

I think that if you are using the SSH transport, you can use that same call, with the config file on the client side. (I hope so, anyway ;-)

Quoted 3 lines

b. Is it possible to get console of a remote domu ? currently I am spawning, xm console with domid which works locally but not for remote doms.

Not at the moment: you would have to arrange transport of that console data yourself, I think. This would be an interesting improvement to Xend.

Quoted 3 lines

c. Is it possible to save snapshot of a remote dom on a local machine directly? (This is similar to migrating to local machine and saving snapshot.)

Not at the moment, ditto.

Ewan.

author
#4 lore raw
In reply to jd sw

Hi
I tried the SSH patch from Anthony.. using the following test code. It seems that it works only once... I mean for executing only one command over the established channel/connection.

Any thoughts?

code

from xmlrpclib import Transport
from xen.util.xmlrpclib2 import ServerProxy

server = ServerProxy("ssh://[email protected]/RPC2", None, None, 1, 1) l = server.xend.domains(1)
print l

# try again
l = server.xend.domains(1)
print l

Output :
-----------
['Domain-0', 'U1']
Traceback (most recent call last):
File "/home/jd/test/t.py", line 15, in ?
l = server.xend.domains(0)
File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.4/site-packages/xen/util/xmlrpclib2.py", line 155, in __request
response = xmlrpclib.ServerProxy.__request(self, methodname, params)
File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib/python2.4/site-packages/xen/util/xmlrpclib2.py", line 68, in request

    ssh.stdin.write("""POST /%s HTTP/1.1

IOError: [Errno 32] Broken pipe

Thanks
/Jd

jd sw <[email protected]> wrote: Thanks much. I really appreciate the prompt reply. I tried the tcp-xml rpc and it worked. (I will look in to Unix based scheme next)

Now, with the modification I can get stats, stop, kill remote vm. I have couple of related questions..

a. How do I start a VM on a remote machine, given a (remote or local) conf file . (currently for local machine I use xen.xm.create.main(filename) )

b. Is it possible to get console of a remote domu ? currently I am spawning, xm console with domid which works locally but not for remote doms.

c. Is it possible to save snapshot of a remote dom on a local machine directly? (This is similar to migrating to local machine and saving snapshot.)

Thanks in advance.
/Jd

Quoted 6 lines · jd sw

Hi
What do I need to do to access Xen on a remote machine ? Currently my
program is using the 'server' object from the XendClient.py.

There seems to be http, unix, tcp-xmlrpc, unix-xmlrpc servers. When
should each one of them be enabled/used. What port do they listen to ?

http and unix are s-expressions or HTML pages over HTTP/TCP or HTTP over Unix domain sockets respectively. These are deprecated.

tcp-xmlrpc and unix-xmlrpc is XML-RPC over HTTP/TCP or HTTP/Unix respectively. These are what you want to use. You can:

a) use unix-xmlrpc, with Anthony Liguori's recent patch to transparently SSH into your local machine and issue commands to the Unix socket. This uses your SSH authentication scheme. See xm serve for details.

b) enable and use tcp-xmlrpc, using the attached patch. This will listen on port 8005, and will use no authentication / encryption at all (SSL support is planned). Only use this on a secure network, obviously.

Quoted 2 lines

Also, relocation server uses which protocol. I would really appreciate if someone can point me to some document/details.

It's a proprietary protocol -- a small handshake and exchange of VM config, and then a dump of all the pages in memory. You'll have to dig into the code for details -- tools/python/xen/xend/{XendCheckpoint,XendDomainInfo}.py and tools/libxc/xc_linux_save.c should start you off.

Ewan.

tools/python/xen/xend/XendClient.py Sun May 28 17:54:47 2006 +0100 renamed from tools/python/xen/xend/XendClient.py Tue May 23 16:23:10 2006 +0100 +1 -1
diff -r 187180382772 tools/python/xen/xend/XendClient.py
@@ -25,4 +25,4 @@ ERROR_GENERIC = 2
 ERROR_GENERIC = 2
 ERROR_INVALID_DOMAIN = 3
 
-server = ServerProxy('httpu:///var/run/xend/xmlrpc.sock')
+server = ServerProxy('http://:8005/RPC2')
tools/python/xen/xend/server/XMLRPCServer.py Sun May 28 17:54:47 2006 +0100 renamed from tools/python/xen/xend/server/XMLRPCServer.py Tue May 23 16:23:10 2006 +0100 +1 -1
diff  -r 187180382772 tools/python/xen/xend/server/XMLRPCServer.py
@@ -89,7 +89,7 @@ class XMLRPCServer:
         if self.use_tcp:
             # bind to something fixed for now as we may eliminate
             # tcp support completely.
-            self.server = TCPXMLRPCServer(("localhost", 8005), logRequests=False)
+            self.server = TCPXMLRPCServer(('', 8005), logRequests=False)
         else:
             self.server = UnixXMLRPCServer(XML_RPC_SOCKET, False)
 
tools/examples/xend-config.sxp Sun May 28 17:55:54 2006 +0100 renamed from tools/examples/xend-config.sxp Tue May 23 16:23:10 2006 +0100 +1 -1
diff -r 187180382772 tools/examples/xend-config.sxp
@@ -16,7 +16,7 @@
 
 #(xend-http-server no)
 #(xend-unix-server no)
-#(xend-tcp-xmlrpc-server  no)
+(xend-tcp-xmlrpc-server yes)
 #(xend-unix-xmlrpc-server yes)
 #(xend-relocation-server no)
 (xend-relocation-server yes)

---------------------------------
How low will we go? Check out Yahoo! Messenger�s low PC-to-Phone call rates._______________________________________________ Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

---------------------------------
Want to be your own boss? Learn how on Yahoo! Small Business.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel