Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redfish Crashed after applying plan #286

Open
Rossnunez opened this issue Feb 11, 2025 · 6 comments
Open

Redfish Crashed after applying plan #286

Rossnunez opened this issue Feb 11, 2025 · 6 comments
Assignees

Comments

@Rossnunez
Copy link


panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x754f49]

goroutine 49 [running]:
terraform-provider-redfish/redfish/provider.(*StorageDatasource).readDatasourceRedfishStorage(_, {{0x2, {0xc000610040, 0xa}}, {0xc000151110, 0x1, 0x1}, {0xc0001c4a08, 0x4, 0x4}, ...})
        terraform-provider-redfish/redfish/provider/data_source_redfish_storage.go:168 +0x589
terraform-provider-redfish/redfish/provider.(*StorageDatasource).Read(0xc00041d8c0, {0xf0b1e8, 0xc0007a9350}, {{{{0xf16a58, 0xc0009005a0}, {0xb96800, 0xc0004d4db0}}, {0xf196b0, 0xc000688240}}, {{{0x0, ...}, ...}, ...}, ...}, ...)
        terraform-provider-redfish/redfish/provider/data_source_redfish_storage.go:131 +0x205
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ReadDataSource(0xc000348000, {0xf0b1e8, 0xc0007a9350}, 0xc0006d8c40, 0xc000591628)
        github.com/hashicorp/[email protected]/internal/fwserver/server_readdatasource.go:103 +0x751
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ReadDataSource(0xc000348000, {0xf0b1e8?, 0xc0007a9260?}, 0xc0007a9200)
        github.com/hashicorp/[email protected]/internal/proto6server/server_readdatasource.go:55 +0x389
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadDataSource(0xc00032a0a0, {0xf0b1e8?, 0xc0007a8870?}, 0xc00016ee60)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:688 +0x27d
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadDataSource_Handler({0xd05e00, 0xc00032a0a0}, {0xf0b1e8, 0xc0007a8870}, 0xc00036d680, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:599 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000344000, {0xf0b1e8, 0xc0007a87e0}, {0xf17ce0, 0xc00047a000}, 0xc00000c5a0, 0xc000047dd0, 0x164de80, 0x0)
        google.golang.org/[email protected]/server.go:1394 +0xe49
google.golang.org/grpc.(*Server).handleStream(0xc000344000, {0xf17ce0, 0xc00047a000}, 0xc00000c5a0)
        google.golang.org/[email protected]/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1029 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 52
        google.golang.org/[email protected]/server.go:1040 +0x125

Error: The terraform-provider-redfish_v1.5.0.exe plugin crashed!```
@Krishnan-Priyanshu
Copy link
Collaborator

Hi @Rossnunez , Please provide the steps to reproduce the issue with below details:
Terraform CLI and Terraform Redfish Provider Version
Server(s) and Firmware Version.

@Rossnunez
Copy link
Author

Rossnunez commented Feb 12, 2025

Hi @Krishnan-Priyanshu

Details:
Terraform Redfish Provider Version: 1.5.0
Terraform Version CLI Version: Terraform v1.10.5 on windows_386
Server: PowerEdge R660
iDRAC Firmware Version: 7.10.05.00

Source of Code that's causing the crash:
main.tf

data "redfish_storage" "storage_test" {
  for_each = var.rack1

  redfish_server {
    user         = each.value.user
    password     = var.idrac_new_pw
    endpoint     = each.value.endpoint
    ssl_insecure = each.value.ssl_insecure
  }
}

Lore:
For some reason I'm unable to run this specific data source on this particular server. So far I'm able to run every other data source from the terraform redfish provider like, redfish_storage_controller. I can't run this data source, redfish_storage on this server. It works for other servers I've tested on like, PowerEdge R650. I even ran a GET request to /redfish/v1/Systems/System.Embedded.1/Storage/ for the PowerEdge R660 Server and it returned proper results.

I can't seem to figure out why this data source call, redfish_storage is returning with this type of bug.

@sapana05
Copy link
Contributor

Hi @Rossnunez,

Is it okay to share the response of /redfish/v1/Systems/System.Embedded.1/Storage/ get call, If you are not able to share the exact response you may remove the sensitive value from response and share with us.

@Rossnunez
Copy link
Author

Hi @sapana05 ,

Here's the response when performing this GET call on the server that's causing me issues:

{
  "@odata.context": "/redfish/v1/$metadata#StorageCollection.StorageCollection",
  "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Storage/",
  "@odata.type": "#StorageCollection.StorageCollection",
  "Description": "Collection Of Storage entities",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Storage/RAID.SL.3-1"
    },
    {
      "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Storage/AHCI.Embedded.2-1"
    },
    {
      "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Storage/AHCI.Embedded.1-1"
    },
    {
      "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Storage/BOSS.SL.12-1"
    },
    {
      "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Storage/CPU.1"
    }
  ],
  "[email protected]": 5,
  "Name": "Storage Collection"
}

@Rossnunez
Copy link
Author

Rossnunez commented Feb 12, 2025

Hello, @sapana05,

I did a bit more testing and ran data.redfish_storage with the controller_names parameter. I ran it against each individual storage entity. As I went down the list, each one returned without crashing except for one.

I realized the source of the crash is when data.redfish_storage attempts to pull information from this storage entity:
"@odata.id": "/redfish/v1/Systems/System.Embedded.1/Storage/CPU.1"

Can this use case be account for in the next update?

UPDATE
I also wanted to make note of another thing I noticed. When calling data.redfish_storage_controller, I see all storage controllers get returned except for CPU.
I assume that maybe this bug was patched in data.redfish_storage_controller but not data.redfish_storage?

@sapana05
Copy link
Contributor

Hi @Rossnunez ,

Patch PR for this issue has been already raised, #287,
You may track the above PR for storage datasource, This patch will be reflective in upcoming release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants