Merge pull request #522 from enovance/spice-flexibility

spice: more flexibility in binding options
This commit is contained in:
Yanis Guenane
2014-06-26 10:56:48 -04:00
2 changed files with 36 additions and 4 deletions

View File

@@ -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
}

View File

@@ -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':