diff --git a/pkg/pillar/cmd/domainmgr/domainmgr.go b/pkg/pillar/cmd/domainmgr/domainmgr.go index 508381b28e..0c0c8e892a 100644 --- a/pkg/pillar/cmd/domainmgr/domainmgr.go +++ b/pkg/pillar/cmd/domainmgr/domainmgr.go @@ -3045,6 +3045,7 @@ func handlePhysicalIOAdapterListImpl(ctxArg interface{}, key string, len(aa.IoBundleList)) aa.CheckBadUSBBundles() + aa.CheckDeprecatedBundleType() // check for mismatched PCI-ids and assignment groups and mark as errors aa.CheckBadAssignmentGroups(log, hyper.PCISameController) for i := range aa.IoBundleList { @@ -3089,6 +3090,7 @@ func handlePhysicalIOAdapterListImpl(ctxArg interface{}, key string, aa.AddOrUpdateIoBundle(log, *ib) aa.CheckBadUSBBundles() + aa.CheckDeprecatedBundleType() // check for mismatched PCI-ids and assignment groups and mark as errors aa.CheckBadAssignmentGroups(log, hyper.PCISameController) // Lookup since it could have changed diff --git a/pkg/pillar/types/assignableadapters.go b/pkg/pillar/types/assignableadapters.go index f04888c84b..decafcfdfe 100644 --- a/pkg/pillar/types/assignableadapters.go +++ b/pkg/pillar/types/assignableadapters.go @@ -664,6 +664,15 @@ func (i IOBundleCollision) String() string { return fmt.Sprintf("phylabel %s - usbaddr: %s usbproduct: %s pcilong: %s assigngrp: %s", i.Phylabel, i.USBAddr, i.USBProduct, i.PCILong, i.Assigngrp) } +// ErrIOBundleDeprecatedType describes an error where an IoBundle uses a type that is not supported anymore +type ErrIOBundleDeprecatedType struct { + bundleType IoType +} + +func (e ErrIOBundleDeprecatedType) Error() string { + return fmt.Sprintf("bundle type %s is deprecated and should not be used anymore", e.bundleType) +} + // ErrIOBundleCollision describes an error where an IoBundle collides with another IoBundle type ErrIOBundleCollision struct { Collisions []IOBundleCollision @@ -687,6 +696,20 @@ func newIoBundleCollisionErr() ErrIOBundleCollision { } } +// CheckDeprecatedBundleType sets and clears ib.Error/ErrorTime if bundle uses a deprecated type +func (aa *AssignableAdapters) CheckDeprecatedBundleType() { + for i := range aa.IoBundleList { + ioBundle := &aa.IoBundleList[i] + ioBundle.Error.removeByType(ErrIOBundleDeprecatedType{}) + + if ioBundle.Type == IoUSB { + ioBundle.Error.Append(ErrIOBundleDeprecatedType{ + bundleType: ioBundle.Type, + }) + } + } +} + // CheckBadUSBBundles sets and clears ib.Error/ErrorTime if bundle collides in regards of USB func (aa *AssignableAdapters) CheckBadUSBBundles() { usbProductsAddressMap := make(map[[4]string][]*IoBundle)