HewlettPackard / python-redfish-utility

Python-based utility for interacting with devices supporting a Redfish Service
Other
86 stars 41 forks source link

Load Command: ERROR: list index out of range #10

Closed sw-elling closed 2 years ago

sw-elling commented 5 years ago

With ilorest 2.3.4, running the following:

ilorest --nologo load -f ilo5.raid.json

Results in it failing with:

Loading configuration... ERROR: list index out of range

Running with the debug option shows:

INFO : Exception: IndexError(list index out of range) ERROR: list index out of range Traceback (most recent call last): File "", line 293, in run File "", line 181, in _run_command File "extensions/COMMANDS/LoadCommand.py", line 186, in run IndexError: list index out of range ILOREST return code: 255

The contents of ilo5.raid.json were obtained by using:

ilorest --nologo save --selector=SmartStorageConfig. -f ilo5.raid.json

Then edited according to SmartStorageConfig.v2_0_0.SmartStorageConfig to contain the following:

[
  {
    "Comments": {
      "Manufacturer": "HPE",
      "Model": "ProLiant DL380 Gen10",
      "BIOSFamily": "U30"
    }
  },
  {
    "#SmartStorageConfig.v2_0_0.SmartStorageConfig": {
      "/redfish/v1/systems/1/smartstorageconfig/settings/": {
        "DriveWriteCache": "Disabled",
        "ExpandPriority": "Medium",
        "DataGuard": "Permissive",
        "NoBatteryWriteCache": "Disabled",
        "PowerModeAfterReboot": "MaxPerformance",
        "PredictiveSpareRebuild": "Disabled",
        "QueueDepth": "Automatic",
        "ReadCachePercent": 10,
        "RebuildPriority": "High",
        "LogicalDrives": [
          {
            "CapacityBlocks": -1,
            "Raid": "Raid1",
            "LogicalDriveNumber": 1,
            "Accelerator": "IOBypass",
            "BlockSizeBytes": 512,
            "CapacityGiB": -1,
            "LogicalDriveName": "OS Drive",
            "StripeSizeBytes": 524288,
            "StripSizeBytes": 524288,
            "DataDrives": {
              "DataDriveCount": 2,
              "DataDriveMediaType": "SSD"
            }
          },
          {
            "CapacityBlocks": -1,
            "Raid": "Raid6",
            "LogicalDriveNumber": 2,
            "Accelerator": "ControllerCache",
            "BlockSizeBytes": 512,
            "CapacityGiB": -1,
            "LogicalDriveName": "Data Drive",
            "StripeSizeBytes": 11010048,
            "StripSizeBytes": 524288,
            "SpareRebuildMode": "Dedicated",
            "SpareDrives": {
              "SpareDriveCount": 1
            },
            "DataDrives": {
              "DataDriveCount": 23,
              "DataDriveMediaType": "HDD",
              "DataDriveMinimumSizeGiB": 1000
            }
          }
        ]
      }
    }
  }
]
rpm -q --qf '%{NAME} %{VERSION}\n' ilorest
ilorest 2.3.4
Yergidy commented 5 years ago

I will take a look at this failure.

To manage smartarray you may want to look into the smartarray commands. These will perform the same tasks as you are attempting here without having to generate the full payload yourself: https://hewlettpackard.github.io/python-redfish-utility/#createlogicaldrive-command

sw-elling commented 5 years ago

I'm aware of the smartarray commands. I'm trying to get the entire server configured in one go (BIOS, iLO, RAID) with load because we have 2,000 servers and counting to configure.

However, using load will have less utility and I might not be able to use it because I just found the ManagerAccount type's version information is different between minor revisions of the iLO5 firmware (1.39 vs. 1.40) making it nigh impossible to use load because the full type name including the version has to be in the json file.

Yergidy commented 5 years ago

You can run any iLOrest command concurrently using the --cache-dir option. More information available here: https://hewlettpackard.github.io/python-redfish-utility/#using-the-parallel-distributed-shell-pdsh-to-execute-commands-in-parallel-example The rule of thumb is each server should have its own cache directory and to always logout after so you don't leave behind any cache.

I understand your frustration with different Type versions not allowing a load. Different type versions can include or exclude extra properties that would incorrectly load back onto the server. We will need to think on the best way to implement cross version loads.

sw-elling commented 5 years ago

I'm trying to use the "createlogicaldrive" command and ilorest does not report an error, however; after power cycling servers, nothing changes. All drives on the RAID array remain unconfigured.

sw-elling commented 5 years ago

Plus, if I do the following:

  1. Run ilorest "clearrestapistate" command

I've had to do this before to address "Validation error(s) in type Bios".

  1. Run ilorest "logout" command
  2. Reboot server or power cycle server per "clearrestapistate" requirement
  3. Run ilorest "login" command
  4. Run ilorest "createlogicaldrive" again

