dell / iDRAC-Redfish-Scripting

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

Boot off virtual media hangs #225

Closed Gerardwx closed 1 year ago

Gerardwx commented 1 year ago

When I attach a virtual ISO via the iDrac web interface and execute: python3 SetNextOneTimeBootVirtualMediaDeviceOemREDFISH.py -ip idrac13.nmrbox.org -u root -d 1 -r y -p calvin

the system correctly boots to the virtual media.

If I mount the virtual ISO via script python3 InsertEjectVirtualMediaREDFISH.py -ip idrac13.nmrbox.org -u root --action insert --device cd --uri https://devel20.nmrbox.org/iso/xubuntu-18.04-desktop-amd64.iso

and then

python3 SetNextOneTimeBootVirtualMediaDeviceOemREDFISH.py -ip idrac13.nmrbox.org -u root -d 1 -r y -p calvin

I see ISOLINUX ETCD in the console window and the system hangs.

console.txt

Gerardwx commented 1 year ago

System: Model PowerEdge R740 BIOS Version 2.2.10 Lifecycle Controller Firmware 3.32.32.32 iDRAC: Firmware Version 3.32.32.32 Firmware Updated Thu Apr 18 00:17:06 2019 Hardware Version 0.01

texroemer commented 1 year ago

Hi @Gerardwx

