quiesce: use entry id for interface
Extension code does not have the Entry object as an input parameter. The
quiesce interface should not require an Entry object. Refactor the code
a bit to allow for this.
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I5caee881dae3d6c22f4f619af5acd3e3e33379aa
diff --git a/log_manager.cpp b/log_manager.cpp
index bcc94a5..c8c6cc5 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -233,9 +233,9 @@
std::move(objects), fwVersion, *this);
serialize(*e);
- if (isQuiesceOnErrorEnabled())
+ if (isQuiesceOnErrorEnabled() && isCalloutPresent(*e))
{
- checkQuiesceOnError(*e);
+ quiesceOnError(entryId);
}
doExtensionLogCreate(*e, ffdc);
@@ -369,26 +369,20 @@
this->busLog.call_noreply(quiesce);
}
-void Manager::checkQuiesceOnError(const Entry& entry)
+void Manager::quiesceOnError(const uint32_t entryId)
{
- if (!isCalloutPresent(entry))
- {
- return;
- }
-
logging::log<logging::level::INFO>(
"QuiesceOnError set and callout present");
auto blockPath =
- std::string(OBJ_LOGGING) + "/block" + std::to_string(entry.id());
- auto blockObj =
- std::make_unique<Block>(this->busLog, blockPath, entry.id());
+ std::string(OBJ_LOGGING) + "/block" + std::to_string(entryId);
+ auto blockObj = std::make_unique<Block>(this->busLog, blockPath, entryId);
this->blockingErrors.push_back(std::move(blockObj));
// Register call back if log is resolved
using namespace sdbusplus::bus::match::rules;
- auto entryPath = std::string(OBJ_ENTRY) + '/' + std::to_string(entry.id());
+ auto entryPath = std::string(OBJ_ENTRY) + '/' + std::to_string(entryId);
auto callback = std::make_unique<sdbusplus::bus::match::match>(
this->busLog,
propertiesChanged(entryPath, "xyz.openbmc_project.Logging.Entry"),
@@ -396,7 +390,7 @@
std::placeholders::_1));
propChangedEntryCallback.insert(
- std::make_pair(entry.id(), std::move(callback)));
+ std::make_pair(entryId, std::move(callback)));
checkAndQuiesceHost();
}
diff --git a/log_manager.hpp b/log_manager.hpp
index 34117dc..be8c8b4 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -196,11 +196,11 @@
*/
bool isQuiesceOnErrorEnabled();
- /** @brief Check if error has callout and if so, block boot
+ /** @brief Create boot block association and quiesce host if running
*
- * @param[in] entry - The error to check for callouts
+ * @param[in] entryId - The ID of the phosphor logging error
*/
- void checkQuiesceOnError(const Entry& entry);
+ void quiesceOnError(const uint32_t entryId);
/** @brief Check if inventory callout present in input entry
*
diff --git a/test/elog_quiesce_test.cpp b/test/elog_quiesce_test.cpp
index 4675073..8ec17d3 100644
--- a/test/elog_quiesce_test.cpp
+++ b/test/elog_quiesce_test.cpp
@@ -81,31 +81,6 @@
EXPECT_EQ(manager.isCalloutPresent(elog), true);
}
-// Test that no blocking errors are created when no callout
-TEST_F(TestQuiesceOnError, testNoBlockingErrorsCreated)
-{
- uint32_t id = 99;
- uint64_t timestamp{100};
- std::string message{"test error"};
- std::string fwLevel{"level42"};
- std::vector<std::string> testData{"no", "callout"};
- phosphor::logging::AssociationList associations{};
-
- Entry elog{mockedBus,
- std::string(OBJ_ENTRY) + '/' + std::to_string(id),
- id,
- timestamp,
- Entry::Level::Informational,
- std::move(message),
- std::move(testData),
- std::move(associations),
- fwLevel,
- manager};
-
- manager.checkQuiesceOnError(elog);
- EXPECT_EQ(manager.getBlockingErrSize(), 0);
-}
-
// Test that a blocking error is created on entry with callout
TEST_F(TestQuiesceOnError, testBlockingErrorsCreated)
{
@@ -140,7 +115,7 @@
fwLevel,
manager};
- manager.checkQuiesceOnError(elog);
+ manager.quiesceOnError(id);
// Created error with callout so expect a blocking error now
EXPECT_EQ(manager.getBlockingErrSize(), 1);
@@ -195,7 +170,7 @@
fwLevel,
manager};
- manager.checkQuiesceOnError(elog);
+ manager.quiesceOnError(id);
// Created error with callout so expect a blocking error now
EXPECT_EQ(manager.getBlockingErrSize(), 1);
// Also should have a callback create looking for entry to be resolved