Add html5 spice support
Change-Id: Idd23170df13bff7f78112fbe72f228bf84112af9
This commit is contained in:
65
manifests/compute/spice.pp
Normal file
65
manifests/compute/spice.pp
Normal file
@@ -0,0 +1,65 @@
|
||||
# == Class: nova::compute::spice
|
||||
#
|
||||
# Configure spice on the compute side
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*agent_enabled*]
|
||||
# (optional) enable spice guest agent support
|
||||
# true/false
|
||||
#
|
||||
# [*server_listen*]
|
||||
# (optional) IP address on which instance spice servers should listen
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*server_proxyclient_address*]
|
||||
# (optional) Management IP Address on which instance spiceservers will
|
||||
# listen on the compute host.
|
||||
# Defaults to 127.0.0.1
|
||||
#
|
||||
# [*keymap*]
|
||||
# (optional) keymap for spice
|
||||
# Defaults to en-us
|
||||
#
|
||||
# [*proxy_host*]
|
||||
# (optional) Host for the html5 console proxy
|
||||
# Defaults to false
|
||||
#
|
||||
# [*proxy_port*]
|
||||
# (optional) Port for the html5 console proxy
|
||||
# Defaults to 6082
|
||||
#
|
||||
# [*proxy_protocol*]
|
||||
# (optional) Protocol for the html5 console proxy
|
||||
# Defaults to http
|
||||
#
|
||||
# [*proxy_path*]
|
||||
# (optional) Path of the spice html file for the html5 console proxy
|
||||
# Defaults to /spice_auto.html
|
||||
#
|
||||
class nova::compute::spice(
|
||||
$agent_enabled = true,
|
||||
$server_listen = undef,
|
||||
$server_proxyclient_address = '127.0.0.1',
|
||||
$keymap = 'en-us',
|
||||
$proxy_host = false,
|
||||
$proxy_protocol = 'http',
|
||||
$proxy_port = '6082',
|
||||
$proxy_path = '/spice_auto.html'
|
||||
) {
|
||||
|
||||
if $proxy_host {
|
||||
$html5proxy_base_url = "${proxy_protocol}://${proxy_host}:${proxy_port}${proxy_path}"
|
||||
nova_config {
|
||||
'spice/html5proxy_base_url': value => $html5proxy_base_url;
|
||||
}
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'spice/enabled': value => true;
|
||||
'spice/agent_enabled': value => $agent_enabled;
|
||||
'spice/server_listen': value => $server_listen;
|
||||
'spice/server_proxyclient_address': value => $server_proxyclient_address;
|
||||
'spice/keymap': value => $keymap;
|
||||
}
|
||||
}
|
@@ -5,37 +5,39 @@ class nova::params {
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
# package names
|
||||
$api_package_name = 'openstack-nova-api'
|
||||
$cert_package_name = 'openstack-nova-cert'
|
||||
$common_package_name = 'openstack-nova-common'
|
||||
$compute_package_name = 'openstack-nova-compute'
|
||||
$conductor_package_name = 'openstack-nova-conductor'
|
||||
$consoleauth_package_name = 'openstack-nova-console'
|
||||
$doc_package_name = 'openstack-nova-doc'
|
||||
$libvirt_package_name = 'libvirt'
|
||||
$network_package_name = 'openstack-nova-network'
|
||||
$numpy_package_name = 'numpy'
|
||||
$objectstore_package_name = 'openstack-nova-objectstore'
|
||||
$scheduler_package_name = 'openstack-nova-scheduler'
|
||||
$tgt_package_name = 'scsi-target-utils'
|
||||
$volume_package_name = 'openstack-nova-volume'
|
||||
$vncproxy_package_name = 'openstack-nova-novncproxy'
|
||||
$api_package_name = 'openstack-nova-api'
|
||||
$cert_package_name = 'openstack-nova-cert'
|
||||
$common_package_name = 'openstack-nova-common'
|
||||
$compute_package_name = 'openstack-nova-compute'
|
||||
$conductor_package_name = 'openstack-nova-conductor'
|
||||
$consoleauth_package_name = 'openstack-nova-console'
|
||||
$doc_package_name = 'openstack-nova-doc'
|
||||
$libvirt_package_name = 'libvirt'
|
||||
$network_package_name = 'openstack-nova-network'
|
||||
$numpy_package_name = 'numpy'
|
||||
$objectstore_package_name = 'openstack-nova-objectstore'
|
||||
$scheduler_package_name = 'openstack-nova-scheduler'
|
||||
$tgt_package_name = 'scsi-target-utils'
|
||||
$volume_package_name = 'openstack-nova-volume'
|
||||
$vncproxy_package_name = 'openstack-nova-novncproxy'
|
||||
$spicehtml5proxy_package_name = 'openstack-nova-console'
|
||||
# service names
|
||||
$api_service_name = 'openstack-nova-api'
|
||||
$cert_service_name = 'openstack-nova-cert'
|
||||
$compute_service_name = 'openstack-nova-compute'
|
||||
$conductor_service_name = 'openstack-nova-conductor'
|
||||
$consoleauth_service_name = 'openstack-nova-consoleauth'
|
||||
$libvirt_service_name = 'libvirtd'
|
||||
$network_service_name = 'openstack-nova-network'
|
||||
$objectstore_service_name = 'openstack-nova-objectstore'
|
||||
$scheduler_service_name = 'openstack-nova-scheduler'
|
||||
$tgt_service_name = 'tgtd'
|
||||
$vncproxy_service_name = 'openstack-nova-novncproxy'
|
||||
$volume_service_name = 'openstack-nova-volume'
|
||||
$api_service_name = 'openstack-nova-api'
|
||||
$cert_service_name = 'openstack-nova-cert'
|
||||
$compute_service_name = 'openstack-nova-compute'
|
||||
$conductor_service_name = 'openstack-nova-conductor'
|
||||
$consoleauth_service_name = 'openstack-nova-consoleauth'
|
||||
$libvirt_service_name = 'libvirtd'
|
||||
$network_service_name = 'openstack-nova-network'
|
||||
$objectstore_service_name = 'openstack-nova-objectstore'
|
||||
$scheduler_service_name = 'openstack-nova-scheduler'
|
||||
$tgt_service_name = 'tgtd'
|
||||
$vncproxy_service_name = 'openstack-nova-novncproxy'
|
||||
$spicehtml5proxy_service_name = 'openstack-nova-spicehtml5proxy'
|
||||
$volume_service_name = 'openstack-nova-volume'
|
||||
# redhat specific config defaults
|
||||
$root_helper = 'sudo nova-rootwrap'
|
||||
$lock_path = '/var/lib/nova/tmp'
|
||||
$root_helper = 'sudo nova-rootwrap'
|
||||
$lock_path = '/var/lib/nova/tmp'
|
||||
case $::operatingsystem {
|
||||
'RedHat': {
|
||||
$special_service_provider = 'init'
|
||||
@@ -47,43 +49,46 @@ class nova::params {
|
||||
}
|
||||
'Debian': {
|
||||
# package names
|
||||
$api_package_name = 'nova-api'
|
||||
$cert_package_name = 'nova-cert'
|
||||
$common_package_name = 'nova-common'
|
||||
$compute_package_name = 'nova-compute'
|
||||
$conductor_package_name = 'nova-conductor'
|
||||
$consoleauth_package_name = 'nova-consoleauth'
|
||||
$doc_package_name = 'nova-doc'
|
||||
$libvirt_package_name = 'libvirt-bin'
|
||||
$network_package_name = 'nova-network'
|
||||
$numpy_package_name = 'python-numpy'
|
||||
$objectstore_package_name = 'nova-objectstore'
|
||||
$scheduler_package_name = 'nova-scheduler'
|
||||
$tgt_package_name = 'tgt'
|
||||
$volume_package_name = 'nova-volume'
|
||||
$api_package_name = 'nova-api'
|
||||
$cert_package_name = 'nova-cert'
|
||||
$common_package_name = 'nova-common'
|
||||
$compute_package_name = 'nova-compute'
|
||||
$conductor_package_name = 'nova-conductor'
|
||||
$consoleauth_package_name = 'nova-consoleauth'
|
||||
$doc_package_name = 'nova-doc'
|
||||
$libvirt_package_name = 'libvirt-bin'
|
||||
$network_package_name = 'nova-network'
|
||||
$numpy_package_name = 'python-numpy'
|
||||
$objectstore_package_name = 'nova-objectstore'
|
||||
$scheduler_package_name = 'nova-scheduler'
|
||||
$tgt_package_name = 'tgt'
|
||||
$volume_package_name = 'nova-volume'
|
||||
# service names
|
||||
$api_service_name = 'nova-api'
|
||||
$cert_service_name = 'nova-cert'
|
||||
$compute_service_name = 'nova-compute'
|
||||
$conductor_service_name = 'nova-conductor'
|
||||
$consoleauth_service_name = 'nova-consoleauth'
|
||||
$libvirt_service_name = 'libvirt-bin'
|
||||
$network_service_name = 'nova-network'
|
||||
$objectstore_service_name = 'nova-objectstore'
|
||||
$scheduler_service_name = 'nova-scheduler'
|
||||
$volume_service_name = 'nova-volume'
|
||||
$tgt_service_name = 'tgt'
|
||||
$api_service_name = 'nova-api'
|
||||
$cert_service_name = 'nova-cert'
|
||||
$compute_service_name = 'nova-compute'
|
||||
$conductor_service_name = 'nova-conductor'
|
||||
$consoleauth_service_name = 'nova-consoleauth'
|
||||
$libvirt_service_name = 'libvirt-bin'
|
||||
$network_service_name = 'nova-network'
|
||||
$objectstore_service_name = 'nova-objectstore'
|
||||
$scheduler_service_name = 'nova-scheduler'
|
||||
$volume_service_name = 'nova-volume'
|
||||
$spicehtml5proxy_service_name = 'nova-spicehtml5proxy'
|
||||
$tgt_service_name = 'tgt'
|
||||
# debian specific nova config
|
||||
$root_helper = 'sudo nova-rootwrap'
|
||||
$lock_path = '/var/lock/nova'
|
||||
$root_helper = 'sudo nova-rootwrap'
|
||||
$lock_path = '/var/lock/nova'
|
||||
case $::operatingsystem {
|
||||
'Debian': {
|
||||
$spicehtml5proxy_package_name = 'nova-consoleproxy'
|
||||
$vncproxy_package_name = 'novnc'
|
||||
$vncproxy_service_name = 'novnc'
|
||||
# Use default provider on Debian
|
||||
$special_service_provider = undef
|
||||
}
|
||||
default: {
|
||||
$spicehtml5proxy_package_name = 'nova-spicehtml5proxy'
|
||||
$vncproxy_package_name = ['novnc', 'nova-novncproxy']
|
||||
$vncproxy_service_name = 'nova-novncproxy'
|
||||
# some of the services need to be started form the special upstart provider
|
||||
|
48
manifests/spicehtml5proxy.pp
Normal file
48
manifests/spicehtml5proxy.pp
Normal file
@@ -0,0 +1,48 @@
|
||||
# == Class: nova::spice
|
||||
#
|
||||
# Configure spicehtml5 proxy
|
||||
#
|
||||
# SPICE is a new protocol which aims to address all the limitations in VNC,
|
||||
# to provide good remote desktop support. This class aim to configure the nova
|
||||
# services in charge of proxing websocket spicehtml5 request to kvm spice
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) enable spicehtml5proxy service
|
||||
# true/false
|
||||
#
|
||||
# [*host*]
|
||||
# (optional) Listen address for the html5 console proxy
|
||||
# Defaults to 0.0.0.0
|
||||
#
|
||||
# [*port*]
|
||||
# (optional) Listen port for the html5 console proxy
|
||||
# Defaults to 6082
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) Ensure package state
|
||||
# Defaults to 'present'
|
||||
#
|
||||
class nova::spicehtml5proxy(
|
||||
$enabled = false,
|
||||
$host = '0.0.0.0',
|
||||
$port = '6082',
|
||||
$ensure_package = 'present'
|
||||
) {
|
||||
|
||||
include nova::params
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/spicehtml5proxy_host': value => $host;
|
||||
'DEFAULT/spicehtml5proxy_port': value => $port;
|
||||
}
|
||||
|
||||
nova::generic_service { 'spicehtml5proxy':
|
||||
enabled => $enabled,
|
||||
package_name => $::nova::params::spicehtml5proxy_package_name,
|
||||
service_name => $::nova::params::spicehtml5proxy_service_name,
|
||||
ensure_package => $ensure_package,
|
||||
}
|
||||
}
|
||||
|
@@ -19,11 +19,12 @@ class nova::vncproxy(
|
||||
'DEFAULT/novncproxy_port': value => $port;
|
||||
}
|
||||
|
||||
package { 'python-numpy':
|
||||
name => $::nova::params::numpy_package_name,
|
||||
ensure => present,
|
||||
if ! defined(Package['python-numpy']) {
|
||||
package { 'python-numpy':
|
||||
name => $::nova::params::numpy_package_name,
|
||||
ensure => present,
|
||||
}
|
||||
}
|
||||
|
||||
nova::generic_service { 'vncproxy':
|
||||
enabled => $enabled,
|
||||
package_name => $::nova::params::vncproxy_package_name,
|
||||
|
23
spec/classes/nova_compute_spice_spec.rb
Normal file
23
spec/classes/nova_compute_spice_spec.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
require 'spec_helper'
|
||||
describe 'nova::compute::spice' do
|
||||
|
||||
it { should contain_nova_config('spice/enabled').with_value('true')}
|
||||
it { should contain_nova_config('spice/agent_enabled').with_value('true')}
|
||||
it { should contain_nova_config('spice/server_proxyclient_address').with_value('127.0.0.1')}
|
||||
it { should_not contain_nova_config('spice/html5proxy_base_url')}
|
||||
it { should contain_nova_config('spice/server_listen').with_value(nil)}
|
||||
|
||||
context 'when overriding params' do
|
||||
let :params do
|
||||
{
|
||||
:proxy_host => '10.10.10.10',
|
||||
:server_listen => '10.10.11.11',
|
||||
:agent_enabled => false
|
||||
}
|
||||
end
|
||||
it { should contain_nova_config('spice/html5proxy_base_url').with_value('http://10.10.10.10:6082/spice_auto.html')}
|
||||
it { should contain_nova_config('spice/server_listen').with_value('10.10.11.11')}
|
||||
it { should contain_nova_config('spice/agent_enabled').with_value('false')}
|
||||
end
|
||||
|
||||
end
|
68
spec/classes/nova_spicehtml5_proxy_spec.rb
Normal file
68
spec/classes/nova_spicehtml5_proxy_spec.rb
Normal file
@@ -0,0 +1,68 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'nova::spicehtml5proxy' do
|
||||
|
||||
let :pre_condition do
|
||||
'include nova'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{:enabled => true}
|
||||
end
|
||||
|
||||
describe 'on debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
it { should contain_nova_config('DEFAULT/spicehtml5proxy_host').with(:value => '0.0.0.0') }
|
||||
it { should contain_nova_config('DEFAULT/spicehtml5proxy_port').with(:value => '6082') }
|
||||
|
||||
it { should contain_package('nova-spicehtml5proxy').with(
|
||||
:name => 'nova-spicehtml5proxy',
|
||||
:ensure => 'present'
|
||||
) }
|
||||
it { should contain_service('nova-spicehtml5proxy').with(
|
||||
:name => 'nova-spicehtml5proxy',
|
||||
:hasstatus => 'true',
|
||||
:ensure => 'running'
|
||||
)}
|
||||
|
||||
describe 'with package version' do
|
||||
let :params do
|
||||
{:ensure_package => '2012.1-2'}
|
||||
end
|
||||
it { should contain_package('nova-spicehtml5proxy').with(
|
||||
'ensure' => '2012.1-2'
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'on debian system' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
}
|
||||
end
|
||||
it { should contain_package('nova-spicehtml5proxy').with(
|
||||
:name => 'nova-consoleproxy'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'on Redhatish platforms' do
|
||||
|
||||
let :facts do
|
||||
{ :osfamily => 'Redhat' }
|
||||
end
|
||||
it { should contain_service('nova-spicehtml5proxy').with(
|
||||
:name => 'openstack-nova-spicehtml5proxy',
|
||||
:hasstatus => 'true',
|
||||
:ensure => 'running'
|
||||
)}
|
||||
it { should contain_package('nova-spicehtml5proxy').with(
|
||||
:name => 'openstack-nova-console'
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user