ia64/xen-unstable

changeset 19287:0942baa2a088

xend: allow VM configuration with both sdl=1 and vnc=1

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>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Mar 06 19:13:23 2009 +0000 (2009-03-06)
parents ec3d0937095d
children f1080b20cd15
files 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
line diff
     1.1 --- a/tools/examples/xmexample.hvm-dm	Fri Mar 06 19:10:29 2009 +0000
     1.2 +++ b/tools/examples/xmexample.hvm-dm	Fri Mar 06 19:13:23 2009 +0000
     1.3 @@ -11,4 +11,4 @@ vif = [ '', 'type=ioemu, bridge=xenbr0' 
     1.4  disk = [ 'file:/var/images/min-el3-i386.img,hda,w', ',hdc:cdrom,r' ]
     1.5  
     1.6  # Actual output via PVFB
     1.7 -vfb = [ 'type=sdl' ]
     1.8 +vfb = [ 'sdl=1' ]
     2.1 --- a/tools/examples/xmexample.pv-grub	Fri Mar 06 19:10:29 2009 +0000
     2.2 +++ b/tools/examples/xmexample.pv-grub	Fri Mar 06 19:13:23 2009 +0000
     2.3 @@ -77,29 +77,29 @@ disk = [ 'phy:hda1,hda1,w' ]
     2.4  #
     2.5  # To create one using the SDL backend and sensible defaults:
     2.6  #
     2.7 -# vfb = [ 'type=sdl' ]
     2.8 +# vfb = [ 'sdl=1' ]
     2.9  #
    2.10  # This uses environment variables XAUTHORITY and DISPLAY.  You
    2.11  # can override that:
    2.12  #
    2.13 -# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
    2.14 +# vfb = [ 'sdl=1,xauthority=/home/bozo/.Xauthority,display=:1' ]
    2.15  #
    2.16  # To create one using the VNC backend and sensible defaults:
    2.17  #
    2.18 -# vfb = [ 'type=vnc' ]
    2.19 +# vfb = [ 'vnc=1' ]
    2.20  #
    2.21  # The backend listens on 127.0.0.1 port 5900+N by default, where N is
    2.22  # the domain ID.  You can override both address and N:
    2.23  #
    2.24 -# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=1' ]
    2.25 +# vfb = [ 'vnc=1,vnclisten=127.0.0.1,vncdisplay=1' ]
    2.26  #
    2.27  # Or you can bind the first unused port above 5900:
    2.28  #
    2.29 -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]
    2.30 +# vfb = [ 'vnc=1,vnclisten=0.0.0.0,vncunused=1' ]
    2.31  #
    2.32  # You can override the password:
    2.33  #
    2.34 -# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
    2.35 +# vfb = [ 'vnc=1,vncpasswd=MYPASSWD' ]
    2.36  #
    2.37  # Empty password disables authentication.  Defaults to the vncpasswd
    2.38  # configured in xend-config.sxp.
     3.1 --- a/tools/examples/xmexample1	Fri Mar 06 19:10:29 2009 +0000
     3.2 +++ b/tools/examples/xmexample1	Fri Mar 06 19:13:23 2009 +0000
     3.3 @@ -73,29 +73,29 @@ disk = [ 'phy:hda1,hda1,w' ]
     3.4  #
     3.5  # To create one using the SDL backend and sensible defaults:
     3.6  #
     3.7 -# vfb = [ 'type=sdl' ]
     3.8 +# vfb = [ 'sdl=1' ]
     3.9  #
    3.10  # This uses environment variables XAUTHORITY and DISPLAY.  You
    3.11  # can override that:
    3.12  #
    3.13 -# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
    3.14 +# vfb = [ 'sdl=1,xauthority=/home/bozo/.Xauthority,display=:1' ]
    3.15  #
    3.16  # To create one using the VNC backend and sensible defaults:
    3.17  #
    3.18 -# vfb = [ 'type=vnc' ]
    3.19 +# vfb = [ 'vnc=1' ]
    3.20  #
    3.21  # The backend listens on 127.0.0.1 port 5900+N by default, where N is
    3.22  # the domain ID.  You can override both address and N:
    3.23  #
    3.24 -# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=1' ]
    3.25 +# vfb = [ 'vnc=1,vnclisten=127.0.0.1,vncdisplay=1' ]
    3.26  #
    3.27  # Or you can bind the first unused port above 5900:
    3.28  #
    3.29 -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]
    3.30 +# vfb = [ 'vnc=1,vnclisten=0.0.0.0,vncunused=1' ]
    3.31  #
    3.32  # You can override the password:
    3.33  #
    3.34 -# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
    3.35 +# vfb = [ 'vnc=1,vncpasswd=MYPASSWD' ]
    3.36  #
    3.37  # Empty password disables authentication.  Defaults to the vncpasswd
    3.38  # configured in xend-config.sxp.
     4.1 --- a/tools/examples/xmexample2	Fri Mar 06 19:10:29 2009 +0000
     4.2 +++ b/tools/examples/xmexample2	Fri Mar 06 19:13:23 2009 +0000
     4.3 @@ -109,29 +109,29 @@ disk = [ 'phy:sda%d,sda1,w' % (7+vmid),
     4.4  #
     4.5  # To create one using the SDL backend and sensible defaults:
     4.6  #
     4.7 -# vfb = [ 'type=sdl' ]
     4.8 +# vfb = [ 'sdl=1' ]
     4.9  #
    4.10  # This uses environment variables XAUTHORITY and DISPLAY.  You
    4.11  # can override that:
    4.12  #
    4.13 -# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
    4.14 +# vfb = [ 'sdl=1,xauthority=/home/bozo/.Xauthority,display=:1' ]
    4.15  #
    4.16  # To create one using the VNC backend and sensible defaults:
    4.17  #
    4.18 -# vfb = [ 'type=vnc' ]
    4.19 +# vfb = [ 'vnc=1' ]
    4.20  #
    4.21  # The backend listens on 127.0.0.1 port 5900+N by default, where N is
    4.22  # the domain ID.  You can override both address and N:
    4.23  #
    4.24 -# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=%d' % vmid ]
    4.25 +# vfb = [ 'vnc=1,vnclisten=127.0.0.1,vncdisplay=%d' % vmid ]
    4.26  #
    4.27  # Or you can bind the first unused port above 5900:
    4.28  #
    4.29 -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]
    4.30 +# vfb = [ 'vnc=1,vnclisten=0.0.0.0,vncunused=1' ]
    4.31  #
    4.32  # You can override the password:
    4.33  #
    4.34 -# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
    4.35 +# vfb = [ 'vnc=1,vncpasswd=MYPASSWD' ]
    4.36  #
    4.37  # Empty password disables authentication.  Defaults to the vncpasswd
    4.38  # configured in xend-config.sxp.
     5.1 --- a/tools/examples/xmexample3	Fri Mar 06 19:10:29 2009 +0000
     5.2 +++ b/tools/examples/xmexample3	Fri Mar 06 19:13:23 2009 +0000
     5.3 @@ -94,29 +94,29 @@ disk = [ 'phy:hda%d,hda1,w' % (vmid)]
     5.4  #
     5.5  # To create one using the SDL backend and sensible defaults:
     5.6  #
     5.7 -# vfb = [ 'type=sdl' ]
     5.8 +# vfb = [ 'sdl=1' ]
     5.9  #
    5.10  # This uses environment variables XAUTHORITY and DISPLAY.  You
    5.11  # can override that:
    5.12  #
    5.13 -# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
    5.14 +# vfb = [ 'sdl=1,xauthority=/home/bozo/.Xauthority,display=:1' ]
    5.15  #
    5.16  # To create one using the VNC backend and sensible defaults:
    5.17  #
    5.18 -# vfb = [ 'type=vnc' ]
    5.19 +# vfb = [ 'vnc=1' ]
    5.20  #
    5.21  # The backend listens on 127.0.0.1 port 5900+N by default, where N is
    5.22  # the domain ID.  You can override both address and N:
    5.23  #
    5.24 -# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=%d' % vmid ]
    5.25 +# vfb = [ 'vnc=1,vnclisten=127.0.0.1,vncdisplay=%d' % vmid ]
    5.26  #
    5.27  # Or you can bind the first unused port above 5900:
    5.28  #
    5.29 -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ]
    5.30 +# vfb = [ 'vnc=1,vnclisten=0.0.0.0,vncunused=1' ]
    5.31  #
    5.32  # You can override the password:
    5.33  #
    5.34 -# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
    5.35 +# vfb = [ 'vnc=1,vncpasswd=MYPASSWD' ]
    5.36  #
    5.37  # Empty password disables authentication.  Defaults to the vncpasswd
    5.38  # configured in xend-config.sxp.
     6.1 --- a/tools/python/xen/xend/XendConfig.py	Fri Mar 06 19:10:29 2009 +0000
     6.2 +++ b/tools/python/xen/xend/XendConfig.py	Fri Mar 06 19:13:23 2009 +0000
     6.3 @@ -174,7 +174,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     6.4  
     6.5  # Xen API console 'other_config' keys.
     6.6  XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten',
     6.7 -                            'vncpasswd', 'type', 'display', 'xauthority',
     6.8 +                            'vncpasswd', 'sdl', 'vnc', 'display', 'xauthority',
     6.9                              'keymap', 'opengl']
    6.10  
    6.11  # List of XendConfig configuration keys that have no direct equivalent
    6.12 @@ -865,7 +865,7 @@ class XendConfig(dict):
    6.13              # add vfb device if it isn't there already
    6.14              if not self.has_rfb():
    6.15                  dev_config = ['vfb']
    6.16 -                dev_config.append(['type', 'vnc'])
    6.17 +                dev_config.append(['vnc', '1'])
    6.18                  # copy VNC related params from platform config to vfb dev conf
    6.19                  for key in ['vncpasswd', 'vncunused', 'vncdisplay',
    6.20                              'vnclisten']:
    6.21 @@ -1470,7 +1470,8 @@ class XendConfig(dict):
    6.22                      # collapse other config into devinfo for things
    6.23                      # such as vncpasswd, vncunused, etc.                    
    6.24                      dev_info.update(console_other_config)
    6.25 -                    dev_info['type'] = console_other_config.get('type', 'vnc') 
    6.26 +                    dev_info['vnc'] = console_other_config.get('vnc', '0')
    6.27 +                    dev_info['sdl'] = console_other_config.get('sdl', '0')
    6.28                      target['devices'][dev_uuid] = ('vfb', dev_info)
    6.29                      target['console_refs'].append(dev_uuid)
    6.30  
     7.1 --- a/tools/python/xen/xend/image.py	Fri Mar 06 19:10:29 2009 +0000
     7.2 +++ b/tools/python/xen/xend/image.py	Fri Mar 06 19:13:23 2009 +0000
     7.3 @@ -279,15 +279,16 @@ class ImageHandler:
     7.4              if dev_type == 'vfb':
     7.5                  if 'keymap' in dev_info:
     7.6                      keymap = dev_info.get('keymap',{})
     7.7 -                vfb_type = dev_info.get('type', {})
     7.8 -                if vfb_type == 'sdl':
     7.9 +                if int(dev_info.get('vnc', 0)) != 0 :
    7.10 +                    has_vnc = True
    7.11 +                if int(dev_info.get('sdl', 0)) != 0 :
    7.12 +                    has_sdl = True
    7.13 +                if has_sdl:
    7.14                      self.display = dev_info.get('display', {})
    7.15                      self.xauthority = dev_info.get('xauthority', {})
    7.16                      opengl = int(dev_info.get('opengl', opengl))
    7.17 -                    has_sdl = True
    7.18 -                else:
    7.19 +                if has_vnc:
    7.20                      vnc_config = dev_info.get('other_config', {})
    7.21 -                    has_vnc = True
    7.22                  break
    7.23  
    7.24          if keymap:
    7.25 @@ -335,11 +336,12 @@ class ImageHandler:
    7.26              if int(vnc_config.get('vncunused', 1)) != 0:
    7.27                  ret.append('-vncunused')
    7.28  
    7.29 -        elif has_sdl:
    7.30 -            # SDL is default in QEMU.
    7.31 +        if has_sdl:
    7.32 +            ret.append('-sdl')
    7.33              if int(vmConfig['platform'].get('opengl', opengl)) != 1 :
    7.34                  ret.append('-disable-opengl')
    7.35 -        else:
    7.36 +
    7.37 +        if not has_sdl and not has_vnc :
    7.38              ret.append('-nographic')
    7.39  
    7.40          if int(vmConfig['platform'].get('monitor', 0)) != 0:
    7.41 @@ -714,6 +716,8 @@ class HVMImageHandler(ImageHandler):
    7.42  
    7.43          rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset')
    7.44  
    7.45 +        if not self.display :
    7.46 +            self.display = ''
    7.47          self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
    7.48                          ("image/device-model", self.device_model),
    7.49                          ("image/display", self.display))
     8.1 --- a/tools/python/xen/xm/create.py	Fri Mar 06 19:10:29 2009 +0000
     8.2 +++ b/tools/python/xen/xm/create.py	Fri Mar 06 19:13:23 2009 +0000
     8.3 @@ -350,16 +350,16 @@ gopts.var('irq', val='IRQ',
     8.4           For example 'irq=7'.
     8.5           This option may be repeated to add more than one IRQ.""")
     8.6  
     8.7 -gopts.var('vfb', val="type={vnc,sdl},vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE",
     8.8 +gopts.var('vfb', val="vnc=1,sdl=1,vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE",
     8.9            fn=append_value, default=[],
    8.10            use="""Make the domain a framebuffer backend.
    8.11 -          The backend type should be either sdl or vnc.
    8.12 -          For type=vnc, connect an external vncviewer.  The server will listen
    8.13 +          Both sdl=1 and vnc=1 can be enabled at the same time.
    8.14 +          For vnc=1, connect an external vncviewer.  The server will listen
    8.15            on ADDR (default 127.0.0.1) on port N+5900.  N defaults to the
    8.16            domain id.  If vncunused=1, the server will try to find an arbitrary
    8.17            unused port above 5900.  vncpasswd overrides the XenD configured
    8.18            default password.
    8.19 -          For type=sdl, a viewer will be started automatically using the
    8.20 +          For sdl=1, a viewer will be started automatically using the
    8.21            given DISPLAY and XAUTHORITY, which default to the current user's
    8.22            ones.  OpenGL will be used by default unless opengl is set to 0.
    8.23            keymap overrides the XendD configured default layout file.""")
    8.24 @@ -804,11 +804,13 @@ def configure_vfbs(config_devs, vals):
    8.25      for f in vals.vfb:
    8.26          d = comma_sep_kv_to_dict(f)
    8.27          config = ['vfb']
    8.28 -        if not d.has_key("type"):
    8.29 -            d['type'] = 'sdl'
    8.30 +        #handle the legacy case
    8.31 +        if d.has_key("type"):
    8.32 +            d[d['type']] = '1'
    8.33 +            del d['type']
    8.34          for (k,v) in d.iteritems():
    8.35              if not k in [ 'vnclisten', 'vncunused', 'vncdisplay', 'display',
    8.36 -                          'videoram', 'xauthority', 'type', 'vncpasswd',
    8.37 +                          'videoram', 'xauthority', 'sdl', 'vnc', 'vncpasswd',
    8.38                            'opengl', 'keymap' ]:
    8.39                  err("configuration option %s unknown to vfbs" % k)
    8.40              config.append([k,v])