diff --git a/manifests/compute/hypervisor.pp b/manifests/compute/hypervisor.pp index 84ece3fd..cb7fa4ce 100644 --- a/manifests/compute/hypervisor.pp +++ b/manifests/compute/hypervisor.pp @@ -102,6 +102,13 @@ Host * mode => '0644', notify => Service['libvirtd'] } + # Nova support for RBD backend is not supported in Red Hat packages + if $has_ceph { + warning('Red Hat does not support RBD backend for VMs.') + } + $has_ceph_real = false + } else { + $has_ceph_real = $has_ceph } if $::operatingsystem == 'Ubuntu' { @@ -118,7 +125,7 @@ Host * class { 'nova::compute::neutron': } - if $has_ceph { + if $has_ceph_real { $libvirt_disk_cachemodes_real = ['network=writeback'] include 'cloud::storage::rbd' diff --git a/spec/classes/cloud_compute_hypervisor_spec.rb b/spec/classes/cloud_compute_hypervisor_spec.rb index d56a05ad..c2d93704 100644 --- a/spec/classes/cloud_compute_hypervisor_spec.rb +++ b/spec/classes/cloud_compute_hypervisor_spec.rb @@ -70,10 +70,7 @@ describe 'cloud::compute::hypervisor' do { :libvirt_type => 'kvm', :server_proxyclient_address => '7.0.0.1', :spice_port => '6082', - :has_ceph => true, - :cinder_rbd_user => 'cinder', - :nova_rbd_pool => 'nova', - :nova_rbd_secret_uuid => 'secrete', + :has_ceph => false, :nova_ssh_private_key => 'secrete', :nova_ssh_public_key => 'public', :ks_nova_public_proto => 'http', @@ -213,15 +210,6 @@ describe 'cloud::compute::hypervisor' do ) end - it 'configure libvirt driver' do - should contain_class('nova::compute::libvirt').with( - :libvirt_type => 'kvm', - :vncserver_listen => '0.0.0.0', - :migration_support => true, - :libvirt_disk_cachemodes => ['network=writeback'] - ) - end - it 'configure nova compute with neutron' do should contain_class('nova::compute::neutron') end @@ -230,18 +218,17 @@ describe 'cloud::compute::hypervisor' do should contain_class('ceilometer::agent::compute') end - it 'configure nova-compute to support RBD backend' do - should contain_nova_config('DEFAULT/libvirt_images_type').with('value' => 'rbd') - should contain_nova_config('DEFAULT/libvirt_images_rbd_pool').with('value' => 'nova') - should contain_nova_config('DEFAULT/libvirt_images_rbd_ceph_conf').with('value' => '/etc/ceph/ceph.conf') - should contain_nova_config('DEFAULT/rbd_user').with('value' => 'cinder') - should contain_nova_config('DEFAULT/rbd_secret_uuid').with('value' => 'secrete') - should contain_group('cephkeyring').with(:ensure => 'present') - should contain_exec('add-nova-to-group').with( - :command => 'usermod -a -G cephkeyring nova', - :unless => 'groups nova | grep cephkeyring', - :path => ['/usr/sbin', '/usr/bin', '/bin', '/sbin'] - ) + it 'should not configure nova-compute for RBD backend' do + should_not contain_nova_config('DEFAULT/rbd_user').with('value' => 'cinder') + end + + it 'configure libvirt driver without disk cachemodes' do + should contain_class('nova::compute::libvirt').with( + :libvirt_type => 'kvm', + :vncserver_listen => '0.0.0.0', + :migration_support => true, + :libvirt_disk_cachemodes => [] + ) end it 'configure nova-compute with extra parameters' do @@ -267,23 +254,59 @@ describe 'cloud::compute::hypervisor' do end end - context 'without RBD backend' do + context 'with RBD backend on Debian plaforms' do before :each do - params.merge!( :has_ceph => false ) + facts.merge!( :osfamily => 'Debian' ) + params.merge!( + :has_ceph => true, + :cinder_rbd_user => 'cinder', + :nova_rbd_pool => 'nova', + :nova_rbd_secret_uuid => 'secrete' ) end - it 'should not configure nova-compute for RBD backend' do - should_not contain_nova_config('DEFAULT/rbd_user').with('value' => 'cinder') + it 'configure nova-compute to support RBD backend' do + should contain_nova_config('DEFAULT/libvirt_images_type').with('value' => 'rbd') + should contain_nova_config('DEFAULT/libvirt_images_rbd_pool').with('value' => 'nova') + should contain_nova_config('DEFAULT/libvirt_images_rbd_ceph_conf').with('value' => '/etc/ceph/ceph.conf') + should contain_nova_config('DEFAULT/rbd_user').with('value' => 'cinder') + should contain_nova_config('DEFAULT/rbd_secret_uuid').with('value' => 'secrete') + should contain_group('cephkeyring').with(:ensure => 'present') + should contain_exec('add-nova-to-group').with( + :command => 'usermod -a -G cephkeyring nova', + :unless => 'groups nova | grep cephkeyring' + ) end - it 'configure libvirt driver without disk cachemodes' do + + it 'configure libvirt driver' do should contain_class('nova::compute::libvirt').with( :libvirt_type => 'kvm', :vncserver_listen => '0.0.0.0', :migration_support => true, - :libvirt_disk_cachemodes => [] + :libvirt_disk_cachemodes => ['network=writeback'] ) end end + + context 'when trying to enable RBD backend on RedHat plaforms' do + before :each do + facts.merge!( :operatingsystem => 'RedHat' ) + params.merge!( + :has_ceph => true, + :cinder_rbd_user => 'cinder', + :nova_rbd_pool => 'nova', + :nova_rbd_secret_uuid => 'secrete' ) + end + + it 'configure libvirt driver without libvirt_disk_cachemodes' do + should contain_class('nova::compute::libvirt').with( + :libvirt_type => 'kvm', + :vncserver_listen => '0.0.0.0', + :migration_support => true, + :libvirt_disk_cachemodes => [] + ) + end + end + end context 'on Debian platforms' do