# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Node ID 21406b5bc5206fef042ebcbe628b0751c0a16213
# Parent 81a80d86f77fc471f5573d45b05dbf75849a9cb8
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@xxxxxxxxxx>
---
tools/python/xen/xend/XendRoot.py | 6 ++++++
tools/python/xen/xend/image.py | 5 +++++
tools/python/xen/xm/create.py | 9 +++++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff -r 81a80d86f77f -r 21406b5bc520 tools/python/xen/xend/XendRoot.py
--- a/tools/python/xen/xend/XendRoot.py Wed Oct 04 09:42:41 2006 +0100
+++ b/tools/python/xen/xend/XendRoot.py Thu Oct 05 14:53:29 2006 +0100
@@ -92,6 +92,9 @@ class XendRoot:
dom0_min_mem_default = '0'
dom0_vcpus_default = '0'
+
+ """Default interface to listen for VNC connections on"""
+ xend_vnc_listen_default = '127.0.0.1'
"""Default session storage path."""
xend_domains_path_default = '/var/lib/xend/domains'
@@ -281,6 +284,9 @@ class XendRoot:
def get_console_limit(self):
return self.get_config_int('console-limit', 1024)
+ def get_vnclisten_address(self):
+ return self.get_config_value('vnc-listen',
self.xend_vnc_listen_default)
+
def instance():
"""Get an instance of XendRoot.
Use this instead of the constructor.
diff -r 81a80d86f77f -r 21406b5bc520 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py Wed Oct 04 09:42:41 2006 +0100
+++ b/tools/python/xen/xend/image.py Thu Oct 05 14:53:29 2006 +0100
@@ -366,6 +366,11 @@ class HVMImageHandler(ImageHandler):
else:
ret += ['-vnc', '%d' % vncdisplay]
ret += ['-k', 'en-us']
+ vnclisten = sxp.child_value(config, 'vnclisten')
+ if not(vnclisten):
+ vnclisten =
xen.xend.XendRoot.instance().get_vnclisten_address()
+ if vnclisten:
+ ret += ['-vnclisten', vnclisten]
return ret
def createDeviceModel(self):
diff -r 81a80d86f77f -r 21406b5bc520 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Wed Oct 04 09:42:41 2006 +0100
+++ b/tools/python/xen/xm/create.py Thu Oct 05 14:53:29 2006 +0100
@@ -418,6 +418,10 @@ gopts.var('vncdisplay', val='',
gopts.var('vncdisplay', val='',
fn=set_value, default=None,
use="""VNC display to use""")
+
+gopts.var('vnclisten', val='',
+ fn=set_value, default=None,
+ use="""Address for VNC server to listen on.""")
gopts.var('vncunused', val='',
fn=set_bool, default=1,
@@ -650,8 +654,9 @@ def configure_hvm(config_image, vals):
"""
args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb',
'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
- 'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'sdl', 'display',
- 'acpi', 'apic', 'xauthority', 'usb', 'usbdevice' ]
+ 'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
+ 'sdl', 'display', 'xauthority',
+ 'acpi', 'apic', 'usb', 'usbdevice' ]
for a in args:
if (vals.__dict__[a]):
config_image.append([a, vals.__dict__[a]])
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|