[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Add support in 'xm create' for spawning a vncviewer.
ChangeSet 1.1159.267.6, 2005/03/17 16:28:34+00:00, mjw@xxxxxxxxxxxxxxxxxxx Add support in 'xm create' for spawning a vncviewer. Signed-off-by: Mike Wray <mike.wray@xxxxxx> create.py | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+) diff -Nru a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py 2005-03-25 07:03:25 -05:00 +++ b/tools/python/xen/xm/create.py 2005-03-25 07:03:25 -05:00 @@ -5,6 +5,7 @@ import random import string import sys +import socket from xen.xend import sxp from xen.xend import PrettyPrint @@ -81,6 +82,13 @@ fn=set_true, default=0, use="Connect to the console after the domain is created.") +gopts.opt('vnc', val='DISPLAY', + fn=set_int, default=None, + use="""Spawn a vncviewer listening for a vnc server in the domain. + The address of the vncviewer is passed to the domain on the kernel command + line using 'VNC_SERVER=<host>:<port>'. The port used by vnc is 5500 + DISPLAY. + """) + gopts.var('name', val='NAME', fn=set_value, default=None, use="Domain name. Must be unique.") @@ -415,6 +423,27 @@ opts.err('Must set nfs root and nfs server') nfs = 'nfsroot=' + vals.nfs_server + ':' + vals.nfs_root vals.extra = nfs + ' ' + vals.extra + + +def get_host_addr(): + host = socket.gethostname() + addr = socket.gethostbyname(host) + return addr + +def spawn_vnc(display): + os.system("vncviewer -listen %d &" % display) + return 5500 + display + +def preprocess_vnc(opts, vals): + """If vnc was specified, spawn a vncviewer in listen mode + and pass its address to the domain on the kernel command line. + """ + if vals.vnc is None: return + vnc_host = get_host_addr() + vnc_port = spawn_vnc(vals.vnc) + if vnc_port > 0: + vnc = 'VNC_VIEWER=%s:%d' % (vnc_host, vnc_port) + vals.extra = vnc + ' ' + vals.extra def preprocess(opts, vals): if not vals.kernel: @@ -424,6 +453,7 @@ preprocess_vifs(opts, vals) preprocess_ip(opts, vals) preprocess_nfs(opts, vals) + preprocess_vnc(opts, vals) def make_domain(opts, config): """Create, build and start a domain. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |