Skip to content

Handle GET and PATCH for ReadyToRemove on assemblies#1500

Open
rahulds98 wants to merge 1 commit into
ibm-openbmc:1210from
rahulds98:cm_patch_readytoremove
Open

Handle GET and PATCH for ReadyToRemove on assemblies#1500
rahulds98 wants to merge 1 commit into
ibm-openbmc:1210from
rahulds98:cm_patch_readytoremove

Conversation

@rahulds98

@rahulds98 rahulds98 commented Jul 10, 2026

Copy link
Copy Markdown
  1. Add GET handling for Assembly ReadyToRemove by reading the xyz.openbmc_project.State.ReadyToRemove interface from the inventory object and exposing it under the assembly

  2. Update PATCH handling so non-special assemblies set the D-Bus ReadyToRemove property directly instead of rejecting the request. Keep existing special handling for tod_battery and panel FRUs.

Tested-By:

  1. GET returns the correct property under the inventory d-bus
  2. PATCH sets the readytoremove on the inventory dbus

GET:

curl -k -H https://${bmc}/redfish/v1/Chassis/chassis0/Assembly | jq -r '.Assemblies[] | select(.MemberId=="16")

    {
      "@odata.id": "/redfish/v1/Chassis/chassis0/Assembly#/Assemblies/16",
      "@odata.type": "#Assembly.v1_6_0.AssemblyData",
      "Location": {
        "PartLocation": {
          "ServiceLabel": "Ufcs-SC0-LCD0"
        }
      },
      "MemberId": "16",
      "Model": "6B86",
      "Name": "LCD Operator Panel",
      "PartNumber": "PN12345",
      "ReadyToRemove": true,
      "SerialNumber": "YL6B86010000",
      "SparePartNumber": "F191014",
      "Status": {
        "Health": "OK",
        "State": "Enabled"
      }
    }

returns the ReadyToRemove on lcd-op-panel
PATCH:

curl -k -X PATCH -H "Content-Type: application/json" https://${bmc}/redfish/v1/Chassis/chassis0/Assembly -d '{"Assemblies":[{"MemberId":"0","ReadyToRemove":false}]}'

sets the readytoremove property value on the bmc inventory object

@rahulds98 rahulds98 requested a review from asmithakarun July 10, 2026 10:46
@rahulds98 rahulds98 force-pushed the cm_patch_readytoremove branch from eaa353d to 2a8d183 Compare July 10, 2026 10:46
@rahulds98 rahulds98 requested a review from manojkiraneda July 10, 2026 10:48
@jenkins-openbmc-ibm

Copy link
Copy Markdown

Can one of the admins verify this patch?

@rfrandse

Copy link
Copy Markdown
Collaborator

add to approvelist

@rahulds98 rahulds98 force-pushed the cm_patch_readytoremove branch from 2a8d183 to 926a18a Compare July 10, 2026 14:26
@asmithakarun

Copy link
Copy Markdown
Contributor
<Annotation Term="Redfish.OwningEntity" String="DMTF"/>
<Annotation Term="Redfish.Release" String="2025.3"/>
<EntityType Name="Assembly" BaseType="Assembly.v1_5_1.Assembly"/>
<EntityType Name="AssemblyData" BaseType="Assembly.v1_5_1.AssemblyData">
<Property Name="ReadyToRemove" Type="Edm.Boolean">
<Annotation Term="OData.Permissions" EnumMember="OData.Permission/ReadWrite"/>
<Annotation Term="OData.Description" String="An indication of whether the assembly is prepared by the system for removal."/>
<Annotation Term="OData.LongDescription" String="This property shall indicate whether the assembly is ready for removal. Setting the value to `true` shall cause the service to perform appropriate actions to quiesce the device. A task may spawn while the device is quiescing."/>
</Property>
</EntityType>
</Schema>```

ReadyToRemove property is already in the standard Redfish schema v1_6_0, so you can remove from Oem

Comment thread redfish-core/lib/assembly.hpp Outdated
}
return;
}
asyncResp->res

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned, remove "Oem" as it is in standard Redfish schema

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to display ReadyToRemove directly under Assembly properties

Comment thread redfish-core/lib/assembly.hpp Outdated
assemblyJsonPtr);
}
else if (interface ==
"xyz.openbmc_project.State.Decorator.ReadyToRemove")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string literal duplication.
else if (interface == readyToRemoveIface)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread redfish-core/lib/assembly.hpp Outdated
#include <utility>
#include <vector>

static constexpr std::string_view readyToRemoveIface =

@asmithakarun asmithakarun Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static constexpr const char* readyToRemoveIface =
"xyz.openbmc_project.State.Decorator.ReadyToRemove";

If you change it to the above, then you can directly use in line 167 (you can skip std::string(..)) and line 234

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@rahulds98 rahulds98 force-pushed the cm_patch_readytoremove branch from 926a18a to 175c893 Compare July 11, 2026 18:51
@rahulds98 rahulds98 requested a review from asmithakarun July 11, 2026 18:54
@rahulds98 rahulds98 force-pushed the cm_patch_readytoremove branch from 175c893 to 9ea3794 Compare July 12, 2026 07:22
@rahulds98 rahulds98 requested review from Pavithrab7 and gtmills July 13, 2026 05:22
}

std::map<std::string, bool> locationIndicatorActiveMap;
std::map<std::string, nlohmann::json> oemIndicatorMap;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, you can keep OemIndicatorMap as is and, just add the readyToRemoveMap to use it for our usecase (line 394)

We can move from the existing Oem property to use the standard redfish for batteryCM in another PR.
@gtmills ^

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retained handling of oem/openbmc/readytoremove for tod battery and panels, added separate handling for readytoremove

{
if (memberId)
{
oemIndicatorMap[*memberId] = *oem;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have the existing code as it is, in this PR

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@rahulds98 rahulds98 force-pushed the cm_patch_readytoremove branch from 9ea3794 to ed3c2b8 Compare July 13, 2026 08:59
Add GET handling for Assembly ReadyToRemove by reading the
xyz.openbmc_project.State.Decorator.ReadyToRemove interface from
the inventory.

Update PATCH handling so non-special assemblies set the D-Bus
ReadyToRemove.
Keep existing special handling for tod_battery and panel CM.

ReadyToRemove is now part of the assemblyproperty and not under
oem schema

Tested-By:
1. GET returns the correct property under the inventory d-bus
2. PATCH sets the readytoremove on the inventory dbus

Signed-off-by: Rahul D S <rahulds.rahul@gmail.com>
@rahulds98 rahulds98 force-pushed the cm_patch_readytoremove branch from ed3c2b8 to e860b1b Compare July 13, 2026 09:11
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

Successfully merging this pull request may close these issues.

4 participants