Merge pull request #569 from enovance/disable-tso
compute: ability to disable TSO/GSO/GRO on Debian systems
This commit is contained in:
		@@ -29,6 +29,11 @@
 | 
			
		||||
#   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',
 | 
			
		||||
@@ -43,6 +48,7 @@ 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,
 | 
			
		||||
@@ -137,6 +143,21 @@ 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 $manage_tso {
 | 
			
		||||
      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'
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if $::operatingsystem == 'Ubuntu' {
 | 
			
		||||
 
 | 
			
		||||
@@ -83,6 +83,7 @@ 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
 | 
			
		||||
 | 
			
		||||
@@ -269,6 +270,44 @@ describe 'cloud::compute::hypervisor' do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'without TSO/GSO/GRO on Debian systems' do
 | 
			
		||||
      let :facts do
 | 
			
		||||
        { :osfamily        => 'Debian',
 | 
			
		||||
          :operatingsystem => 'Debian',
 | 
			
		||||
          :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'
 | 
			
		||||
        )
 | 
			
		||||
      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 'with TSO/GSO/GRO on Debian systems' do
 | 
			
		||||
      before :each do
 | 
			
		||||
        facts.merge!( :osfamily => 'Debian' )
 | 
			
		||||
        params.merge!( :manage_tso => false )
 | 
			
		||||
      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
 | 
			
		||||
 | 
			
		||||
    context 'with RBD backend for instances and volumes on Debian plaforms' do
 | 
			
		||||
      before :each do
 | 
			
		||||
        facts.merge!( :osfamily => 'Debian' )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user