ia64/xen-unstable

changeset 12186:21406b5bc520

Import the Xend portion of xen-unstable changeset 11704:a95dfbc8dca8ecddcb9be51d78f446b0fa461892.

[HVM/vncserver] Implement a 'vnclisten' option to limit the interface
that the VNC server from qemu listens on.

Defaults to only listen on 127.0.0.1

The old behaviour (listen on all interfaces) can be restored, by
- changing the system-wide default in /etc/xen/xend-config.sxp by adding:
(vnc-listen '0.0.0.0')
- changing individual domain config files by adding:
vnclisten="0.0.0.0"

Also allows specifying the hostname associated with an interface to limit
to that interface.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Oct 05 14:53:29 2006 +0100 (2006-10-05)
parents 81a80d86f77f
children 07d3c36df515
files tools/python/xen/xend/XendRoot.py tools/python/xen/xend/image.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xend/XendRoot.py	Wed Oct 04 09:42:41 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendRoot.py	Thu Oct 05 14:53:29 2006 +0100
     1.3 @@ -93,6 +93,9 @@ class XendRoot:
     1.4  
     1.5      dom0_vcpus_default = '0'
     1.6  
     1.7 +    """Default interface to listen for VNC connections on"""
     1.8 +    xend_vnc_listen_default = '127.0.0.1'
     1.9 +
    1.10      """Default session storage path."""
    1.11      xend_domains_path_default = '/var/lib/xend/domains'
    1.12  
    1.13 @@ -281,6 +284,9 @@ class XendRoot:
    1.14      def get_console_limit(self):
    1.15          return self.get_config_int('console-limit', 1024)
    1.16  
    1.17 +    def get_vnclisten_address(self):
    1.18 +        return self.get_config_value('vnc-listen', self.xend_vnc_listen_default)
    1.19 +
    1.20  def instance():
    1.21      """Get an instance of XendRoot.
    1.22      Use this instead of the constructor.
     2.1 --- a/tools/python/xen/xend/image.py	Wed Oct 04 09:42:41 2006 +0100
     2.2 +++ b/tools/python/xen/xend/image.py	Thu Oct 05 14:53:29 2006 +0100
     2.3 @@ -366,6 +366,11 @@ class HVMImageHandler(ImageHandler):
     2.4              else:
     2.5                  ret += ['-vnc', '%d' % vncdisplay]
     2.6              ret += ['-k', 'en-us']
     2.7 +            vnclisten = sxp.child_value(config, 'vnclisten')
     2.8 +            if not(vnclisten):
     2.9 +                vnclisten = xen.xend.XendRoot.instance().get_vnclisten_address()
    2.10 +            if vnclisten:
    2.11 +                ret += ['-vnclisten', vnclisten]
    2.12          return ret
    2.13  
    2.14      def createDeviceModel(self):
     3.1 --- a/tools/python/xen/xm/create.py	Wed Oct 04 09:42:41 2006 +0100
     3.2 +++ b/tools/python/xen/xm/create.py	Thu Oct 05 14:53:29 2006 +0100
     3.3 @@ -419,6 +419,10 @@ gopts.var('vncdisplay', val='',
     3.4            fn=set_value, default=None,
     3.5            use="""VNC display to use""")
     3.6  
     3.7 +gopts.var('vnclisten', val='',
     3.8 +          fn=set_value, default=None,
     3.9 +          use="""Address for VNC server to listen on.""")
    3.10 +
    3.11  gopts.var('vncunused', val='',
    3.12            fn=set_bool, default=1,
    3.13            use="""Try to find an unused port for the VNC server.
    3.14 @@ -650,8 +654,9 @@ def configure_hvm(config_image, vals):
    3.15      """
    3.16      args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb',
    3.17               'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
    3.18 -             'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'sdl', 'display',
    3.19 -             'acpi', 'apic', 'xauthority', 'usb', 'usbdevice' ]
    3.20 +             'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
    3.21 +             'sdl', 'display', 'xauthority',
    3.22 +             'acpi', 'apic', 'usb', 'usbdevice' ]
    3.23      for a in args:
    3.24          if (vals.__dict__[a]):
    3.25              config_image.append([a, vals.__dict__[a]])