Fix SR-IOV runtime manifest apply

When an SR-IOV interface is configured, the platform's
network runtime manifest is applied in order to apply the virtual
function (VF) config and restart the interface.  This results in
sysinv being able to determine and populate the puppet hieradata
with the virtual function PCI addresses.

A side effect of the network manifest apply is that potentially
all platform interfaces may be brought down/up if it is determined
that their configuration has changed.  This will likely be the case
for a system which configures SR-IOV interfaces before initial
unlock.

A few issues have been encountered because of this, with some
services not behaving well when the interface they are communicating
over suddenly goes down.

This commit makes the SR-IOV VF configuration much more targeted
so that only the operation of setting the desired number of VFs
is performed.

Closes-Bug: #1868584

Change-Id: Ic867fccae89fe8bc9173598c3c84c94ba2d7511f
Signed-off-by: Steven Webster <steven.webster@windriver.com>
This commit is contained in:
Steven Webster 2020-03-28 17:23:16 -04:00
parent 6060fb15cd
commit ed763e6a5d
2 changed files with 35 additions and 6 deletions

View File

@ -170,25 +170,53 @@ class platform::network::routes (
}
define platform::interfaces::sriov_config(
define platform::interfaces::sriov_enable (
$pf_addr,
$num_vfs,
$vf_addrs,
$vf_driver = undef
) {
if $vf_driver != undef {
if $num_vfs {
exec { "sriov-enable-device: ${title}":
command => template('platform/sriov.enable-device.erb'),
logoutput => true,
}
}
}
define platform::interfaces::sriov_bind (
$pf_addr,
$num_vfs,
$vf_addrs,
$vf_driver = undef
) {
if ($vf_driver != undef) and length($vf_addrs) > 0 {
ensure_resource(kmod::load, $vf_driver)
exec { "sriov-vf-bind-device: ${title}":
Anchor['platform::networking']
-> exec { "sriov-vf-bind-device: ${title}":
command => template('platform/sriov.bind-device.erb'),
logoutput => true,
require => Kmod::Load[$vf_driver],
require => [ Kmod::Load[$vf_driver] ],
}
}
}
class platform::interfaces::sriov (
$sriov_config = {}
$sriov_config = {},
$runtime = false
) {
create_resources('platform::interfaces::sriov_config', $sriov_config, {})
if $runtime {
create_resources('platform::interfaces::sriov_enable', $sriov_config, {})
} else {
create_resources('platform::interfaces::sriov_bind', $sriov_config, {})
}
}
class platform::interfaces::sriov::runtime {
class { 'platform::interfaces::sriov': runtime => true }
}

View File

@ -0,0 +1 @@
echo 0 > /sys/bus/pci/devices/<%= @pf_addr %>/sriov_numvfs; echo <%= @num_vfs -%> > /sys/bus/pci/devices/<%= @pf_addr %>/sriov_numvfs