NVMeMetric: disable HostInit log for OCP boot drives This is a walk-around solution. It should be resolved by the long term solution via b/404877612 The OCP boot drive implements a very large data area 1 for 07h log, which is incompatible to transfer via OOB. We need to disable the Metric so it won't blocks other NVMe transmission Tested: b/404902460#comment3 Google-Bug-Id: 404902460 Signed-off-by: Hao Jiang <jianghao@google.com> Change-Id: Icc0943b732c3a02dc470a7ff92ab039261c52771
diff --git a/src/NVMeController.cpp b/src/NVMeController.cpp index bae660b..bb544cb 100644 --- a/src/NVMeController.cpp +++ b/src/NVMeController.cpp
@@ -21,6 +21,23 @@ using sdbusplus::xyz::openbmc_project::NVMe::server::NVMeAdmin; using SchedulerClockType = std::chrono::steady_clock; +inline std::optional<std::string> findPluginName(const SensorData& config) +{ + // find base configuration + auto sensorBase = config.find(configInterfaceName(nvme::sensorType)); + if (sensorBase == config.end()) + { + return {}; + } + const SensorBaseConfigMap& sensorConfig = sensorBase->second; + auto findPlugin = sensorConfig.find("Plugin"); + if (findPlugin == sensorConfig.end()) + { + return std::nullopt; + } + return std::get<std::string>(findPlugin->second); +} + std::shared_ptr<NVMeControllerEnabled> NVMeControllerEnabled::create(NVMeController&& nvmeController) { @@ -231,13 +248,15 @@ // TODO: configurable interval std::chrono::duration_cast<SchedulerClockType::duration>( std::chrono::seconds(60)))); - + auto pluginName = findPluginName(config); auto hostTelemetry = - std::shared_ptr<HostTelemetryMetric>(new HostTelemetryMetric( - this->weak_from_this(), scheduler, - // TODO: configurable interval - std::chrono::duration_cast<SchedulerClockType::duration>( - std::chrono::seconds(900)))); + (!pluginName || pluginName != "OCP") + ? std::shared_ptr<HostTelemetryMetric>(new HostTelemetryMetric( + this->weak_from_this(), scheduler, + // TODO: configurable interval + std::chrono::duration_cast<SchedulerClockType::duration>( + std::chrono::seconds(900)))) + : std::shared_ptr<HostTelemetryMetric>(); // NOLINTEND(modernize-make-shared) this->metricStore.emplace(