dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
606 stars 279 forks source link

Can't insert CD and RemovableMedia virtual media simultaneously #290

Closed EajksEajks closed 4 months ago

EajksEajks commented 8 months ago

Hi.

When I try to insert a CD (using an https://...iso URI), then a RemovableDisk (using an https://...img URI), the 1st one succeeds, the 2nd one fails. If I switch the order of insertion, same result : the 1st one always succeeds, the 2nd one always fails.

I tried it successfully a couple of weeks ago. Unfortunately I didn't write the python commands I executed at that time, but I remember I had to identify CD by 0 and RemovableDisk by 1. Pretty strange it is no longer possible. However I upgraded the iDRAC firmware to the latest version beginning of this work. No idea whether it explains that I was able to do it, or not.

Anyway it doesn't work using your python package to call the Redfish API but it works (attaching both CD and RemovableDisk) if I use the dropdown menu in the virtual console (through the iDRAC web UI).

EajksEajks commented 8 months ago

A brief explanation why I try to attach both at the same time:

texroemer commented 8 months ago

Hi @EajksEajks

For attaching multiple virtual media devices, supported index IDs are 1 and 2 not 0 and 1. Can you try using index 1 and 2 for attaching devices and see if it works.

See example below of attaching ISO (index 1) and IMG (index 2) at the same time.

C:\Python310>python InsertEjectVirtualMediaREDFISH.py -ip 192.168.0.120 -u root -p calvin --get

 - Virtual Media Device Details -

{'@odata.context': '/redfish/v1/$metadata#VirtualMedia.VirtualMedia',
 '@odata.id': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1',
 '@odata.type': '#VirtualMedia.v1_6_1.VirtualMedia',
 'Actions': {'#VirtualMedia.EjectMedia': {'target': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1/Actions/VirtualMedia.EjectMedia'},
             '#VirtualMedia.InsertMedia': {'target': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1/Actions/VirtualMedia.InsertMedia'}},
 'Certificates': {'@odata.id': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1/Certificates'},
 'ConnectedVia': 'NotConnected',
 'Description': 'iDRAC Virtual Media Instance',
 'Id': '1',
 'Image': None,
 'ImageName': None,
 'Inserted': False,
 'MediaTypes': ['CD', 'DVD', 'USBStick'],
 'MediaTypes@odata.count': 3,
 'Name': 'VirtualMedia Instance 1',
 'Password': None,
 'TransferMethod': None,
 'TransferProtocolType': None,
 'UserName': None,
 'VerifyCertificate': False,
 'WriteProtected': None}

{'@odata.context': '/redfish/v1/$metadata#VirtualMedia.VirtualMedia',
 '@odata.id': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/2',
 '@odata.type': '#VirtualMedia.v1_6_1.VirtualMedia',
 'Actions': {'#VirtualMedia.EjectMedia': {'target': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/2/Actions/VirtualMedia.EjectMedia'},
             '#VirtualMedia.InsertMedia': {'target': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/2/Actions/VirtualMedia.InsertMedia'}},
 'Certificates': {'@odata.id': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/2/Certificates'},
 'ConnectedVia': 'NotConnected',
 'Description': 'iDRAC Virtual Media Instance',
 'Id': '2',
 'Image': None,
 'ImageName': None,
 'Inserted': False,
 'MediaTypes': ['CD', 'DVD', 'USBStick'],
 'MediaTypes@odata.count': 3,
 'Name': 'VirtualMedia Instance 2',
 'Password': None,
 'TransferMethod': None,
 'TransferProtocolType': None,
 'UserName': None,
 'VerifyCertificate': False,
 'WriteProtected': None}

 C:\Python310>python InsertEjectVirtualMediaREDFISH.py -ip 192.168.0.120 -u root -p calvin --action insert --index 1 --uripath http://192.168.0.130/http_share/boot.iso

- PASS, POST command passed to successfully insert virtual media, status code 204 returned

C:\Python310>python InsertEjectVirtualMediaREDFISH.py -ip 192.168.0.120 -u root -p calvin --action insert --index 2 --uripath http://192.168.0.130/http_share/ks.img

- PASS, POST command passed to successfully insert virtual media, status code 204 returned

C:\Python310>python InsertEjectVirtualMediaREDFISH.py -ip 192.168.0.120 -u root -p calvin --get

 - Virtual Media Device Details -

{'@odata.context': '/redfish/v1/$metadata#VirtualMedia.VirtualMedia',
 '@odata.id': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1',
 '@odata.type': '#VirtualMedia.v1_6_1.VirtualMedia',
 'Actions': {'#VirtualMedia.EjectMedia': {'target': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1/Actions/VirtualMedia.EjectMedia'},
             '#VirtualMedia.InsertMedia': {'target': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1/Actions/VirtualMedia.InsertMedia'}},
 'Certificates': {'@odata.id': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1/Certificates'},
 'ConnectedVia': 'URI',
 'Description': 'iDRAC Virtual Media Instance',
 'Id': '1',
 'Image': 'http://192.168.0.130/http_share/boot.iso',
 'ImageName': 'boot.iso',
 'Inserted': True,
 'MediaTypes': ['CD', 'DVD', 'USBStick'],
 'MediaTypes@odata.count': 3,
 'Name': 'VirtualMedia Instance 1',
 'Password': None,
 'TransferMethod': 'Stream',
 'TransferProtocolType': 'HTTP',
 'UserName': None,
 'VerifyCertificate': False,
 'WriteProtected': True}

{'@odata.context': '/redfish/v1/$metadata#VirtualMedia.VirtualMedia',
 '@odata.id': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/2',
 '@odata.type': '#VirtualMedia.v1_6_1.VirtualMedia',
 'Actions': {'#VirtualMedia.EjectMedia': {'target': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/2/Actions/VirtualMedia.EjectMedia'},
             '#VirtualMedia.InsertMedia': {'target': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/2/Actions/VirtualMedia.InsertMedia'}},
 'Certificates': {'@odata.id': '/redfish/v1/Systems/System.Embedded.1/VirtualMedia/2/Certificates'},
 'ConnectedVia': 'URI',
 'Description': 'iDRAC Virtual Media Instance',
 'Id': '2',
 'Image': 'http://192.168.0.130/http_share/ks.img',
 'ImageName': 'ks.img',
 'Inserted': True,
 'MediaTypes': ['CD', 'DVD', 'USBStick'],
 'MediaTypes@odata.count': 3,
 'Name': 'VirtualMedia Instance 2',
 'Password': None,
 'TransferMethod': 'Stream',
 'TransferProtocolType': 'HTTP',
 'UserName': None,
 'VerifyCertificate': False,
 'WriteProtected': True}

Thanks Tex

EajksEajks commented 8 months ago

Hi Tex,

There seems to be two URLs dealing with VirtualMedia:

Only the second one allows the simultaneous insertion. Do you know the difference which justify there exists two different URLs?

EajksEajks commented 8 months ago

By the way, the reason why it doesn't always work in my setup is because I used two different generations of PowerEdge servers (and I didn't pay attention). It doesn't work on R740/R640 (iDRAC firmware 5.x). It does work on R760/R660 (iDRAC firmware 7.x).

texroemer commented 8 months ago

VirtualMedia support for Manager schema was legacy behavior and support has been deprecated. But the URIs for Manager schema are still reported for backwards compatibility if the user is still using older iDRAC firmware (5.10 or older).

Starting in iDRAC 6.00 VirtualMedia support for ComputerSystem schema was added to allow the user to attach multiple virtual devices at the same time and also be compliant with DMTF. If you run GET on URI "redfish/v1/Managers/iDRAC.Embedded.1" you will see "VirtualMedia@Redfish.Deprecated" property reporting the correct URI to now use.

Example:

image

Thanks Tex