From a40a2a15503cc627dd53da843aece6c53358c652 Mon Sep 17 00:00:00 2001 From: Adrian Chiris Date: Mon, 2 May 2022 17:16:22 +0300 Subject: [PATCH 1/2] fix some logs Signed-off-by: Adrian Chiris --- pkg/utils/driver.go | 2 +- pkg/utils/utils.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/utils/driver.go b/pkg/utils/driver.go index b5701d6aa..7da863c2d 100644 --- a/pkg/utils/driver.go +++ b/pkg/utils/driver.go @@ -96,7 +96,7 @@ func BindDefaultDriver(pciAddr string) error { } err = ioutil.WriteFile(sysBusPciDriversProbe, []byte(pciAddr), os.ModeAppend) if err != nil { - glog.Errorf("BindDpdkDriver(): fail to bind driver for device %s: %s", pciAddr, err) + glog.Errorf("BindDefaultDriver(): fail to bind driver for device %s: %s", pciAddr, err) return err } diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 14b53a5a3..317cf372f 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -272,7 +272,7 @@ func configSriovDevice(iface *sriovnetworkv1.Interface, ifaceStatus *sriovnetwor } pfLink, err := netlink.LinkByName(iface.Name) if err != nil { - glog.Errorf("setVfGuid(): unable to get PF link for device %+v %q", iface, err) + glog.Errorf("configSriovDevice(): unable to get PF link for device %+v %q", iface, err) return err } From facabb2b503788e4ac1852eff50c89546ab56aab Mon Sep 17 00:00:00 2001 From: Adrian Chiris Date: Mon, 2 May 2022 17:17:01 +0300 Subject: [PATCH 2/2] generic plugin: reset interface on error If error occures during sriov configuration in generic plugin, config daemon will log the error and requeue the request to reconcile the node. On the next run, when generic plugin Apply() method is called, interface configuration may be skipped, leaving the interface partially configured. To ensure generic plugin re-configures the interface on the next iteration, we reset the interface before returning an error. This will also ensure that a drain will be requested as well. Signed-off-by: Adrian Chiris --- pkg/utils/utils.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 317cf372f..61cbcd698 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -165,7 +165,10 @@ func SyncNodeState(newState *sriovnetworkv1.SriovNetworkNodeState) error { break } if err = configSriovDevice(&iface, &ifaceStatus); err != nil { - glog.Errorf("SyncNodeState(): fail to config sriov interface %s: %v", iface.PciAddress, err) + glog.Errorf("SyncNodeState(): fail to configure sriov interface %s: %v. resetting interface.", iface.PciAddress, err) + if resetErr := resetSriovDevice(ifaceStatus); resetErr != nil { + glog.Errorf("SyncNodeState(): fail to reset on error SR-IOV interface: %s", resetErr) + } return err } break