Fix kernel module filename for OVS versions
Better kernel module filename handling to support OVS v2; New fact for OVS version Closes-Bug: 1453213 Change-Id: I5bcfd00366bea5c46bb3a62cacd9e5b55d8c2ffe
This commit is contained in:
parent
ed721dad2b
commit
9c991e1188
7
lib/facter/ovs.rb
Normal file
7
lib/facter/ovs.rb
Normal file
@ -0,0 +1,7 @@
|
||||
Facter.add("ovs_version") do
|
||||
confine :kernel => "Linux"
|
||||
|
||||
setcode do
|
||||
Facter::Core::Execution.exec('/usr/bin/ovs-vsctl --version').gsub(/.*ovs-vsctl\s+\(Open\s+vSwitch\)\s+(\d+\.\d+\.\d+).*/, '\1')
|
||||
end
|
||||
end
|
@ -61,8 +61,16 @@ class vswitch::ovs(
|
||||
name => $::vswitch::params::ovs_service_name,
|
||||
hasstatus => false, # the supplied command returns true even if it's not running
|
||||
# Not perfect - should spot if either service is not running - but it'll do
|
||||
status => $ovs_status
|
||||
status => $ovs_status,
|
||||
}
|
||||
|
||||
$major_version = regsubst($::ovs_version, '^(\d+).*', '\1')
|
||||
if $major_version == '1' {
|
||||
$kernel_mod_file = "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko"
|
||||
} else {
|
||||
$kernel_mod_file = "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch.ko"
|
||||
}
|
||||
|
||||
}
|
||||
'Redhat': {
|
||||
service { 'openvswitch':
|
||||
|
@ -96,7 +96,9 @@ describe 'vswitch::ovs' do
|
||||
let :params do default_params end
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Redhat'}
|
||||
{:osfamily => 'Redhat',
|
||||
:ovs_version => '1.4.2',
|
||||
}
|
||||
end
|
||||
|
||||
let :platform_params do redhat_platform_params end
|
||||
@ -113,7 +115,9 @@ describe 'vswitch::ovs' do
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Redhat'}
|
||||
{:osfamily => 'Redhat',
|
||||
:ovs_version => '1.4.2',
|
||||
}
|
||||
end
|
||||
let :platform_params do redhat_platform_params end
|
||||
|
||||
@ -127,6 +131,7 @@ describe 'vswitch::ovs' do
|
||||
let :facts do
|
||||
{:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:ovs_version => '1.4.2',
|
||||
}
|
||||
end
|
||||
let :platform_params do debian_platform_params end
|
||||
@ -145,6 +150,7 @@ describe 'vswitch::ovs' do
|
||||
let :facts do
|
||||
{:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:ovs_version => '1.4.2',
|
||||
}
|
||||
end
|
||||
let :platform_params do debian_platform_params end
|
||||
@ -159,6 +165,7 @@ describe 'vswitch::ovs' do
|
||||
let :facts do
|
||||
{:osfamily => 'Debian',
|
||||
:operatingsystem => 'ubuntu',
|
||||
:ovs_version => '1.4.2',
|
||||
}
|
||||
end
|
||||
let :platform_params do ubuntu_platform_params end
|
||||
@ -177,6 +184,7 @@ describe 'vswitch::ovs' do
|
||||
let :facts do
|
||||
{:osfamily => 'Debian',
|
||||
:operatingsystem => 'ubuntu',
|
||||
:ovs_version => '1.4.2',
|
||||
}
|
||||
end
|
||||
let :platform_params do ubuntu_platform_params end
|
||||
@ -191,6 +199,7 @@ describe 'vswitch::ovs' do
|
||||
let :facts do
|
||||
{:osfamily => 'FreeBSD',
|
||||
:operatingsystem => 'FreeBSD',
|
||||
:ovs_version => '1.4.2',
|
||||
}
|
||||
end
|
||||
let :platform_params do freebsd_platform_params end
|
||||
@ -218,6 +227,7 @@ describe 'vswitch::ovs' do
|
||||
let :facts do
|
||||
{:osfamily => 'FreeBSD',
|
||||
:operatingsystem => 'FreeBSD',
|
||||
:ovs_version => '1.4.2',
|
||||
}
|
||||
end
|
||||
let :platform_params do freebsd_platform_params end
|
||||
|
Loading…
Reference in New Issue
Block a user