Merge pull request #624 from enovance/tso-flexibility

Allow to manage or not TSO issue
This commit is contained in:
Yanis Guenane
2014-09-19 10:33:04 -04:00
4 changed files with 66 additions and 33 deletions

View File

@@ -19,16 +19,20 @@
# #
# === Parameters: # === Parameters:
# #
# [*vm_rbd] # [*vm_rbd*]
# (optional) Enable or not ceph capabilities on compute node to store # (optional) Enable or not ceph capabilities on compute node to store
# nova instances on ceph storage. # nova instances on ceph storage.
# Default to false. # Default to false.
# #
# [*volume_rbd] # [*volume_rbd*]
# (optional) Enable or not ceph capabilities on compute node to attach # (optional) Enable or not ceph capabilities on compute node to attach
# cinder volumes backend by ceph on nova instances. # cinder volumes backend by ceph on nova instances.
# Default to false. # Default to false.
# #
# [*manage_tso*]
# (optional) Allow to manage or not TSO issue.
# Default to true.
#
class cloud::compute::hypervisor( class cloud::compute::hypervisor(
$server_proxyclient_address = '127.0.0.1', $server_proxyclient_address = '127.0.0.1',
@@ -43,6 +47,7 @@ class cloud::compute::hypervisor(
$nova_rbd_secret_uuid = undef, $nova_rbd_secret_uuid = undef,
$vm_rbd = false, $vm_rbd = false,
$volume_rbd = false, $volume_rbd = false,
$manage_tso = true,
# set to false to keep backward compatibility # set to false to keep backward compatibility
$ks_spice_public_proto = false, $ks_spice_public_proto = false,
$ks_spice_public_host = false, $ks_spice_public_host = false,
@@ -145,25 +150,26 @@ Host *
} }
# Disabling TSO/GSO/GRO # Disabling TSO/GSO/GRO
if $::osfamily == 'Debian' { if $manage_tso {
ensure_resource ('exec','enable-tso-script', { if $::osfamily == 'Debian' {
'command' => '/usr/sbin/update-rc.d disable-tso defaults', ensure_resource ('exec','enable-tso-script', {
'unless' => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', 'command' => '/usr/sbin/update-rc.d disable-tso defaults',
'onlyif' => '/usr/bin/test -f /etc/init.d/disable-tso' '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', { } elsif $::osfamily == 'RedHat' {
'command' => '/usr/sbin/chkconfig disable-tso on', ensure_resource ('exec','enable-tso-script', {
'unless' => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', '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' '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' { if $::operatingsystem == 'Ubuntu' {
service { 'dbus': service { 'dbus':

View File

@@ -20,6 +20,7 @@ class cloud::network::l3(
$external_int = 'eth1', $external_int = 'eth1',
$ext_provider_net = false, $ext_provider_net = false,
$debug = true, $debug = true,
$manage_tso = true,
) { ) {
include 'cloud::network' include 'cloud::network'
@@ -48,23 +49,25 @@ class cloud::network::l3(
} }
# Disabling TSO/GSO/GRO # Disabling TSO/GSO/GRO
if $::osfamily == 'Debian' { if $manage_tso {
ensure_resource ('exec','enable-tso-script', { if $::osfamily == 'Debian' {
'command' => '/usr/sbin/update-rc.d disable-tso defaults', ensure_resource ('exec','enable-tso-script', {
'unless' => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', 'command' => '/usr/sbin/update-rc.d disable-tso defaults',
'onlyif' => '/usr/bin/test -f /etc/init.d/disable-tso' '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', { } elsif $::osfamily == 'RedHat' {
'command' => '/usr/sbin/chkconfig disable-tso on', ensure_resource ('exec','enable-tso-script', {
'unless' => '/bin/ls /etc/rc*.d | /bin/grep disable-tso', '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' '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'
})
} }

View File

@@ -308,6 +308,18 @@ describe 'cloud::compute::hypervisor' do
end end
end end
context 'when not managing TSO/GSO/GRO' do
before :each do
params.merge!( :manage_tso => false)
end
it 'ensure TSO script is not managed at boot' do
should_not contain_exec('enable-tso-script')
end
it 'do not start TSO script' do
should_not contain_exec('start-tso-script')
end
end
context 'with RBD backend for instances and volumes on Debian plaforms' do context 'with RBD backend for instances and volumes on Debian plaforms' do
before :each do before :each do
facts.merge!( :osfamily => 'Debian', facts.merge!( :osfamily => 'Debian',

View File

@@ -131,6 +131,18 @@ describe 'cloud::network::l3' do
) )
end end
end end
context 'when not managing TSO/GSO/GRO' do
before :each do
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 not start TSO script' do
should_not contain_exec('start-tso-script')
end
end
end end
context 'on Debian platforms' do context 'on Debian platforms' do