2
0
mirror of https://opendev.org/x/pyghmi synced 2026-05-18 04:07:19 +00:00

Allow virtualmedia on Systems instead of Managers

Redfish now allows a system to opt to place virtual media
on system rather than manager.  The rational being that
remote media has to be mapped to specific hosts, and the
manager relationship to that media can be implicit.

Try the system first (more specific) then fallback to traditional
manager location for virtualmedia.

Change-Id: I5d63b5e57572c6a753a2d86adb223335a15a71ea
This commit is contained in:
Jarrod Johnson
2022-05-20 07:29:02 -04:00
parent d286a8326a
commit 5f63810884
+10 -5
View File
@@ -1485,9 +1485,12 @@ class Command(object):
# identify the correct resource ahead of time.
# As such it's OEM specific until the standard
# provides a better way.
bmcinfo = self._do_web_request(self._bmcurl)
vmcoll = bmcinfo.get('VirtualMedia', {}).get('@odata.id', None)
vmurls = None
vmurls = []
vmcoll = self.sysinfo.get(
'VirtualMedia', {}).get('@odata.id', None)
if not vmcoll:
vmcoll = self.bmcinfo.get(
'VirtualMedia', {}).get('@odata.id', None)
if vmcoll:
vmlist = self._do_web_request(vmcoll)
vmurls = [x['@odata.id'] for x in vmlist.get('Members', [])]
@@ -1517,12 +1520,14 @@ class Command(object):
break
def detach_remote_media(self):
bmcinfo = self._do_web_request(self._bmcurl)
vmcoll = bmcinfo.get('VirtualMedia', {}).get('@odata.id', None)
try:
self.oem.detach_remote_media()
except exc.BypassGenericBehavior:
return
vmcoll = self.sysinfo.get('VirtualMedia', {}).get('@odata.id', None)
if not vmcoll:
bmcinfo = self._do_web_request(self._bmcurl)
vmcoll = bmcinfo.get('VirtualMedia', {}).get('@odata.id', None)
if vmcoll:
vmlist = self._do_web_request(vmcoll)
vmurls = [x['@odata.id'] for x in vmlist.get('Members', [])]