[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] allow VM configuration with both sdl=1 and vnc=1



Hi all,
this patch modifies xend to allow sdl and vnc to both be enabled at the same
time.
In the stubdom case you can now specify sdl=1 and vnc=1 (again, both can
be selected at the same time) in the vfb configuration.
So instead of:

vfb = [ 'type=vnc' ]

now you have:

vfb = [ 'vnc=1,sdl=1' ]

the former configuration option is deprecated but still supported for
backward compatibility.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

---


diff -r 09a6fa059b37 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Fri Feb 13 09:48:56 2009 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Thu Mar 05 18:10:21 2009 +0000
@@ -173,7 +173,7 @@
 
 # Xen API console 'other_config' keys.
 XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten',
-                            'vncpasswd', 'type', 'display', 'xauthority',
+                            'vncpasswd', 'sdl', 'vnc', 'display', 'xauthority',
                             'keymap', 'opengl']
 
 # List of XendConfig configuration keys that have no direct equivalent
@@ -861,7 +861,7 @@
             # add vfb device if it isn't there already
             if not self.has_rfb():
                 dev_config = ['vfb']
-                dev_config.append(['type', 'vnc'])
+                dev_config.append(['vnc', '1'])
                 # copy VNC related params from platform config to vfb dev conf
                 for key in ['vncpasswd', 'vncunused', 'vncdisplay',
                             'vnclisten']:
@@ -1457,7 +1457,8 @@
                     # collapse other config into devinfo for things
                     # such as vncpasswd, vncunused, etc.                    
                     dev_info.update(console_other_config)
-                    dev_info['type'] = console_other_config.get('type', 'vnc') 
+                    dev_info['vnc'] = console_other_config.get('vnc', '0') 
+                    dev_info['sdl'] = console_other_config.get('sdl', '0') 
                     target['devices'][dev_uuid] = ('vfb', dev_info)
                     target['console_refs'].append(dev_uuid)
 
diff -r 09a6fa059b37 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Fri Feb 13 09:48:56 2009 +0000
+++ b/tools/python/xen/xend/image.py    Thu Mar 05 18:10:21 2009 +0000
@@ -279,15 +279,16 @@
             if dev_type == 'vfb':
                 if 'keymap' in dev_info:
                     keymap = dev_info.get('keymap',{})
-                vfb_type = dev_info.get('type', {})
-                if vfb_type == 'sdl':
+                if int(dev_info.get('vnc', 0)) != 0 :
+                    has_vnc = True
+                if int(dev_info.get('sdl', 0)) != 0 :
+                    has_sdl = True
+                if has_sdl:
                     self.display = dev_info.get('display', {})
                     self.xauthority = dev_info.get('xauthority', {})
                     opengl = int(dev_info.get('opengl', opengl))
-                    has_sdl = True
-                else:
+                if has_vnc:
                     vnc_config = dev_info.get('other_config', {})
-                    has_vnc = True
                 break
 
         if keymap:
@@ -335,11 +336,12 @@
             if int(vnc_config.get('vncunused', 1)) != 0:
                 ret.append('-vncunused')
 
-        elif has_sdl:
-            # SDL is default in QEMU.
+        if has_sdl:
+            ret.append('-sdl')
             if int(vmConfig['platform'].get('opengl', opengl)) != 1 :
                 ret.append('-disable-opengl')
-        else:
+
+        if not has_sdl and not has_vnc :
             ret.append('-nographic')
 
         if int(vmConfig['platform'].get('monitor', 0)) != 0:
@@ -714,6 +716,8 @@
 
         rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset')
 
+        if not self.display :
+            self.display = ''
         self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
                         ("image/device-model", self.device_model),
                         ("image/display", self.display))
diff -r 09a6fa059b37 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Fri Feb 13 09:48:56 2009 +0000
+++ b/tools/python/xen/xm/create.py     Thu Mar 05 18:10:21 2009 +0000
@@ -348,16 +348,16 @@
          For example 'irq=7'.
          This option may be repeated to add more than one IRQ.""")
 
-gopts.var('vfb', 
val="type={vnc,sdl},vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE",
+gopts.var('vfb', 
val="vnc=1,sdl=1,vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE",
           fn=append_value, default=[],
           use="""Make the domain a framebuffer backend.
