From 5f8ca4168351d57eac673d8c336b2e6129e90443 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Thu, 26 Jun 2014 14:06:05 +0200 Subject: [PATCH] spice: more flexibility in binding options Allow to use a different binding between nova services and spice. The use case is that Spice is not working well yet with SSL. With this patch, you are now able to use SSL for all services except Spice. Signed-off-by: Emilien Macchi --- manifests/compute/hypervisor.pp | 17 ++++++++++++-- spec/classes/cloud_compute_hypervisor_spec.rb | 23 +++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/manifests/compute/hypervisor.pp b/manifests/compute/hypervisor.pp index ed70358c..1253855e 100644 --- a/manifests/compute/hypervisor.pp +++ b/manifests/compute/hypervisor.pp @@ -43,6 +43,9 @@ class cloud::compute::hypervisor( $nova_rbd_secret_uuid = undef, $vm_rbd = false, $volume_rbd = false, + # set to false to keep backward compatibility + $ks_spice_public_proto = false, + $ks_spice_public_host = false, # DEPRECATED $has_ceph = false ) { @@ -61,6 +64,16 @@ class cloud::compute::hypervisor( $vm_rbd_real = $vm_rbd $volume_rbd_real = $volume_rbd } + if $ks_spice_public_proto { + $ks_spice_public_proto_real = $ks_spice_public_proto + } else { + $ks_spice_public_proto_real = $ks_nova_public_proto + } + if $ks_spice_public_host { + $ks_spice_public_host_real = $ks_spice_public_host + } else { + $ks_spice_public_host_real = $ks_nova_public_host + } file{ '/var/lib/nova/.ssh': ensure => directory, @@ -105,8 +118,8 @@ Host * class { 'nova::compute::spice': server_listen => '0.0.0.0', server_proxyclient_address => $server_proxyclient_address, - proxy_host => $ks_nova_public_host, - proxy_protocol => $ks_nova_public_proto, + proxy_host => $ks_spice_public_host_real, + proxy_protocol => $ks_spice_public_proto_real, proxy_port => $spice_port } diff --git a/spec/classes/cloud_compute_hypervisor_spec.rb b/spec/classes/cloud_compute_hypervisor_spec.rb index 2afc9f28..5973db67 100644 --- a/spec/classes/cloud_compute_hypervisor_spec.rb +++ b/spec/classes/cloud_compute_hypervisor_spec.rb @@ -79,6 +79,8 @@ describe 'cloud::compute::hypervisor' do :nova_ssh_private_key => 'secrete', :nova_ssh_public_key => 'public', :ks_nova_public_proto => 'http', + :ks_spice_public_proto => 'https', + :ks_spice_public_host => '10.0.0.2', :vm_rbd => false, :volume_rbd => false, :ks_nova_public_host => '10.0.0.1' } @@ -216,8 +218,8 @@ describe 'cloud::compute::hypervisor' do should contain_class('nova::compute::spice').with( :server_listen => '0.0.0.0', :server_proxyclient_address => '7.0.0.1', - :proxy_host => '10.0.0.1', - :proxy_protocol => 'http', + :proxy_host => '10.0.0.2', + :proxy_protocol => 'https', :proxy_port => '6082' ) end @@ -390,6 +392,23 @@ describe 'cloud::compute::hypervisor' do it_raises 'a Puppet::Error', /Red Hat does not support RBD backend for VMs./ end + context 'when configuring spice with backward compatibility' do + before :each do + params.merge!( + :ks_spice_public_proto => false, + :ks_spice_public_host => false ) + end + it 'configure spice console with nova parameters' do + should contain_class('nova::compute::spice').with( + :server_listen => '0.0.0.0', + :server_proxyclient_address => '7.0.0.1', + :proxy_host => '10.0.0.1', + :proxy_protocol => 'http', + :proxy_port => '6082' + ) + end + end + context 'when using provider external network' do let :pre_condition do "class { 'cloud::network':