WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add support in 'xm create' for spawning a vncviewer.

To: xen-changelog@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add support in 'xm create' for spawning a vncviewer.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 17 Mar 2005 16:28:34 +0000
Delivery-date: Fri, 25 Mar 2005 12:04:57 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-changelog>
List-help: <mailto:xen-changelog-request@lists.sourceforge.net?subject=help>
List-id: <xen-changelog.lists.sourceforge.net>
List-post: <mailto:xen-changelog@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-admin@xxxxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>