direct-io.hg

changeset 12177:4441715c9a67

Import the Xend parts of xen-unstable changeset
11840:02506a7443155611d6bbf03e49fbf193e96d24db.

[HVM] Implement password authentication of VNC connections.

The specification is as mentioned at
http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00666.html
(However, password came to describe plain text)

The difference is follows.
- protocol_authtype() without the necessity was deleted.
- The check on the protocol version was added.
- And, some small modification.

Signed-off-by: Masami Watanabe <masami.watanabe@jp.fujitsu.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Nov 01 10:30:02 2006 +0000 (2006-11-01)
parents f3be4922cc8b
children e3c70530cb28
files tools/examples/xend-config.sxp tools/python/xen/xend/XendRoot.py tools/python/xen/xend/image.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/examples/xend-config.sxp	Fri Oct 20 09:32:16 2006 +0100
     1.2 +++ b/tools/examples/xend-config.sxp	Wed Nov 01 10:30:02 2006 +0000
     1.3 @@ -130,3 +130,12 @@
     1.4  
     1.5  # The tool used for initiating virtual TPM migration
     1.6  #(external-migration-tool '')
     1.7 +
     1.8 +# The interface for VNC servers to listen on. Defaults
     1.9 +# to 127.0.0.1  To restore old 'listen everywhere' behaviour
    1.10 +# set this to 0.0.0.0
    1.11 +#(vnc-listen '127.0.0.1')
    1.12 +
    1.13 +# The default password for VNC console on HVM domain.
    1.14 +# Empty string is no authentication.
    1.15 +(vncpasswd '')
     2.1 --- a/tools/python/xen/xend/XendRoot.py	Fri Oct 20 09:32:16 2006 +0100
     2.2 +++ b/tools/python/xen/xend/XendRoot.py	Wed Nov 01 10:30:02 2006 +0000
     2.3 @@ -93,6 +93,8 @@ class XendRoot:
     2.4  
     2.5      dom0_vcpus_default = '0'
     2.6  
     2.7 +    vncpasswd_default = None
     2.8 +
     2.9      """Default interface to listen for VNC connections on"""
    2.10      xend_vnc_listen_default = '127.0.0.1'
    2.11  
    2.12 @@ -287,6 +289,10 @@ class XendRoot:
    2.13      def get_vnclisten_address(self):
    2.14          return self.get_config_value('vnc-listen', self.xend_vnc_listen_default)
    2.15  
    2.16 +    def get_vncpasswd_default(self):
    2.17 +        return self.get_config_value('vncpasswd',
    2.18 +                                     self.vncpasswd_default)
    2.19 +
    2.20  def instance():
    2.21      """Get an instance of XendRoot.
    2.22      Use this instead of the constructor.
     3.1 --- a/tools/python/xen/xend/image.py	Fri Oct 20 09:32:16 2006 +0100
     3.2 +++ b/tools/python/xen/xend/image.py	Wed Nov 01 10:30:02 2006 +0000
     3.3 @@ -354,23 +354,49 @@ class HVMImageHandler(ImageHandler):
     3.4          sdl = sxp.child_value(config, 'sdl')
     3.5          ret = []
     3.6          nographic = sxp.child_value(config, 'nographic')
     3.7 +
     3.8 +        # get password from VM config (if password omitted, None)
     3.9 +        vncpasswd_vmconfig = sxp.child_value(config, 'vncpasswd')
    3.10 +
    3.11          if nographic:
    3.12              ret.append('-nographic')
    3.13 +            # remove password
    3.14 +            if vncpasswd_vmconfig:
    3.15 +                config.remove(['vncpasswd', vncpasswd_vmconfig])
    3.16              return ret
    3.17 +
    3.18          if vnc:
    3.19              vncdisplay = sxp.child_value(config, 'vncdisplay',
    3.20                                           int(self.vm.getDomid()))
    3.21 +
    3.22              vncunused = sxp.child_value(config, 'vncunused')
    3.23              if vncunused:
    3.24                  ret += ['-vncunused']
    3.25              else:
    3.26                  ret += ['-vnc', '%d' % vncdisplay]
    3.27 +
    3.28              ret += ['-k', 'en-us']
    3.29 +
    3.30              vnclisten = sxp.child_value(config, 'vnclisten')
    3.31              if not(vnclisten):
    3.32 -                vnclisten = xen.xend.XendRoot.instance().get_vnclisten_address()
    3.33 +                vnclisten = (xen.xend.XendRoot.instance().
    3.34 +                             get_vnclisten_address())
    3.35              if vnclisten:
    3.36                  ret += ['-vnclisten', vnclisten]
    3.37 +
    3.38 +            vncpasswd = vncpasswd_vmconfig
    3.39 +            if vncpasswd is None:
    3.40 +                vncpasswd = (xen.xend.XendRoot.instance().
    3.41 +                             get_vncpasswd_default())
    3.42 +                if vncpasswd is None:
    3.43 +                    raise VmError('vncpasswd is not set up in ' +
    3.44 +                                  'VMconfig and xend-config.')
    3.45 +            if vncpasswd != '':
    3.46 +                self.vm.storeVm("vncpasswd", vncpasswd)
    3.47 +
    3.48 +        # remove password
    3.49 +        config.remove(['vncpasswd', vncpasswd_vmconfig])
    3.50 +
    3.51          return ret
    3.52  
    3.53      def createDeviceModel(self):
     4.1 --- a/tools/python/xen/xm/create.py	Fri Oct 20 09:32:16 2006 +0100
     4.2 +++ b/tools/python/xen/xm/create.py	Wed Nov 01 10:30:02 2006 +0000
     4.3 @@ -104,6 +104,10 @@ gopts.opt('console_autoconnect', short='
     4.4            fn=set_true, default=0,
     4.5            use="Connect to the console after the domain is created.")
     4.6  
     4.7 +gopts.var('vncpasswd', val='NAME',
     4.8 +          fn=set_value, default=None,
     4.9 +          use="Password for VNC console on HVM domain.")
    4.10 +
    4.11  gopts.var('vncviewer', val='no|yes',
    4.12            fn=set_bool, default=None,
    4.13             use="Spawn a vncviewer listening for a vnc server in the domain.\n"
    4.14 @@ -660,6 +664,7 @@ def configure_hvm(config_image, vals):
    4.15      for a in args:
    4.16          if (vals.__dict__[a]):
    4.17              config_image.append([a, vals.__dict__[a]])
    4.18 +    config_image.append(['vncpasswd', vals.vncpasswd])
    4.19  
    4.20  def run_bootloader(vals, config_image):
    4.21      if not os.access(vals.bootloader, os.X_OK):