stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
211 stars 113 forks source link

SetBoot fails #171

Closed jasmeer closed 2 years ago

jasmeer commented 2 years ago

SetBoot fails in Lenovo ThinkSystem SR655 (AMD processor) with error:

{"error":{"@Message.ExtendedInfo":[{"@odata.type":"#Message.v1_0_7.Message","Message":"The request did not provide the required precondition, such as an If-Match or If-None-Match header.","MessageId":"Ami.1.0.PreconditionHeaderMissing","Resolution":"Include the required precondition header in the request","Severity":"Critical"}],"code":"Ami.1.0.PreconditionHeaderMissing","message":"The request did not provide the required precondition, such as an If-Match or If-None-Match header."}

This is what I used as Boot param

redfish.Boot{
            BootSourceOverrideTarget:  redfish.BiosSetupBootSourceOverrideTarget,
            BootSourceOverrideEnabled: redfish.OnceBootSourceOverrideEnabled,
        }

The same works in many other platforms including Lenovo systems that use Intel processors. AMD processor systems use Redfish implementation 'AMI Redfish Server'.

Any help will be appreciated.

Thanks Jasmeer

stmcginnis commented 2 years ago

Hmm, that requirement isn't part of the redfish spec, so it looks like something Lenovo specific. Since you say this works on other Lenovo systems, can you check if the firmware maybe needs to be updated on that system to see if there's a newer redfish service that might have changed this?

jasmeer commented 2 years ago

Thanks. I will check with Lenovo. Here is a doc I found about Redfish on these systems: Lenovo AMD 1P SR635/655 BMC Redfish RESTful API Reference. In page 15 it has a table that talks about precondition headers for PUT and PATCH.

stmcginnis commented 2 years ago

Reading through parts of the spec again, that is a supported option. Headers retrieved in the GET for an object can be used to pass to the PUT or POST. I will have to think about how we can support this.

Still would be interesting to see if the failing Lenovo server is newer or older than the ones that do work. If it is running an older version that can be upgraded, then that makes things easier. If it is newer and this is something that Lenovo now enforces in their Redfish service, that makes this a little more critical.

jasmeer commented 2 years ago

I tested with latest BMC version and it failed the same way.

Any idea what header it is expecting? Thanks Jasmeer

stmcginnis commented 2 years ago

It looks like we can do something similar to what has been done in https://github.com/stmcginnis/gofish/pull/175

I think a more correct solution would be to be able to get the etag as part of the result when getting the object. The use of the etag is to protect against the object changing between when you've retrieved the local representation of it and when you try to update it at some point later. But for now at least, we can just make it part of the update call.

stmcginnis commented 2 years ago

Let me know if this is something you would like to take on. Otherwise I will try to put up something soon. I may be able to get to it later today, in which case I'm guessing you won't have a chance to respond, but if I do it would be great if you could test that the change works on you system since I don't have the resources locally to test this.

jasmeer commented 2 years ago

I can test this only next week. I will send an update once it is done.

Thanks Jasmeer