Skip to content

Commit

Permalink
Fix parse devices to not include invalid device
Browse files Browse the repository at this point in the history
Signed-off-by: Kathryn Baldauf <[email protected]>
  • Loading branch information
katiewasnothere committed Sep 27, 2024
1 parent e1b4506 commit ffe8282
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/oci/uvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ func parseDevices(ctx context.Context, specWindows *specs.Windows) []uvm.VPCIDev
if specWindows == nil || specWindows.Devices == nil {
return nil
}
extraDevices := make([]uvm.VPCIDeviceID, len(specWindows.Devices))
for i, d := range specWindows.Devices {
extraDevices := []uvm.VPCIDeviceID{}
for _, d := range specWindows.Devices {
pciID, index := devices.GetDeviceInfoFromPath(d.ID)
if uvm.IsValidDeviceType(d.IDType) {
key := uvm.NewVPCIDeviceID(pciID, index)
extraDevices[i] = key
extraDevices = append(extraDevices, key)
} else {
log.G(ctx).WithFields(logrus.Fields{
"device": d,
Expand Down

0 comments on commit ffe8282

Please sign in to comment.