I then get "Unable to locate instance for smartstorageconfig."

However, if I:

  1. Run ilorest "logout" command
  2. Run ilorest "login" command
  3. Run ilorest "createlogicaldrive" again

I do no get an error, however, it still does not work.

sw-elling commented 5 years ago

The servers in question are running iLO Firmware Version 1.40 Feb 05 2019.

sw-elling commented 5 years ago

Another weird aspect is I ran the ilorest "createlogicaldrive" command on two servers yesterday, which are running iLO Firmware Version 1.40 Feb 05 2019, and it worked as expected.

sw-elling commented 5 years ago

$ rpm -qi ilorest Name : ilorest Relocations: (not relocatable) Version : 2.4.1 Vendor: Hewlett Packard Enterprise Company Release : 14 Build Date: Thu 28 Mar 2019 03:50:55 PM CDT Install Date: Mon 22 Apr 2019 04:25:44 PM CDT Build Host: bls11u3x64004.sde.rdlabs.hpecorp.net Group : System/Configuration/Packaging Source RPM: ilorest-2.4.1-14.src.rpm Size : 8675874 License: Copyright 2016-2019 Hewlett Packard Enterprise Development LP Signature : RSA/8, Thu 28 Mar 2019 03:52:40 PM CDT, Key ID c208adde26c2b797 Packager : Hewlett Packard Enterprise Company URL : http://hp.com/go/proliantlinux Summary : HPE RESTful Interface Tool Description : Command line interface for managing HPE ProLiant Servers

Authors:

Hewlett Packard Enterprise
sw-elling commented 4 years ago

I'm no longer supporting HPE hardware so do what you want with this issue.

robisonjoel commented 4 years ago

I have also hit this problem.

@Yergidy Yergidy Can you Elaborate on "different Type versions not allowing a load" - is this simply the version of the RedFish Datum, for example SmartStorageConfig.v2_0_1.SmartStorageConfig or SmartStorageConfig.v2_0_0.SmartStorageConfig ?

My use case is exactly as above, we are also trying to deploy large numbers of servers using a pipeline

robisonjoel commented 4 years ago

I'd like to add that I CAN POST this information directly to the Redfish API on the ILO and get the desired result: PUT to https://ILOHOSTNAME/redfish/v1/Systems/1/SmartStorageConfig/settings/

{ 
    "DataGuard": "Disabled",
    "Location": "Slot 0",
    "LocationFormat": "PCISlot",
    "LogicalDrives": [
        {
            "Accelerator": "IOBypass",
            "BlockSizeBytes": 512,
            "CapacityBlocks": 937637552,
            "DataDrives": [
                "1I:1:1",
                "1I:1:2"
            ],
            "DriveLocationFormat": "ControllerPort:Box:Bay",
            "LegacyBootPriority": "Primary",
            "LogicalDriveName": "OS",
            "Raid": "Raid1",
            "SpareDrives": [],
            "SpareRebuildMode": null,
            "StripSizeBytes": 262144,
            "StripeSizeBytes": 262144
        }
    ]   
}

vs with ilorest:

[
  {
    "#SmartStorageConfig.v2_0_1.SmartStorageConfig": {
      "/redfish/v1/systems/1/smartstorageconfig/settings/": {
        "DataGuard": "Disabled",
        "Id": "settings",
        "Location": "Slot 0",
        "LocationFormat": "PCISlot",
        "PowerModeAfterReboot": "MaxPerformance",
        "QueueDepth": "Automatic"
        "LogicalDrives": [
          {
            "Accelerator": "IOBypass",
            "BlockSizeBytes": 512,
            "CapacityBlocks": 937637552,
            "DataDrives": [
              "1I:1:1",
              "1I:1:2"
            ],
            "DriveLocationFormat": "ControllerPort:Box:Bay",
            "LegacyBootPriority": "Primary",
            "LogicalDriveName": "OS",
            "Raid": "Raid1",
            "SpareDrives": [],
            "SpareRebuildMode": null,
            "StripSizeBytes": 262144,
            "StripeSizeBytes": 262144
          }
        ]
      }
    }
  }
]
iLORESTeam commented 3 years ago

We are trying to come up with python examples for smart array config using redfish API. Will let you know soon.

Kallio commented 3 years ago

any updates? this ERROR: list index out of range is really annoying "feature" . More or less showstopper

rajeevkallur commented 3 years ago

Please use version 3.2.2 and let us know if it is still the issue.

sahanaramavana commented 2 years ago

Hi @Kallio ,

Kindly try the steps on our latest released version which is iLORest 3.3.0 and let us know whether it is reproducible.

When tested locally we are not able to reproduce it in our setup with our released version of the tool.

Thanks & Regards, Sahana