From 5ec22842d0d61380809d8e9cdfbc692c14c32cab Mon Sep 17 00:00:00 2001 From: Boleslaw Ogonczyk Makowski Date: Thu, 16 May 2024 14:23:43 +0200 Subject: Fix mounting in proxy mode in virtual media Broken by [1], interface and path were incorrect after changing getManagedObjects to getAllProperties. Tested: Mounting in proxy mode works [1]: https://github.com/openbmc/bmcweb/commit/e4b32753a7ce7ca436bf751f390ee01f02b9efd5 Change-Id: I06f36e8fc864fe13200d5d13a12639ebba9d9be1 Signed-off-by: Boleslaw Ogonczyk Makowski --- include/vm_websocket.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp index 4d86c3e231..284b5d2e1c 100644 --- a/include/vm_websocket.hpp +++ b/include/vm_websocket.hpp @@ -421,6 +421,7 @@ inline void { if (ec) { + BMCWEB_LOG_ERROR("DBus getAllProperties error: {}", ec.message()); conn.close("Internal Error"); return; } @@ -433,6 +434,7 @@ inline void if (!success) { + BMCWEB_LOG_ERROR("Failed to unpack properties"); conn.close("Internal Error"); return; } @@ -462,14 +464,20 @@ inline void onOpen(crow::websocket::Connection& conn) { BMCWEB_LOG_DEBUG("nbd-proxy.onopen({})", logPtr(&conn)); - sdbusplus::message::object_path path( - "/xyz/openbmc_project/VirtualMedia/nbd"); + if (conn.url().segments().size() < 2) + { + BMCWEB_LOG_ERROR("Invalid path - \"{}\"", conn.url().path()); + conn.close("Internal error"); + return; + } - path /= std::to_string(0); + std::string index = conn.url().segments().back(); + std::string path = + std::format("/xyz/openbmc_project/VirtualMedia/Proxy/Slot_{}", index); sdbusplus::asio::getAllProperties( *crow::connections::systemBus, "xyz.openbmc_project.VirtualMedia", path, - "xyz.openbmc_project.VirtualMedia", + "xyz.openbmc_project.VirtualMedia.MountPoint", [&conn, path](const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& propertiesList) { afterGetSocket(conn, path, ec, propertiesList); -- cgit v1.2.3