From a19c4c24e48c25f5f05c5ba0817d6ecfdf63fea9 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Sat, 23 Nov 2024 18:09:36 -0700 Subject: [PATCH] Fix media mounting: 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 --- internal/redfishwrapper/virtual_media.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/redfishwrapper/virtual_media.go b/internal/redfishwrapper/virtual_media.go index f214bffc..095b4861 100644 --- a/internal/redfishwrapper/virtual_media.go +++ b/internal/redfishwrapper/virtual_media.go @@ -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 } @@ -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 }