Move bmcweb over to sdbusplus
This patchset moves bmcweb from using boost-dbus over entirely to
sdbusplus. This has some nice improvements in performance (about 30%
of CPU cycles saved in dbus transactions), as well as makes this
project manuver closer to the upstream way of thinking.
Changes to bmcweb are largely ceremonial, and fall into a few
categories:
1. Moves async_method_call instances to the new format, and deletes any
use of the "endpoint" object in leiu of the sdbusplus style interface
2. sdbus object_path object doesn't allow access to the string
directly, so code that uses it moves to explicit casts.
3. The mapbox variant, while attempting to recreate boost::variant,
misses a T* get<T*>() method implementation, which allows using variant
without exceptions. Currently, there is an overload for
mapbox::get_ptr implementation which replecates the functionality.
Tested by: Booting the bmcweb on a target, iterating through redfish
basic phosphor-webui usage, and websockets usage
Change-Id: I2d95882908d6eb6dba00b9219a221dd96449ca7b
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/include/intel_oem.hpp b/include/intel_oem.hpp
index e821807..f2dc163 100644
--- a/include/intel_oem.hpp
+++ b/include/intel_oem.hpp
@@ -10,24 +10,29 @@
template <typename... Middlewares>
void request_routes(Crow<Middlewares...>& app) {
CROW_ROUTE(app, "/intel/firmwareupload")
- .methods("POST"_method)([](const crow::request& req) {
+ .methods(
+ "POST"_method)([](const crow::request& req, crow::response& res) {
std::string filepath("/tmp/fw_update_image");
std::ofstream out(filepath, std::ofstream::out | std::ofstream::binary |
std::ofstream::trunc);
out << req.body;
out.close();
+ crow::connections::system_bus->async_method_call(
+ [&](boost::system::error_code ec) {
+ std::cout << "async_method_call callback\n";
+ if (ec) {
+ std::cerr << "error with async_method_call \n";
+ res.json_value["status"] = "Upload failed";
+ } else {
+ res.json_value["status"] = "Upload Successful";
+ }
+ res.end();
+ },
+ "xyz.openbmc_project.fwupdate1.server",
+ "/xyz/openbmc_project/fwupdate1", "xyz.openbmc_project.fwupdate1",
+ "start", "file://" + filepath);
- auto m = dbus::message::new_call(
- {"xyz.openbmc_project.fwupdate1.server",
- "/xyz/openbmc_project/fwupdate1", "xyz.openbmc_project.fwupdate1"},
- "start");
-
- m.pack(std::string("file://") + filepath);
- crow::connections::system_bus->send(m);
- nlohmann::json j;
- j["status"] = "Upload Successful";
- return j;
});
}
-} // namespace redfish
+} // namespace intel_oem
} // namespace crow