Merge lp:~gnuoy/charms/trusty/nova-compute/add-console-access into lp:~openstack-charmers-archive/charms/trusty/nova-compute/next

Proposed by Liam Young on 2014-07-10
Status: Merged
Merged at revision: 75
Proposed branch: lp:~gnuoy/charms/trusty/nova-compute/add-console-access
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/next
Diff against target: 113 lines (+68/-2)
3 files modified
hooks/nova_compute_context.py (+36/-1)
hooks/nova_compute_utils.py (+3/-1)
templates/havana/nova.conf (+29/-0)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/nova-compute/add-console-access
Reviewer Review Type Date Requested Status
OpenStack Charmers 2014-07-10 Pending
Review via email: mp+226320@code.launchpad.net

Description of the change

Add support for console access via a proxy running on nova-cloud-controller

To post a comment you must log in.
79. By Liam Young on 2014-07-29

Rebased

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/nova_compute_context.py'
2--- hooks/nova_compute_context.py 2014-07-25 09:40:47 +0000
3+++ hooks/nova_compute_context.py 2014-07-29 15:30:08 +0000
4@@ -310,7 +310,42 @@
5
6 if self.restart_trigger():
7 ctxt['restart_trigger'] = self.restart_trigger()
8-
9+ return ctxt
10+
11+
12+class InstanceConsoleContext(context.OSContextGenerator):
13+ interfaces = []
14+
15+ def get_console_info(self, proto, **kwargs):
16+ console_settings = {
17+ proto + '_proxy_address':
18+ relation_get('console_proxy_%s_address' % (proto), **kwargs),
19+ proto + '_proxy_host':
20+ relation_get('console_proxy_%s_host' % (proto), **kwargs),
21+ proto + '_proxy_port':
22+ relation_get('console_proxy_%s_port' % (proto), **kwargs),
23+ }
24+ return console_settings
25+
26+ def __call__(self):
27+ ctxt = {}
28+ for rid in relation_ids('cloud-compute'):
29+ for unit in related_units(rid):
30+ rel = {'rid': rid, 'unit': unit}
31+ proto = relation_get('console_access_protocol', **rel)
32+ if not proto:
33+ # only bother with units that have a proto set.
34+ continue
35+ ctxt['console_keymap'] = relation_get('console_keymap', **rel)
36+ ctxt['console_access_protocol'] = proto
37+ ctxt['console_vnc_type'] = True if 'vnc' in proto else False
38+ if proto == 'vnc':
39+ ctxt = dict(ctxt, **self.get_console_info('xvpvnc', **rel))
40+ ctxt = dict(ctxt, **self.get_console_info('novnc', **rel))
41+ else:
42+ ctxt = dict(ctxt, **self.get_console_info(proto, **rel))
43+ break
44+ ctxt['console_listen_addr'] = get_host_ip(unit_get('private-address'))
45 return ctxt
46
47
48
49=== modified file 'hooks/nova_compute_utils.py'
50--- hooks/nova_compute_utils.py 2014-06-24 13:44:41 +0000
51+++ hooks/nova_compute_utils.py 2014-07-29 15:30:08 +0000
52@@ -32,6 +32,7 @@
53 NovaComputeLibvirtContext,
54 NovaComputeCephContext,
55 NeutronComputeContext,
56+ InstanceConsoleContext,
57 )
58
59 CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt'
60@@ -77,7 +78,8 @@
61 context.SubordinateConfigContext(
62 interface='nova-ceilometer',
63 service='nova',
64- config_file=NOVA_CONF)],
65+ config_file=NOVA_CONF),
66+ InstanceConsoleContext(), ],
67 },
68 }
69
70
71=== modified file 'templates/havana/nova.conf'
72--- templates/havana/nova.conf 2014-06-23 13:08:14 +0000
73+++ templates/havana/nova.conf 2014-07-29 15:30:08 +0000
74@@ -36,6 +36,25 @@
75 rbd_secret_uuid = {{ rbd_secret_uuid }}
76 {% endif -%}
77
78+{% if console_vnc_type -%}
79+vnc_enabled = True
80+novnc_enabled = True
81+vnc_keymap = {{ console_keymap }}
82+vncserver_listen = 0.0.0.0
83+vncserver_proxyclient_address = {{ console_listen_addr }}
84+{% if console_access_protocol == 'novnc' or console_access_protocol == 'vnc' -%}
85+novncproxy_base_url = {{ novnc_proxy_address }}
86+{% endif -%}
87+{% if console_access_protocol == 'xvpvnc' or console_access_protocol == 'vnc' -%}
88+xvpvncproxy_port = {{ xvpvnc_proxy_port }}
89+xvpvncproxy_host = {{ xvpvnc_proxy_host }}
90+xvpvncproxy_base_url = {{ xvpvnc_proxy_address }}
91+{% endif -%}
92+{% else -%}
93+vnc_enabled = False
94+novnc_enabled = False
95+{% endif -%}
96+
97 {% if neutron_plugin and neutron_plugin == 'ovs' -%}
98 libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtGenericVIFDriver
99 {% if neutron_security_groups -%}
100@@ -85,3 +104,13 @@
101 {{ key }} = {{ value }}
102 {% endfor -%}
103 {% endif -%}
104+
105+{% if console_access_protocol == 'spice' -%}
106+[spice]
107+agent_enabled = True
108+enabled = True
109+html5proxy_base_url = {{ spice_proxy_address }}
110+keymap = {{ console_keymap }}
111+server_listen = 0.0.0.0
112+server_proxyclient_address = {{ console_listen_addr }}
113+{% endif -%}

Subscribers

People subscribed via source and target branches