@@ -278,23 +278,21 @@ func (np *NetworkDriver) prepareResourceClaim(ctx context.Context, claim *resour
278278 // For SR-IOV VFs, the requested MTU must not exceed the parent PF's MTU.
279279 // Otherwise the claim is rejected so the Pod fails fast instead of being
280280 // created with an illegal MTU configuration.
281- if deviceCfg .NetworkInterfaceConfigInPod .Interface .MTU != nil {
281+ if deviceCfg .NetworkInterfaceConfigInPod .Interface .MTU != nil && inventory . IsSriovVf ( ifName ) {
282282 pfName , err := inventory .GetPFInterfaceName (ifName )
283283 if err != nil {
284- // Not an SR-IOV VF, or the parent PF cannot be determined. This is
285- // expected for regular interfaces, so skip the check and only log it.
286- klog .V (4 ).Infof ("skipping SR-IOV VF MTU check for interface %s: %v" , ifName , err )
287- } else {
288- pfLink , err := nlHandle .LinkByName (pfName )
289- if err != nil {
290- errorList = append (errorList , fmt .Errorf ("failed to get netlink to parent PF %s of VF %s: %v" , pfName , ifName , err ))
291- continue
292- }
293- requestedMTU := int (* deviceCfg .NetworkInterfaceConfigInPod .Interface .MTU )
294- if err := validateVFMTU (ifName , pfName , requestedMTU , pfLink .Attrs ().MTU ); err != nil {
295- errorList = append (errorList , err )
296- continue
297- }
284+ errorList = append (errorList , fmt .Errorf ("failed to determine parent PF for SR-IOV VF %s: %v" , ifName , err ))
285+ continue
286+ }
287+ pfLink , err := nlHandle .LinkByName (pfName )
288+ if err != nil {
289+ errorList = append (errorList , fmt .Errorf ("failed to get netlink to parent PF %s of VF %s: %v" , pfName , ifName , err ))
290+ continue
291+ }
292+ requestedMTU := int (* deviceCfg .NetworkInterfaceConfigInPod .Interface .MTU )
293+ if err := validateVFMTU (ifName , pfName , requestedMTU , pfLink .Attrs ().MTU ); err != nil {
294+ errorList = append (errorList , err )
295+ continue
298296 }
299297 }
300298
0 commit comments