From a5907916723075b896b9164022ba586a353f600d Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Thu, 18 Sep 2014 16:55:03 -0400 Subject: [PATCH] Disable TSO on all systems Even on RHEL7 + OSP5, there is an issue on TSO/GSO. So we need to ensure that it's disable also on RHEL7/CentOS7 systems. Signed-off-by: Emilien Macchi --- manifests/compute/hypervisor.pp | 36 +++++++++------ manifests/network/l3.pp | 20 +++++--- spec/classes/cloud_compute_hypervisor_spec.rb | 30 +++++++----- spec/classes/cloud_network_l3_spec.rb | 46 +++++++++++-------- 4 files changed, 78 insertions(+), 54 deletions(-) diff --git a/manifests/compute/hypervisor.pp b/manifests/compute/hypervisor.pp index 8d763a42..eda64707 100644 --- a/manifests/compute/hypervisor.pp +++ b/manifests/compute/hypervisor.pp @@ -141,23 +141,29 @@ Host * if $has_ceph or $vm_rbd { fail('Red Hat does not support RBD backend for VMs.') } - } else { - # Disabling or not TSO/GSO/GRO on Debian systems - 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', - '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' - }) - - } } + # Disabling TSO/GSO/GRO + if $::osfamily == 'Debian' { + 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' => '/usr/bin/test -f /etc/init.d/disable-tso' + }) + } elsif $::osfamily == 'RedHat' { + ensure_resource ('exec','enable-tso-script', { + 'command' => '/usr/sbin/chkconfig disable-tso on', + 'unless' => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', + 'onlyif' => '/usr/bin/test -f /etc/init.d/disable-tso' + }) + } + ensure_resource ('exec','start-tso-script', { + 'command' => '/etc/init.d/disable-tso start', + 'unless' => '/usr/bin/test -f /tmp/disable-tso-lock', + 'onlyif' => '/usr/bin/test -f /etc/init.d/disable-tso' + }) + + if $::operatingsystem == 'Ubuntu' { service { 'dbus': ensure => running, diff --git a/manifests/network/l3.pp b/manifests/network/l3.pp index 6c43d5df..c81d9645 100644 --- a/manifests/network/l3.pp +++ b/manifests/network/l3.pp @@ -46,18 +46,24 @@ class cloud::network::l3( debug => $debug, } - # Disabling or not TSO/GSO/GRO on Debian systems - if $::osfamily == 'Debian' and $::kernelmajversion >= '3.14' { + # Disabling TSO/GSO/GRO + if $::osfamily == 'Debian' { 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' + 'onlyif' => '/usr/bin/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' + } elsif $::osfamily == 'RedHat' { + ensure_resource ('exec','enable-tso-script', { + 'command' => '/usr/sbin/chkconfig disable-tso on', + 'unless' => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', + 'onlyif' => '/usr/bin/test -f /etc/init.d/disable-tso' }) } + ensure_resource ('exec','start-tso-script', { + 'command' => '/etc/init.d/disable-tso start', + 'unless' => '/usr/bin/test -f /tmp/disable-tso-lock', + 'onlyif' => '/usr/bin/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 eb137a71..d217bb61 100644 --- a/spec/classes/cloud_compute_hypervisor_spec.rb +++ b/spec/classes/cloud_compute_hypervisor_spec.rb @@ -276,37 +276,43 @@ describe 'cloud::compute::hypervisor' do facts.merge!( :osfamily => 'Debian', :operatingsystem => 'Debian', :vtx => true, - :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', :unless => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', - :onlyif => 'test -f /etc/init.d/disable-tso' + :onlyif => '/usr/bin/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' + :unless => '/usr/bin/test -f /tmp/disable-tso-lock', + :onlyif => '/usr/bin/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 + context 'without TSO/GSO/GRO on Red Hat systems' do before :each do - facts.merge!( :osfamily => 'Debian', + facts.merge!( :osfamily => 'RedHat', :vtx => true, - :kernelmajversion => '3.12' ) + :concat_basedir => '/var/lib/puppet/concat' ) end - - it 'ensure TSO script is not enabled at boot' do - should_not contain_exec('enable-tso-script') + it 'ensure TSO script is enabled at boot' do + should contain_exec('enable-tso-script').with( + :command => '/usr/sbin/chkconfig disable-tso on', + :unless => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', + :onlyif => '/usr/bin/test -f /etc/init.d/disable-tso' + ) end - it 'do no tstart TSO script' do - should_not contain_exec('start-tso-script') + it 'start TSO script' do + should contain_exec('start-tso-script').with( + :command => '/etc/init.d/disable-tso start', + :unless => '/usr/bin/test -f /tmp/disable-tso-lock', + :onlyif => '/usr/bin/test -f /etc/init.d/disable-tso' + ) end end diff --git a/spec/classes/cloud_network_l3_spec.rb b/spec/classes/cloud_network_l3_spec.rb index df490f29..adc2a52b 100644 --- a/spec/classes/cloud_network_l3_spec.rb +++ b/spec/classes/cloud_network_l3_spec.rb @@ -152,41 +152,47 @@ describe 'cloud::network::l3' do end end - context 'without TSO/GSO/GRO on Debian systems with 3.14 kernel' do + context 'without TSO/GSO/GRO on Red Hat systems' do before :each do - facts.merge!( :osfamily => 'Debian', - :kernelmajversion => '3.14' ) + facts.merge!( :osfamily => 'RedHat') + end + + it 'ensure TSO script is enabled at boot' do + should contain_exec('enable-tso-script').with( + :command => '/usr/sbin/chkconfig disable-tso on', + :unless => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', + :onlyif => '/usr/bin/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 => '/usr/bin/test -f /tmp/disable-tso-lock', + :onlyif => '/usr/bin/test -f /etc/init.d/disable-tso' + ) + end + end + + context 'without TSO/GSO/GRO on Debian systems' do + before :each do + facts.merge!( :osfamily => 'Debian') 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' + :onlyif => '/usr/bin/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' + :unless => '/usr/bin/test -f /tmp/disable-tso-lock', + :onlyif => '/usr/bin/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