diff --git a/manifests/compute/hypervisor.pp b/manifests/compute/hypervisor.pp index d22fa3f0..a0aad2b4 100644 --- a/manifests/compute/hypervisor.pp +++ b/manifests/compute/hypervisor.pp @@ -29,11 +29,6 @@ # cinder volumes backend by ceph on nova instances. # Default to false. # -# [*manage_tso] -# (optional) Enable or not TSO/GSO/GRO/UFO on neutron interfaces. -# Should be at True when running linux kernel 3.14. -# Default to true. -# class cloud::compute::hypervisor( $server_proxyclient_address = '127.0.0.1', @@ -48,7 +43,6 @@ class cloud::compute::hypervisor( $nova_rbd_secret_uuid = undef, $vm_rbd = false, $volume_rbd = false, - $manage_tso = true, # set to false to keep backward compatibility $ks_spice_public_proto = false, $ks_spice_public_host = false, @@ -130,7 +124,7 @@ Host * } - if $::operatingsystem == 'RedHat' { + if $::osfamily == 'RedHat' { file { '/etc/libvirt/qemu.conf': ensure => file, source => 'puppet:///modules/cloud/qemu/qemu.conf', @@ -145,7 +139,7 @@ Host * } } else { # Disabling or not TSO/GSO/GRO on Debian systems - if $manage_tso { + if $::kernelmajversion >= '3.14' { ensure_resource ('exec','enable-tso-script', { 'command' => '/usr/sbin/update-rc.d disable-tso defaults', 'unless' => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', diff --git a/manifests/network/l3.pp b/manifests/network/l3.pp index ec63856f..6c43d5df 100644 --- a/manifests/network/l3.pp +++ b/manifests/network/l3.pp @@ -46,4 +46,18 @@ class cloud::network::l3( debug => $debug, } + # Disabling or not TSO/GSO/GRO on Debian systems + if $::osfamily == 'Debian' and $::kernelmajversion >= '3.14' { + ensure_resource ('exec','enable-tso-script', { + 'command' => '/usr/sbin/update-rc.d disable-tso defaults', + 'unless' => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', + 'onlyif' => 'test -f /etc/init.d/disable-tso' + }) + ensure_resource ('exec','start-tso-script', { + 'command' => '/etc/init.d/disable-tso start', + 'unless' => 'test -f /tmp/disable-tso-lock', + 'onlyif' => 'test -f /etc/init.d/disable-tso' + }) + } + } diff --git a/spec/classes/cloud_compute_hypervisor_spec.rb b/spec/classes/cloud_compute_hypervisor_spec.rb index 0d185c1d..b66fb9de 100644 --- a/spec/classes/cloud_compute_hypervisor_spec.rb +++ b/spec/classes/cloud_compute_hypervisor_spec.rb @@ -83,7 +83,6 @@ describe 'cloud::compute::hypervisor' do :ks_spice_public_host => '10.0.0.2', :vm_rbd => false, :volume_rbd => false, - :manage_tso => true, :ks_nova_public_host => '10.0.0.1' } end @@ -272,13 +271,12 @@ describe 'cloud::compute::hypervisor' do end context 'without TSO/GSO/GRO on Debian systems' do - let :facts do - { :osfamily => 'Debian', - :operatingsystem => 'Debian', - :concat_basedir => '/var/lib/puppet/concat' - } + before :each do + facts.merge!( :osfamily => 'Debian', + :operatingsystem => 'Debian', + :kernelmajversion => '3.14', + :concat_basedir => '/var/lib/puppet/concat' ) end - it 'ensure TSO script is enabled at boot' do should contain_exec('enable-tso-script').with( :command => '/usr/sbin/update-rc.d disable-tso defaults', @@ -295,10 +293,10 @@ describe 'cloud::compute::hypervisor' do end end - context 'with TSO/GSO/GRO on Debian systems' do + context 'ensure TSO/GSO/GRO is not managed on Debian systems with kernel < 3.14' do before :each do - facts.merge!( :osfamily => 'Debian' ) - params.merge!( :manage_tso => false ) + facts.merge!( :osfamily => 'Debian', + :kernelmajversion => '3.12' ) end it 'ensure TSO script is not enabled at boot' do @@ -410,7 +408,7 @@ describe 'cloud::compute::hypervisor' do context 'when trying to enable RBD backend on RedHat plaforms' do before :each do - facts.merge!( :operatingsystem => 'RedHat' ) + facts.merge!( :osfamily => 'RedHat' ) params.merge!( :vm_rbd => true, :cinder_rbd_user => 'cinder', @@ -422,7 +420,7 @@ describe 'cloud::compute::hypervisor' do context 'when trying to enable RBD backend with deprecated parameter on RedHat plaforms' do before :each do - facts.merge!( :operatingsystem => 'RedHat' ) + facts.merge!( :osfamily => 'RedHat' ) params.merge!( :has_ceph => true, :cinder_rbd_user => 'cinder', diff --git a/spec/classes/cloud_network_l3_spec.rb b/spec/classes/cloud_network_l3_spec.rb index 9a9092b3..df490f29 100644 --- a/spec/classes/cloud_network_l3_spec.rb +++ b/spec/classes/cloud_network_l3_spec.rb @@ -151,6 +151,42 @@ describe 'cloud::network::l3' do should_not contain__neutron_network('public') end end + + context 'without TSO/GSO/GRO on Debian systems with 3.14 kernel' do + before :each do + facts.merge!( :osfamily => 'Debian', + :kernelmajversion => '3.14' ) + end + + it 'ensure TSO script is enabled at boot' do + should contain_exec('enable-tso-script').with( + :command => '/usr/sbin/update-rc.d disable-tso defaults', + :unless => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', + :onlyif => 'test -f /etc/init.d/disable-tso' + ) + end + it 'start TSO script' do + should contain_exec('start-tso-script').with( + :command => '/etc/init.d/disable-tso start', + :unless => 'test -f /tmp/disable-tso-lock', + :onlyif => 'test -f /etc/init.d/disable-tso' + ) + end + end + + context 'ensure TSO/GSO/GRO is not managed on Debian systems with kernel < 3.14' do + before :each do + facts.merge!( :osfamily => 'Debian', + :kernelmajversion => '3.12' ) + end + + it 'ensure TSO script is not enabled at boot' do + should_not contain_exec('enable-tso-script') + end + it 'do no tstart TSO script' do + should_not contain_exec('start-tso-script') + end + end end context 'on Debian platforms' do