xend: allow VM configuration with both sdl=1 and vnc=1
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 6 Mar 2009 19:13:23 +0000 (19:13 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 6 Mar 2009 19:13:23 +0000 (19:13 +0000)
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@eu.citrix.com>
tools/examples/xmexample.hvm-dm
tools/examples/xmexample.pv-grub
tools/examples/xmexample1
tools/examples/xmexample2
tools/examples/xmexample3
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index de1619ba322e8e05db2bb0bc2792528811138dee..9e7d207b988cec077ac9e9f2260b74e90dfb0ce2 100644 (file)
@@ -11,4 +11,4 @@ vif = [ '', 'type=ioemu, bridge=xenbr0' ]
 disk = [ 'file:/var/images/min-el3-i386.img,hda,w', ',hdc:cdrom,r' ]
 
 # Actual output via PVFB
-vfb = [ 'type=sdl' ]
+vfb = [ 'sdl=1' ]
index 2d647c936573c11fd57044f003e232e820dd7e92..1b687151b60b82c8959c0c1a3783f29656d6545c 100644 (file)
@@ -77,29 +77,29 @@ disk = [ 'phy:hda1,hda1,w' ]
 #
 # 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.
index fe382d43f658a941105fa13df8205872ee67a901..330aaf099935cbe249cc97e781a55dc1234019eb 100644 (file)
@@ -73,29 +73,29 @@ disk = [ 'phy:hda1,hda1,w' ]
 #
 # 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.
index 53ee3aa98eea7d2e049f737b9bcc23f8b9aea228..4e5eb3dffb58869b3a6cd23b8576a0214b1070dd 100644 (file)
@@ -109,29 +109,29 @@ disk = [ 'phy:sda%d,sda1,w' % (7+vmid),
 #
 # 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.
index 99281904fd0ab8a15bbd51e1e401d4bf43b306c1..dc22ce1db3bf4ec28c28901a063920a9e46353b3 100644 (file)
@@ -94,29 +94,29 @@ disk = [ 'phy:hda%d,hda1,w' % (vmid)]
 #
 # 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.
index bb0a0bc26d71e1a0a8b539a1c62162a1bd690c32..e14713364954a11b93086537609aeb3101a9a269 100644 (file)
@@ -174,7 +174,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
 
 # 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
@@ -865,7 +865,7 @@ class XendConfig(dict):
             # 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']:
@@ -1470,7 +1470,8 @@ class XendConfig(dict):
                     # 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)
 
index 99111c9cccc12163d7b8959fde5b5e3a8a2beed1..d600a0ec4d4f736d451123e32e76ffcc072d97f6 100644 (file)
@@ -279,15 +279,16 @@ class ImageHandler:
             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 @@ class ImageHandler:
             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 @@ class HVMImageHandler(ImageHandler):
 
         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))
index 8491a5e6934bcd4b3e4e78be47fcc5dc8b53c775..6699c3c7f3a80576e8e55ff40e89475bcf711ee4 100644 (file)
@@ -350,16 +350,16 @@ gopts.var('irq', val='IRQ',
          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.""")
@@ -804,11 +804,13 @@ def configure_vfbs(config_devs, vals):
     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])