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 <boleslawx.ogonczyk-makowski@intel.com>
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index 4d86c3e..284b5d2 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -421,6 +421,7 @@
{
if (ec)
{
+ BMCWEB_LOG_ERROR("DBus getAllProperties error: {}", ec.message());
conn.close("Internal Error");
return;
}
@@ -433,6 +434,7 @@
if (!success)
{
+ BMCWEB_LOG_ERROR("Failed to unpack properties");
conn.close("Internal Error");
return;
}
@@ -462,14 +464,20 @@
{
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);