Skip to content

Commit

Permalink
Monitor slot presence check
Browse files Browse the repository at this point in the history
Reviewed By: somasun

Differential Revision: D66385071

fbshipit-source-id: ab550a3945eb19b3a1d2e7205137df670705841a
  • Loading branch information
Justin Kim authored and facebook-github-bot committed Dec 12, 2024
1 parent 8303c61 commit 049c853
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
6 changes: 6 additions & 0 deletions fboss/platform/platform_manager/ExplorationSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ enum class ExplorationErrorType {
RUN_DEVMAP_SYMLINK,
PCI_DEVICE_EXPLORE,
IDPROM_READ,
SLOT_PM_UNIT_ABSENCE,
SLOT_PRESENCE_CHECK,
// Need this for ExplorationErrorType size at compile time.
SIZE
};
Expand Down Expand Up @@ -46,6 +48,10 @@ constexpr const char* toExplorationErrorTypeStr(
return "pci_device_explore";
case ExplorationErrorType::IDPROM_READ:
return "idprom_read";
case ExplorationErrorType::SLOT_PM_UNIT_ABSENCE:
return "slot_pm_unit_absence";
case ExplorationErrorType::SLOT_PRESENCE_CHECK:
return "slot_presence_check";
case ExplorationErrorType::SIZE:
throw std::invalid_argument("Do not use ExplorationErrorType::SIZE");
}
Expand Down
23 changes: 19 additions & 4 deletions fboss/platform/platform_manager/PlatformExplorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,30 @@ void PlatformExplorer::exploreSlot(
// condition is satisfied
if (const auto presenceDetection = slotConfig.presenceDetection()) {
try {
if (!presenceChecker_.isPresent(
presenceDetection.value(), childSlotPath)) {
auto isPmUnitPresent =
presenceChecker_.isPresent(presenceDetection.value(), childSlotPath);
if (!isPmUnitPresent) {
auto errMsg = fmt::format(
"Skipping exploring Slot {} at {}. No PmUnit in the Slot",
slotName,
childSlotPath);
XLOG(ERR) << errMsg;
explorationSummary_.addError(
ExplorationErrorType::SLOT_PM_UNIT_ABSENCE,
Utils().createDevicePath(childSlotPath, "<ABSENT>"),
errMsg);
return;
}
} catch (const std::exception& ex) {
XLOG(ERR) << fmt::format(
"Error checking for presence in slotpath {}: {}",
auto errMsg = fmt::format(
"Error checking for presence in SlotPath {}: {}",
slotName,
ex.what());
XLOG(ERR) << errMsg;
explorationSummary_.addError(
ExplorationErrorType::SLOT_PRESENCE_CHECK,
Utils().createDevicePath(childSlotPath, "<ABSENT>"),
errMsg);
return;
}
}
Expand Down

0 comments on commit 049c853

Please sign in to comment.