Skip to content

Commit

Permalink
redfishwrapper: add method to return list of virtual media currently …
Browse files Browse the repository at this point in the history
…inserted
  • Loading branch information
joelrebel committed Sep 11, 2023
1 parent a1b87e2 commit c708662
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions internal/redfishwrapper/virtual_media.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,27 @@ func (c *Client) SetVirtualMedia(ctx context.Context, kind string, mediaURL stri

return true, nil
}

func (c *Client) InsertedVirtualMedia(ctx context.Context) ([]string, error) {
managers, err := c.Managers(ctx)
if err != nil {
return nil, err
}

var inserted []string

for _, manager := range managers {
virtualMedia, err := manager.VirtualMedia()
if err != nil {
return nil, err
}

for _, media := range virtualMedia {
if media.Inserted {
inserted = append(inserted, media.ID)
}
}
}

return inserted, nil
}

0 comments on commit c708662

Please sign in to comment.