-          The backend type should be either sdl or vnc.
-          For type=vnc, connect an external vncviewer.  The server will listen
+          Both sdl=1 and vnc=1 can be enabled at the same time.
+          For vnc=1, connect an external vncviewer.  The server will listen
           on ADDR (default 127.0.0.1) on port N+5900.  N defaults to the
           domain id.  If vncunused=1, the server will try to find an arbitrary
           unused port above 5900.  vncpasswd overrides the XenD configured
           default password.
-          For type=sdl, a viewer will be started automatically using the
+          For sdl=1, a viewer will be started automatically using the
           given DISPLAY and XAUTHORITY, which default to the current user's
           ones.  OpenGL will be used by default unless opengl is set to 0.
           keymap overrides the XendD configured default layout file.""")
@@ -785,11 +785,13 @@
     for f in vals.vfb:
         d = comma_sep_kv_to_dict(f)
         config = ['vfb']
-        if not d.has_key("type"):
-            d['type'] = 'sdl'
+        #handle the legacy case
+        if d.has_key("type"):
+            d[d['type']] = '1'
+            del d['type']
         for (k,v) in d.iteritems():
             if not k in [ 'vnclisten', 'vncunused', 'vncdisplay', 'display',
-                          'videoram', 'xauthority', 'type', 'vncpasswd',
+                          'videoram', 'xauthority', 'sdl', 'vnc', 'vncpasswd',
                           'opengl', 'keymap' ]:
                 err("configuration option %s unknown to vfbs" % k)
             config.append([k,v])
diff -r cff29d694a89 tools/examples/xmexample.hvm-dm
--- a/tools/examples/xmexample.hvm-dm   Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/examples/xmexample.hvm-dm   Thu Mar 05 18:31:58 2009 +0000
@@ -11,4 +11,4 @@
 disk = [ 'file:/var/images/min-el3-i386.img,hda,w', ',hdc:cdrom,r' ]
 
 # Actual output via PVFB
-vfb = [ 'type=sdl' ]
+vfb = [ 'sdl=1' ]
diff -r cff29d694a89 tools/examples/xmexample.pv-grub
--- a/tools/examples/xmexample.pv-grub  Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/examples/xmexample.pv-grub  Thu Mar 05 18:31:58 2009 +0000
@@ -77,29 +77,29 @@
 #
 # To create one using the SDL backend and sensible defaults:
 #
-# vfb = [ 'type=sdl' ]
+# vfb = [ 'sdl=1' ]
 #
 # This uses environment variables XAUTHORITY and DISPLAY.  You
 # can override that:
 #
-# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
+# vfb = [ 'sdl=1,xauthority=/home/bozo/.Xauthority,display=:1' ]
 #
 # To create one using the VNC backend and sensible defaults:
 #
-# vfb = [ 'type=vnc' ]
+# vfb = [ 'vnc=1' ]
 #
 # The backend listens on 127.0.0.1 port 5900+N by default, where N is
 # the domain ID.  You can override both address and N:
 #
-# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=1' ]
+# vfb = [ 'vnc=1,vnclisten=127.0.0.1,vncdisplay=1' ]
 #
 # Or you can bind the first unused port above 5900:
 #
-# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]
+# vfb = [ 'vnc=1,vnclisten=0.0.0.0,vncunused=1' ]
 #
 # You can override the password:
 #
-# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
+# vfb = [ 'vnc=1,vncpasswd=MYPASSWD' ]
 #
 # Empty password disables authentication.  Defaults to the vncpasswd
 # configured in xend-config.sxp.
diff -r cff29d694a89 tools/examples/xmexample1
--- a/tools/examples/xmexample1 Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/examples/xmexample1 Thu Mar 05 18:31:59 2009 +0000
@@ -73,29 +73,29 @@
 #
 # To create one using the SDL backend and sensible defaults:
 #
-# vfb = [ 'type=sdl' ]
+# vfb = [ 'sdl=1' ]
 #
 # This uses environment variables XAUTHORITY and DISPLAY.  You
 # can override that:
 #
-# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
+# vfb = [ 'sdl=1,xauthority=/home/bozo/.Xauthority,display=:1' ]
 #
 # To create one using the VNC backend and sensible defaults:
 #
-# vfb = [ 'type=vnc' ]
+# vfb = [ 'vnc=1' ]
 #
 # The backend listens on 127.0.0.1 port 5900+N by default, where N is
 # the domain ID.  You can override both address and N:
 #
-# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=1' ]
+# vfb = [ 'vnc=1,vnclisten=127.0.0.1,vncdisplay=1' ]
 #
 # Or you can bind the first unused port above 5900:
 #
-# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]
+# vfb = [ 'vnc=1,vnclisten=0.0.0.0,vncunused=1' ]
 #
 # You can override the password:
 #
-# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
+# vfb = [ 'vnc=1,vncpasswd=MYPASSWD' ]
 #
 # Empty password disables authentication.  Defaults to the vncpasswd
 # configured in xend-config.sxp.
diff -r cff29d694a89 tools/examples/xmexample2
--- a/tools/examples/xmexample2 Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/examples/xmexample2 Thu Mar 05 18:31:59 2009 +0000
@@ -109,29 +109,29 @@
 #
 # To create one using the SDL backend and sensible defaults:
 #
-# vfb = [ 'type=sdl' ]
+# vfb = [ 'sdl=1' ]
 #
 # This uses environment variables XAUTHORITY and DISPLAY.  You
 # can override that:
 #
-# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
+# vfb = [ 'sdl=1,xauthority=/home/bozo/.Xauthority,display=:1' ]
 #
 # To create one using the VNC backend and sensible defaults:
 #
-# vfb = [ 'type=vnc' ]
+# vfb = [ 'vnc=1' ]
 #
 # The backend listens on 127.0.0.1 port 5900+N by default, where N is
 # the domain ID.  You can override both address and N:
 #
-# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=%d' % vmid ]
+# vfb = [ 'vnc=1,vnclisten=127.0.0.1,vncdisplay=%d' % vmid ]
 #
 # Or you can bind the first unused port above 5900:
 #
-# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]
+# vfb = [ 'vnc=1,vnclisten=0.0.0.0,vncunused=1' ]
 #
 # You can override the password:
 #
-# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
+# vfb = [ 'vnc=1,vncpasswd=MYPASSWD' ]
 #
 # Empty password disables authentication.  Defaults to the vncpasswd
 # configured in xend-config.sxp.
diff -r cff29d694a89 tools/examples/xmexample3
--- a/tools/examples/xmexample3 Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/examples/xmexample3 Thu Mar 05 18:31:59 2009 +0000
@@ -94,29 +94,29 @@
 #
 # To create one using the SDL backend and sensible defaults:
 #
-# vfb = [ 'type=sdl' ]
+# vfb = [ 'sdl=1' ]
 #
 # This uses environment variables XAUTHORITY and DISPLAY.  You
 # can override that:
 #
-# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
+# vfb = [ 'sdl=1,xauthority=/home/bozo/.Xauthority,display=:1' ]
 #
 # To create one using the VNC backend and sensible defaults:
 #
-# vfb = [ 'type=vnc' ]
+# vfb = [ 'vnc=1' ]
 #
 # The backend listens on 127.0.0.1 port 5900+N by default, where N is
 # the domain ID.  You can override both address and N:
 #
-# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=%d' % vmid ]
+# vfb = [ 'vnc=1,vnclisten=127.0.0.1,vncdisplay=%d' % vmid ]
 #
 # Or you can bind the first unused port above 5900:
 #
-# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]
+# vfb = [ 'vnc=1,vnclisten=0.0.0.0,vncunused=1' ]
 #
 # You can override the password:
 #
-# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
+# vfb = [ 'vnc=1,vncpasswd=MYPASSWD' ]
 #
 # Empty password disables authentication.  Defaults to the vncpasswd
 # configured in xend-config.sxp.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.