From: Anthony Liguori <aliguori@us.ibm.com>
To: xen-devel <xen-devel@lists.xensource.com>,
Ewan Mellor <ewan@xensource.com>
Subject: [PATCH 1/3] Add an xm serve command
Date: Sat, 10 Jun 2006 14:37:17 -0500 [thread overview]
Message-ID: <448B1F6D.20204@us.ibm.com> (raw)
In-Reply-To: <448B1EF2.5050801@us.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 90 bytes --]
This is the server-side support required for XML-RPC over SSH.
Regards,
Anthony Liguori
[-- Attachment #2: xm-serve.diff --]
[-- Type: text/plain, Size: 2556 bytes --]
# HG changeset patch
# User anthony@rhesis.austin.ibm.com
# Node ID cf8e253723daf8b95b54b24f6988a8e74c6cc0aa
# Parent a0212dab2954807a979058d91b246564a7bf2cc2
Add an xm serve command.
This command proxies the Xend XML-RPC over stdio. This is similiar to
mercurial's hg serve --stdio command.
The most obvious use of this command is remote XML-RPC invocation over SSH.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff -r a0212dab2954 -r cf8e253723da tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Sat Jun 10 19:07:26 2006
+++ b/tools/python/xen/xm/main.py Sat Jun 10 19:11:55 2006
@@ -41,6 +41,7 @@
import xen.xend.XendClient
from xen.xend.XendClient import server
from xen.util import security
+from select import select
# getopt.gnu_getopt is better, but only exists in Python 2.3+. Use
# getopt.getopt if gnu_getopt is not available. This will mean that options
@@ -124,6 +125,7 @@
loadpolicy_help = "loadpolicy <policy> Load binary policy into hypervisor"
makepolicy_help = "makepolicy <policy> Build policy and create .bin/.map files"
labels_help = "labels [policy] [type=DOM|..] List <type> labels for (active) policy."
+serve_help = "serve Proxy Xend XML-RPC over stdio"
short_command_list = [
"console",
@@ -171,7 +173,8 @@
host_commands = [
"dmesg",
"info",
- "log"
+ "log",
+ "serve",
]
scheduler_commands = [
@@ -833,6 +836,32 @@
arg_check(args, "log", 0)
print server.xend.node.log()
+
+def xm_serve(args):
+ arg_check(args, "serve", 0)
+
+ from fcntl import fcntl, F_SETFL
+
+ s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ s.connect(xen.xend.XendClient.XML_RPC_SOCKET)
+ fcntl(sys.stdin, F_SETFL, os.O_NONBLOCK)
+
+ while True:
+ iwtd, owtd, ewtd = select([sys.stdin, s], [], [])
+ if s in iwtd:
+ data = s.recv(4096)
+ if len(data) > 0:
+ sys.stdout.write(data)
+ sys.stdout.flush()
+ else:
+ break
+ if sys.stdin in iwtd:
+ data = sys.stdin.read(4096)
+ if len(data) > 0:
+ s.sendall(data)
+ else:
+ break
+ s.close()
def parse_dev_info(info):
def get_info(n, t, d):
@@ -1072,6 +1101,7 @@
"dmesg": xm_dmesg,
"info": xm_info,
"log": xm_log,
+ "serve": xm_serve,
# scheduler
"sched-bvt": xm_sched_bvt,
"sched-bvt-ctxallow": xm_sched_bvt_ctxallow,
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2006-06-10 19:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-10 19:35 [PATCH 0/3] Add support for XML-RPC over SSH Anthony Liguori
2006-06-10 19:37 ` Anthony Liguori [this message]
2006-06-10 19:38 ` [PATCH 2/3] Add SSH over XML-RPC support to xmlrpclib2.ServerProxy Anthony Liguori
2006-06-10 19:39 ` [PATCH 3/3] Let xm user choose XML-RPC URI Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=448B1F6D.20204@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=ewan@xensource.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.