openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
165 stars 135 forks source link

POST to Chassis.Reset for invalid chassis ID returns 200 OK status code #289

Open FarahRasheed1 opened 1 month ago

FarahRasheed1 commented 1 month ago

Is this the right place to submit this?

Bug Description

Problem

Sending a POST request to reset an invalid chassis that does not exist returns 200 OK. I reproduced this on QEMU, see logs below.

It looks like the service is not validating the chassis ID correctly for Chassis.Reset action , leading it to respond with 200 OK even when the chassis doesn't exist.

Curl command:

curl -v -k -u root:0penBmc -X POST https://localhost:2443/redfish/v1/Chassis/random_chassis_that_does_not_exist/Actions/Chassis.Reset \
-H "Content-Type: application/json" \
-d '{
    "ResetType": "PowerCycle"
}'

Response:

{
  "@Message.ExtendedInfo": [
    {
      "@odata.type": "#Message.v1_1_1.Message",
      "Message": "The request completed successfully.",
      "MessageArgs": [],
      "MessageId": "Base.1.13.0.Success",
      "MessageSeverity": "OK",
      "Resolution": "None"
    }
  ]
}

Logs

Sep 17 14:48:32 romulus phosphor-chassis-state-manager[291]: Change to Chassis Requested Power State: xyz.openbmc_project.State.Chassis.Transition.PowerCycle

Version

ID=openbmc-openpower
NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro)"
VERSION="2.14.0"
VERSION_ID=2.14.0
VERSION_CODENAME="langdale"
PRETTY_NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) 2.14.0"
BUILD_ID="20240724195151"
OPENBMC_TARGET_MACHINE="romulus"
EXTENDED_VERSION="2.14.0"

Additional Information

No response

edtanous commented 1 month ago

Pretty sure this is because all chassis resets are routed to one dbus path, not a per-chassis path. I think @wltu had some patches a while back trying to clean this behavior up, but I don't know where they landed.

Thanks for the bug report!

williamspatrick commented 1 month ago

I assume this is also being worked by @mox669 who is doing the multi-host implementation.

FarahRasheed1 commented 1 month ago

Yup, I had found https://gerrit.openbmc.org/c/openbmc/bmcweb/+/45396 which at a first look might fix this bug, but figured since there were no open issues, I may as well open it to keep track of it.