From ba73e8c0ff7cd04f1083a09fec6a6ce7cf6177fd Mon Sep 17 00:00:00 2001 From: wangyd1988 Date: Tue, 5 Dec 2023 15:14:35 +0800 Subject: [PATCH] Re-introduce the check if the number of VFs is 0 --- pkg/plugins/generic/generic_plugin.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/plugins/generic/generic_plugin.go b/pkg/plugins/generic/generic_plugin.go index 486bba564..7fff4ce4a 100644 --- a/pkg/plugins/generic/generic_plugin.go +++ b/pkg/plugins/generic/generic_plugin.go @@ -165,15 +165,18 @@ func needDrainNode(desired sriovnetworkv1.Interfaces, current sriovnetworkv1.Int configured := false for _, iface := range desired { if iface.PciAddress == ifaceStatus.PciAddress { - // TODO: no need to perform further checks if ifaceStatus.NumVfs equals to 0 // once https://github.com/kubernetes/kubernetes/issues/109595 will be fixed configured = true + if ifaceStatus.NumVfs == 0 { + glog.V(2).Infof("generic-plugin needDrainNode(): no need drain, for PCI address %s current NumVfs is 0", iface.PciAddress) + break + } if utils.NeedUpdate(&iface, &ifaceStatus) { - glog.V(2).Infof("generic-plugin needDrainNode(): need drain, PF %s request update", iface.PciAddress) + glog.V(2).Infof("generic-plugin needDrainNode(): need drain, for PCI address %s request update", iface.PciAddress) needDrain = true return } - glog.V(2).Infof("generic-plugin needDrainNode(): no need drain, expect NumVfs %v, current NumVfs %v", iface.NumVfs, ifaceStatus.NumVfs) + glog.V(2).Infof("generic-plugin needDrainNode(): no need drain, for PCI address %s expect NumVfs %v, current NumVfs %v", iface.PciAddress, iface.NumVfs, ifaceStatus.NumVfs) } } if !configured && ifaceStatus.NumVfs > 0 {