Skip to content

Commit

Permalink
Fix media mounting:
Browse files Browse the repository at this point in the history
Some redfish implementations will fail
to eject media if no media is mounted.
The redfish server behavior is to report
that the virtual media doesn't support
media ejection. So we need to check for
this.

Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock committed Nov 24, 2024
1 parent 31918a0 commit a19c4c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/redfishwrapper/virtual_media.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (c *Client) SetVirtualMedia(ctx context.Context, kind string, mediaURL stri

for _, vm := range virtualMedia {
var ejected bool
if vm.Inserted {
if vm.Inserted && vm.SupportsMediaEject {
if err := vm.EjectMedia(); err != nil {
return false, err
}
Expand All @@ -53,7 +53,7 @@ func (c *Client) SetVirtualMedia(ctx context.Context, kind string, mediaURL stri
if mediaURL == "" {
// Only ejecting the media was requested.
// For BMC's that don't support the "inserted" property, we need to eject the media if it's not already ejected.
if !ejected {
if !ejected && vm.SupportsMediaEject {
if err := vm.EjectMedia(); err != nil {
return false, err
}
Expand Down

0 comments on commit a19c4c2

Please sign in to comment.