hypervisor: ensure RBD can't be enabled on RHEL
RHEL does not support RBD backend for VMs storage. We need to ensure that nova will never be configured with RBD parameters, even if has_ceph is true on Red Hat hypervisor nodes. Also add more unit tests.
This commit is contained in:
@@ -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'
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user