Add serialproxy configuration
Configure the serial proxy feature recently added in Juno There's no built in way in openstack to test this. to check the patch you'll need this utility: https://github.com/larsks/novaconsole/ Change-Id: I593ebb0f4ce8cae00671230022516f9bbcbe4e9a
This commit is contained in:
40
manifests/compute/serial.pp
Normal file
40
manifests/compute/serial.pp
Normal file
@@ -0,0 +1,40 @@
|
||||
# == Class: nova::compute::serial
|
||||
#
|
||||
# Configures nova serial console
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*port_range]
|
||||
# (optional) Range of TCP ports to use for serial ports on compute hosts
|
||||
# Defaults to 10000:20000
|
||||
#
|
||||
# [*base_url*]
|
||||
# (optional) URL that gets passed to the clients
|
||||
# Defaults to 'ws://127.0.0.1:6083/'
|
||||
#
|
||||
# [*listen]
|
||||
# IP address on which instance serial console should listen
|
||||
# Defaults to 127.0.0.1
|
||||
#
|
||||
# [*proxyclient_address*]
|
||||
# The address to which proxy clients (like nova-serialproxy)
|
||||
# should connect (string value)
|
||||
# Defaults to 127.0.0.1
|
||||
|
||||
|
||||
class nova::compute::serial(
|
||||
$port_range = '10000:20000',
|
||||
$base_url = 'ws://127.0.0.1:6083/',
|
||||
$listen = '127.0.0.1',
|
||||
$proxyclient_address = '127.0.0.1',
|
||||
) {
|
||||
|
||||
|
||||
nova_config {
|
||||
'serial_console/enabled': value => true;
|
||||
'serial_console/port_range': value => $port_range;
|
||||
'serial_console/base_url': value => $base_url;
|
||||
'serial_console/listen': value => $listen;
|
||||
'serial_console/proxyclient_address': value => $proxyclient_address;
|
||||
}
|
||||
}
|
@@ -22,6 +22,7 @@ class nova::params {
|
||||
$scheduler_package_name = 'openstack-nova-scheduler'
|
||||
$tgt_package_name = 'scsi-target-utils'
|
||||
$vncproxy_package_name = 'openstack-nova-novncproxy'
|
||||
$serialproxy_package_name = 'openstack-nova-serialproxy'
|
||||
$spicehtml5proxy_package_name = 'openstack-nova-console'
|
||||
# service names
|
||||
$api_service_name = 'openstack-nova-api'
|
||||
@@ -36,6 +37,7 @@ class nova::params {
|
||||
$scheduler_service_name = 'openstack-nova-scheduler'
|
||||
$tgt_service_name = 'tgtd'
|
||||
$vncproxy_service_name = 'openstack-nova-novncproxy'
|
||||
$serialproxy_service_name = 'openstack-nova-serialproxy'
|
||||
$spicehtml5proxy_service_name = 'openstack-nova-spicehtml5proxy'
|
||||
# redhat specific config defaults
|
||||
$root_helper = 'sudo nova-rootwrap'
|
||||
@@ -72,6 +74,7 @@ class nova::params {
|
||||
$objectstore_package_name = 'nova-objectstore'
|
||||
$scheduler_package_name = 'nova-scheduler'
|
||||
$tgt_package_name = 'tgt'
|
||||
$serialproxy_package_name = 'nova-serialproxy'
|
||||
# service names
|
||||
$api_service_name = 'nova-api'
|
||||
$cells_service_name = 'nova-cells'
|
||||
@@ -84,6 +87,7 @@ class nova::params {
|
||||
$objectstore_service_name = 'nova-objectstore'
|
||||
$scheduler_service_name = 'nova-scheduler'
|
||||
$vncproxy_service_name = 'nova-novncproxy'
|
||||
$serialproxy_service_name = 'nova-serialproxy'
|
||||
$tgt_service_name = 'tgt'
|
||||
# debian specific nova config
|
||||
$root_helper = 'sudo nova-rootwrap'
|
||||
|
50
manifests/serialproxy.pp
Normal file
50
manifests/serialproxy.pp
Normal file
@@ -0,0 +1,50 @@
|
||||
# == Class: nova:serialproxy
|
||||
#
|
||||
# Configures nova serialproxy
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Whether to run the serialproxy service
|
||||
# Defaults to false
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) Whether to start/stop the service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*serialproxy_host*]
|
||||
# (optional) Host on which to listen for incoming requests
|
||||
# Defaults to '0.0.0.0'
|
||||
#
|
||||
# [*serialproxy_port*]
|
||||
# (optional) Port on which to listen for incoming requests
|
||||
# Defaults to '6083'
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) The state of the nova-serialproxy package
|
||||
# Defaults to 'present'
|
||||
#
|
||||
class nova::serialproxy(
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
$serialproxy_host = '0.0.0.0',
|
||||
$serialproxy_port = '6083',
|
||||
$ensure_package = 'present'
|
||||
) {
|
||||
|
||||
include nova::params
|
||||
|
||||
nova_config {
|
||||
'serial_console/serialproxy_port': value => $serialproxy_port;
|
||||
'serial_console/serialproxy_host': value => $serialproxy_host;
|
||||
}
|
||||
|
||||
nova::generic_service { 'serialproxy':
|
||||
enabled => $enabled,
|
||||
manage_service => $manage_service,
|
||||
package_name => $::nova::params::serialproxy_package_name,
|
||||
service_name => $::nova::params::serialproxy_service_name,
|
||||
ensure_package => $ensure_package
|
||||
}
|
||||
|
||||
}
|
21
spec/classes/nova_compute_serial_spec.rb
Normal file
21
spec/classes/nova_compute_serial_spec.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require 'spec_helper'
|
||||
describe 'nova::compute::serial' do
|
||||
|
||||
it { should contain_nova_config('serial_console/enabled').with_value('true') }
|
||||
it { should contain_nova_config('serial_console/port_range').with_value('10000:20000')}
|
||||
it { should contain_nova_config('serial_console/base_url').with_value('ws://127.0.0.1:6083/')}
|
||||
it { should contain_nova_config('serial_console/listen').with_value('127.0.0.1')}
|
||||
it { should contain_nova_config('serial_console/proxyclient_address').with_value('127.0.0.1')}
|
||||
|
||||
context 'when overriding params' do
|
||||
let :params do
|
||||
{
|
||||
:proxyclient_address => '10.10.10.10',
|
||||
:listen => '10.10.11.11',
|
||||
}
|
||||
end
|
||||
it { should contain_nova_config('serial_console/proxyclient_address').with_value('10.10.10.10')}
|
||||
it { should contain_nova_config('serial_console/listen').with_value('10.10.11.11')}
|
||||
end
|
||||
|
||||
end
|
92
spec/classes/nova_serial_proxy_spec.rb
Normal file
92
spec/classes/nova_serial_proxy_spec.rb
Normal file
@@ -0,0 +1,92 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'nova::serialproxy' do
|
||||
|
||||
let :pre_condition do
|
||||
'include nova'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :enabled => true }
|
||||
end
|
||||
|
||||
shared_examples 'nova-serialproxy' do
|
||||
|
||||
it 'configures nova.conf' do
|
||||
should contain_nova_config('serial_console/serialproxy_host').with(:value => '0.0.0.0')
|
||||
should contain_nova_config('serial_console/serialproxy_port').with(:value => '6083')
|
||||
end
|
||||
|
||||
it { should contain_package('nova-serialproxy').with(
|
||||
:name => platform_params[:serialproxy_package_name],
|
||||
:ensure => 'present'
|
||||
) }
|
||||
|
||||
it { should contain_service('nova-serialproxy').with(
|
||||
:name => platform_params[:serialproxy_service_name],
|
||||
:hasstatus => 'true',
|
||||
:ensure => 'running'
|
||||
)}
|
||||
|
||||
context 'with manage_service as false' do
|
||||
let :params do
|
||||
{ :enabled => true,
|
||||
:manage_service => false
|
||||
}
|
||||
end
|
||||
it { should contain_service('nova-serialproxy').without_ensure }
|
||||
end
|
||||
|
||||
context 'with package version' do
|
||||
let :params do
|
||||
{ :ensure_package => '2012.2' }
|
||||
end
|
||||
|
||||
it { should contain_package('nova-serialproxy').with(
|
||||
:ensure => params[:ensure_package]
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Ubuntu system' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :serialproxy_package_name => 'nova-serialproxy',
|
||||
:serialproxy_service_name => 'nova-serialproxy' }
|
||||
end
|
||||
|
||||
it_configures 'nova-serialproxy'
|
||||
end
|
||||
|
||||
context 'on Debian system' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :serialproxy_package_name => 'nova-serialproxy',
|
||||
:serialproxy_service_name => 'nova-serialproxy' }
|
||||
end
|
||||
|
||||
it_configures 'nova-serialproxy'
|
||||
end
|
||||
|
||||
context 'on Redhat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :serialproxy_package_name => 'openstack-nova-serialproxy',
|
||||
:serialproxy_service_name => 'openstack-nova-serialproxy' }
|
||||
end
|
||||
|
||||
it_configures 'nova-serialproxy'
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user