Skip to content

Commit

Permalink
Allow config of vncserver_proxyclient_address.
Browse files Browse the repository at this point in the history
 * Improves deployment flexibility by allowing deployers to choose which address proxies like nova-xvpvncserver should use to to connect to instance proxies.  For xenserver, this will generally be the management ip of dom0.  For libvirt, this will be the management ip of the host.
 * Fixes bug 918451
 * Renames vncserver_host to vncserver_listen for slightly better usage clarity
 * Updates docs

Change-Id: I85c9850c57ffac3dfecaec4510eb808a6a2af79c
  • Loading branch information
sleepsonthefloor committed Jan 19, 2012
1 parent 2ff3e0e commit a444e8f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
12 changes: 11 additions & 1 deletion doc/source/runnova/vncconsole.rst
Expand Up @@ -126,6 +126,16 @@ Important Options
-----------------
* :option:`--vnc_enabled=[True|False]` - defaults to True. If this flag is
not set your instances will launch without vnc support.
* :option:`--vncserver_host=[instance vncserver host]` - defaults to 127.0.0.1
* :option:`--vncserver_listen` - defaults to 127.0.0.1
This is the address that vncservers will bind, and should be overridden in
production deployments as a private address. Applies to libvirt only.
For multi-host libvirt deployments this should be set to a host
management ip on the same network as the proxies.
* :option:`--vncserver_proxyclient_address` - defaults to 127.0.0.1
This is the address that nova will instruct proxies to use when connecting to
to instance vncservers.
For all-in-one xen server domU deployments this can be set to 169.254.0.1.
For multi-host xen server domU deployments this can be set to a dom0
management ip on the same network as the proxies.
For multi-host libvirt deployments this can be set to a host
management ip on the same network as the proxies.
4 changes: 2 additions & 2 deletions nova/virt/libvirt.xml.template
Expand Up @@ -166,8 +166,8 @@
<target port='0'/>
</serial>

#if $getVar('vncserver_host', False)
<graphics type='vnc' port='-1' autoport='yes' keymap='${vnc_keymap}' listen='${vncserver_host}'/>
#if $getVar('vncserver_listen', False)
<graphics type='vnc' port='-1' autoport='yes' keymap='${vnc_keymap}' listen='${vncserver_listen}'/>
#end if
</devices>
</domain>
5 changes: 3 additions & 2 deletions nova/virt/libvirt/connection.py
Expand Up @@ -78,6 +78,7 @@

FLAGS = flags.FLAGS
flags.DECLARE('live_migration_retry_count', 'nova.compute.manager')
flags.DECLARE('vncserver_proxyclient_address', 'nova.vnc')
# TODO(vish): These flags should probably go into a shared location
flags.DEFINE_string('rescue_image_id', None, 'Rescue ami image')
flags.DEFINE_string('rescue_kernel_id', None, 'Rescue aki image')
Expand Down Expand Up @@ -782,7 +783,7 @@ def get_vnc_port_for_instance(instance_name):
return graphic.getAttribute('port')

port = get_vnc_port_for_instance(instance['name'])
host = instance['host']
host = FLAGS.vncserver_proxyclient_address

return {'host': host, 'port': port, 'internal_access_path': None}

Expand Down Expand Up @@ -1186,7 +1187,7 @@ def _prepare_xml_info(self, instance, network_info, image_meta, rescue,
xml_info['config_drive'] = xml_info['basepath'] + "/disk.config"

if FLAGS.vnc_enabled and FLAGS.libvirt_type not in ('lxc', 'uml'):
xml_info['vncserver_host'] = FLAGS.vncserver_host
xml_info['vncserver_listen'] = FLAGS.vncserver_listen
xml_info['vnc_keymap'] = FLAGS.vnc_keymap
if not rescue:
if instance['kernel_id']:
Expand Down
6 changes: 2 additions & 4 deletions nova/virt/xenapi/vmops.py
Expand Up @@ -50,6 +50,7 @@
LOG = logging.getLogger("nova.virt.xenapi.vmops")

FLAGS = flags.FLAGS
flags.DECLARE('vncserver_proxyclient_address', 'nova.vnc')
flags.DEFINE_integer('agent_version_timeout', 300,
'number of seconds to wait for agent to be fully '
'operational')
Expand All @@ -59,9 +60,6 @@
flags.DEFINE_string('xenapi_vif_driver',
'nova.virt.xenapi.vif.XenAPIBridgeDriver',
'The XenAPI VIF driver using XenServer Network APIs.')
flags.DEFINE_string('dom0_address',
'169.254.0.1',
'Ip address of dom0. Override for multi-host vnc.')
flags.DEFINE_bool('xenapi_generate_swap',
False,
'Whether to generate swap (False means fetching it'
Expand Down Expand Up @@ -1392,7 +1390,7 @@ def get_vnc_console(self, instance):
% (str(vm_ref), session_id)

# NOTE: XS5.6sp2+ use http over port 80 for xenapi com
return {'host': FLAGS.dom0_address, 'port': 80,
return {'host': FLAGS.vncserver_proxyclient_address, 'port': 80,
'internal_access_path': path}

def host_power_action(self, host, action):
Expand Down
8 changes: 6 additions & 2 deletions nova/vnc/__init__.py
Expand Up @@ -30,8 +30,12 @@
'http://127.0.0.1:6081/console',
'location of nova xvp vnc console proxy, \
in the form "http://127.0.0.1:6081/console"')
flags.DEFINE_string('vncserver_host', '127.0.0.1',
'the host interface on which vnc server should listen')
flags.DEFINE_string('vncserver_listen', '127.0.0.1',
'Ip address on which instance vncservers\
should listen')
flags.DEFINE_string('vncserver_proxyclient_address', '127.0.0.1',
'the address to which proxy clients \
(like nova-xvpvncproxy) should connect')
flags.DEFINE_bool('vnc_enabled', True,
'enable vnc related features')
flags.DEFINE_string('vnc_keymap', 'en-us',
Expand Down

0 comments on commit a444e8f

Please sign in to comment.