Thanks for reporting this issue, i was also able to repro this issue in my lab attaching an ISO direct link (i used http://mirror.cs.vt.edu/pub/CentOS/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-boot.iso). I'll escalate this issue to the iDRAC teams internally.

For a workaround, you'll need to copy the ISO to a local webserver on your network which i confirmed this works (i created an Apache webserver, copied the ISO, attached and onetime boot to this ISO worked with no issues).

Thanks Tex

Gerardwx commented 1 year ago

By local webserver, do you mean on the same subnet? The webserver I'm using is in the same data center, although the path goes through a switch or two.

texroemer commented 1 year ago

Local meaning same datacenter but are you able to try on same subnet? Also does your network have a CIFS or NFS share set up? If yes, can you try using one of those shares, see if it works?

Gerardwx commented 1 year ago

I was able to get it to work using NFS.

texroemer commented 1 year ago

Good to hear working with NFS.

I'm currently working with Dell internal teams (iDRAC and BIOS) on the issue, will reply back once i have an update.

Thanks Tex

Gerardwx commented 1 year ago

FWIW, I've wrapped the basic commands in a Python library: https://pypi.org/project/idrac-wrapper/

texroemer commented 1 year ago

Hi @Gerardwx

Wanted to give you an update on this issue, iDRAC team has fixed the bug and this fix will be available in 6.10.00 iDRAC which is planned to be released this Dec.

I also wanted to mention a workaround you can currently leverage using Server Configuration Profile (SCP) feature. See workflow example below along with SCP file example.

  1. First step is to export only LifecycleController attributes. This FQDD node will contain OSD attributes needed to perform the install.
C:\Python39>ExportSystemConfigurationLocalREDFISH.py -ip 192.168.0.120 -u root -p calvin --target LifecycleController

- Job ID "JID_637666466531" successfully created for ExportSystemConfiguration method

- INFO, "Exporting Server Configuration Profile.", percent complete: 20
- INFO, "Exporting Server Configuration Profile.", percent complete: 95

- Export locally job ID JID_637666466531 successfully completed. Attributes exported:

<SystemConfiguration Model="PowerEdge R650" ServiceTag="CTX4AA1" TimeStamp="Wed Sep 21 08:24:08 2022">
<!--Export type is Normal,XML,Selective-->
<!--Exported configuration may contain commented attributes. Attributes may be commented due to dependency, destructive nature, preserving server identity or for security reasons.-->
<Component FQDD="LifecycleController.Embedded.1">
 <Attribute Name="LCAttributes.1#CollectSystemInventoryOnRestart">Enabled</Attribute>
 <Attribute Name="LCAttributes.1#PartConfigurationUpdate">Apply Always</Attribute>
 <Attribute Name="LCAttributes.1#PartFirmwareUpdate">Match firmware of replaced part</Attribute>
 <!-- <Attribute Name="LCAttributes.1#LifecycleControllerState">Enabled</Attribute>-->
 <Attribute Name="LCAttributes.1#IPChangeNotifyPS">Off</Attribute>
 <Attribute Name="LCAttributes.1#VirtualAddressManagementApplication"></Attribute>
 <Attribute Name="LCAttributes.1#ProvisioningServer"></Attribute>
 <Attribute Name="LCAttributes.1#BIOSRTDRequested">False</Attribute>
 <Attribute Name="LCAttributes.1#AutoUpdate">Disabled</Attribute>
 <Attribute Name="LCAttributes.1#IPAddress"></Attribute>
 <Attribute Name="LCAttributes.1#UserProxyServer"></Attribute>
 <Attribute Name="LCAttributes.1#UserProxyPort">80</Attribute>
 <Attribute Name="LCAttributes.1#UserProxyUserName"></Attribute>
 <!-- <Attribute Name="LCAttributes.1#UserProxyPassword">******</Attribute>-->
 <Attribute Name="LCAttributes.1#UserProxyType">HTTP</Attribute>
 <Attribute Name="LCAttributes.1#IgnoreCertWarning">On</Attribute>
 <!-- <Attribute Name="OSD.1#SupportedOSList">Microsoft Windows Server 2019, Microsoft Windows Server 2022, Red Hat Enterprise Linux 8.4 x64, Red Hat Enterprise Linux 7.9 x64, SuSE Enterprise Linux 15 SP3 x64</Attribute>-->
 <Attribute Name="OSD.1#OSName"></Attribute>
 <Attribute Name="OSD.1#OSMediaShareIP"></Attribute>
 <Attribute Name="OSD.1#OSMediaShareName"></Attribute>
 <Attribute Name="OSD.1#OSMediaShareUsername"></Attribute>
 <Attribute Name="OSD.1#OSMediaSharePassword">******</Attribute>
 <Attribute Name="OSD.1#OSMediaShareDomainName"></Attribute>
 <Attribute Name="OSD.1#OSMediaShareType"></Attribute>
 <Attribute Name="OSD.1#OSMediaName"></Attribute>
 <Attribute Name="OSD.1#AnswerFileName"></Attribute>
 <Attribute Name="OSD.1#ExposeDuration"></Attribute>
 <Attribute Name="OSD.1#OSMediaHashType"></Attribute>
 <Attribute Name="OSD.1#OSMediaHashValue"></Attribute>
</Component>
</SystemConfiguration>

- PASS, final detailed job status results for job ID JID_637666466531 -

('@odata.context', '/redfish/v1/$metadata#DellJob.DellJob')
('@odata.id',
 '/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/Jobs/JID_637666466531')
('@odata.type', '#DellJob.v1_2_0.DellJob')
('ActualRunningStartTime', '2022-09-21T08:24:06')
('ActualRunningStopTime', '2022-09-21T08:24:10')
('CompletionTime', '2022-09-21T08:24:10')
('Description', 'Job Instance')
('EndTime', None)
('Id', 'JID_637666466531')
('JobState', 'Completed')
('JobType', 'ExportConfiguration')
('Message', 'Successfully exported Server Configuration Profile')
('MessageArgs', [])
('MessageArgs@odata.count', 0)
('MessageId', 'SYS043')
('Name', 'Export: Server Configuration Profile')
('PercentComplete', 100)
('StartTime', '2022-09-21T08:24:06')
('TargetSettingsURI', None)

- Exported attributes also saved in file: 2022-9-21_102413_export.xml
  1. Next you need to modify the SCP file passing in the network share details of the ISO. In this example i'll be using ISO location "http://128.173.237.17/pub/CentOS/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-boot.iso".

SCP file example below showing only the attributes you need to perform this workflow.

<SystemConfiguration> 
<Component FQDD="LifecycleController.Embedded.1"> 
 <Attribute Name="OSD.1#OSMediaShareIP">128.173.237.17</Attribute> 
 <Attribute Name="OSD.1#OSMediaShareName">pub/CentOS/8-stream/isos/x86_64</Attribute> 
 <Attribute Name="OSD.1#OSMediaShareType">HTTP</Attribute> 
 <Attribute Name="OSD.1#OSMediaName">CentOS-Stream-8-x86_64-latest-boot.iso</Attribute> 
 <Attribute Name="OSD.1#ExposeDuration">14400</Attribute>
</Component> 
</SystemConfiguration>
  1. Once you have completed editing the SCP file you can now import it. Server will automatically reboot and boot to the ISO to start the installation. Once the server successfully boots to the ISO, the SCP import job is marked completed.
C:\Python39>ImportSystemConfigurationLocalFilenameREDFISH.py -ip 192.168.0.120 -u root -p calvin --target LifecycleController --shutdown-type Forced --filename 2022-9-21_102413_export.xml

- PASS, JID_637667784386 successfully created for ImportSystemConfiguration method

- INFO, "Importing Server Configuration Profile.", percent complete: 20
- PASS, job ID JID_637667784386 successfully marked completed

- Detailed configuration changes and job results for "JID_637667784386"

{'Message': 'Successfully imported and applied Server Configuration Profile.',
 'MessageArgs': [],
 'MessageArgs@odata.count': 0,
 'MessageId': 'IDRAC.2.7.SYS053'}

- JID_637667784386 completed in: 0:04:00
  1. Once the OS installation is complete, the ISO will still be attached by the iDRAC. You can either wait for the internal timeout to elapse which is 18 hours or you can customize this timeout value by setting attribute OSD.1#ExposeDuration in the SCP file. In my example i set it to 14400 (value in seconds) so the ISO will auto detach after 4 hours. Or you can manually detach the ISO using OEM action DellOSDeploymentService.DetachISOImage (example below).
C:\Python39>BootToNetworkIsoOsdREDFISH.py -ip 192.168.0.120 -u root -p calvin --detach

- PASS: POST command passed to detach ISO image, status code 200 returned
- PASS, ISO attach status successfully identified as "NotAttached"

Thanks Tex