Make serial console configurable

Add serial_console section to nova.conf template.
The section attributes are enabled, base_url, port_range and
proxyclient_address.

Depends-On: I9c4061ea196a511f7fb306f3130db75f4ba52ff1
Closes_Bug: 1470025

Change-Id: I5336a9bc83669e7200afe68702031f2a13d1a2e0
This commit is contained in:
Zhe Jiang 2015-07-07 15:36:39 +08:00
parent 8bd3223e60
commit f78d153935
4 changed files with 62 additions and 1 deletions

View File

@ -710,3 +710,9 @@ default['openstack']['compute']['docker']['service_sock'] = '/var/run/docker.soc
default['openstack']['compute']['docker']['service_sock_mode'] = 666
# Docker group which will be created and added with openstack compute user
default['openstack']['compute']['docker']['group'] = 'docker'
# Serial console configurations
# Enable serial console related features
default['openstack']['compute']['serial_console']['enable'] = 'False'
# Range of TCP ports to use for serial ports on compute hosts
default['openstack']['compute']['serial_console']['port_range'] = '10000:20000'

View File

@ -105,6 +105,8 @@ compute_api_endpoint = internal_endpoint 'compute-api' || {}
compute_metadata_api_bind = endpoint 'compute-metadata-api-bind' || {}
ec2_api_bind = endpoint 'compute-ec2-api-bind' || {}
ec2_public_endpoint = public_endpoint 'compute-ec2-api' || {}
serial_console_bind = endpoint 'compute-serial-console-bind' || {}
serial_proxy_endpoint = endpoint 'compute-serial-proxy' || {}
network_endpoint = internal_endpoint 'network-api' || {}
image_endpoint = internal_endpoint 'image-api'
ironic_endpoint = internal_endpoint 'bare-metal-api'
@ -175,7 +177,9 @@ template '/etc/nova/nova.conf' do
identity_admin_endpoint: identity_admin_endpoint,
ironic_endpoint: ironic_endpoint,
ironic_admin_password: ironic_admin_password,
service_pass: service_pass
service_pass: service_pass,
serial_console_base_url: serial_proxy_endpoint.to_s,
serial_console_proxyclient_address: serial_console_bind.host
)
end

View File

@ -948,6 +948,39 @@ describe 'openstack-compute::nova-common' do
end
end
end
context 'serial console' do
it 'sets default serial console options set' do
[
/^enabled=False$/,
%r{base_url=ws://127.0.0.1:6083/$},
/^port_range=10000:20000$/,
/^proxyclient_address=127.0.0.1$/
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('serial_console', line)
end
end
it 'sets overide serial console options set' do
node.set['openstack']['endpoints']['compute-serial-console-bind']['bind_interface'] = 'lo'
node.set['openstack']['endpoints']['compute-serial-proxy']['scheme'] = 'wss'
node.set['openstack']['endpoints']['compute-serial-proxy']['host'] = '1.1.1.1'
node.set['openstack']['endpoints']['compute-serial-proxy']['port'] = '6082'
node.set['openstack']['compute']['serial_console']['enable'] = 'True'
node.set['openstack']['compute']['serial_console']['port_range'] = '11000:15000'
[
/^enabled=True$/,
%r{base_url=wss://1.1.1.1:6082/$},
/^port_range=11000:15000$/,
/^proxyclient_address=127.0.1.1$/
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('serial_console', line)
end
end
end
end
describe 'rootwrap.conf' do

View File

@ -947,3 +947,21 @@ filesystems=node['openstack']['compute']['image']['filesystems'].join(',')
<% end %>
<% end %>
<% end %>
[serial_console]
#
# Serial console configuration
#
# Enable serial console related features
enabled=<%= node['openstack']['compute']['serial_console']['enable'] %>
# Location of serial console proxy
base_url=<%= @serial_console_base_url %>
# Range of TCP ports to use for serial ports on compute hosts
port_range=<%= node['openstack']['compute']['serial_console']['port_range'] %>
# The address to which proxy clients (like nova-serialproxy) should connect
proxyclient_address=<%= @serial_console_proxyclient_address %>