From 69f4ab95fa066172c31eeb5c17975eeeda01d437 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Mon, 9 Apr 2018 14:24:27 -0500 Subject: Revert "Delay return from updateUbootEnvVars() until service file finishes" This reverts commit 2225fda1dbe6e5fe87c009174d941369ab7e7b3a. This change causes intermittent issues that haven't been solved. Reverting for now. Change-Id: Ie5c9b2700ad715741e4e90a6e7afcdd5c6b095f3 Signed-off-by: Adriana Kobylak --- item_updater.cpp | 4 ---- serialize.cpp | 41 ----------------------------------------- serialize.hpp | 7 ------- 3 files changed, 52 deletions(-) diff --git a/item_updater.cpp b/item_updater.cpp index a4198ab..df73fc5 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -575,10 +575,6 @@ void ItemUpdater::updateUbootEnvVars(const std::string& versionId) log("Failed to update u-boot env variables", entry("VERSIONID=%s", versionId.c_str())); } - - // On average this service takes about 5 seconds. Therefore setting - // it to 3x average time should be more than sufficient. - waitForServiceFile(updateEnvVarsFile, 15); } void ItemUpdater::resetUbootEnvVars() diff --git a/serialize.cpp b/serialize.cpp index 29bd640..b59ff46 100644 --- a/serialize.cpp +++ b/serialize.cpp @@ -2,11 +2,8 @@ #include #include #include -#include #include "serialize.hpp" #include -#include -#include namespace phosphor { @@ -17,9 +14,6 @@ namespace updater namespace fs = std::experimental::filesystem; -using namespace phosphor::logging; -using namespace std::chrono_literals; - void storeToFile(std::string versionId, uint8_t priority) { auto bus = sdbusplus::bus::new_default(); @@ -40,10 +34,6 @@ void storeToFile(std::string versionId, uint8_t priority) SYSTEMD_INTERFACE, "StartUnit"); method.append(serviceFile, "replace"); bus.call_noreply(method); - - // On average it takes 1-2 seconds for the service to complete. - // Therefore timeout is set to 3x average completion time. - waitForServiceFile(serviceFile, 6); } bool restoreFromFile(std::string versionId, uint8_t& priority) @@ -114,37 +104,6 @@ void removeFile(std::string versionId) } } -void waitForServiceFile(const std::string& serviceFile, int timeout) -{ - auto bus = sdbusplus::bus::new_default(); - - std::time_t start = time(0); - std::time_t end = time(0); - - while (end - start < timeout) - { - auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH, - SYSTEMD_INTERFACE, "GetUnit"); - method.append(serviceFile); - auto result = bus.call(method); - - // "GetUnit" returns the unit object path for a unit name. - // If the unit is not found because it hasn't been loaded yet, - // or in this case because it has finished and exited, the call - // will fail. - if (result.is_method_error()) - { - return; - } - - std::this_thread::sleep_for(1s); - end = time(0); - } - - log("Service file timed out!", - entry("FILENAME=%s", serviceFile.c_str())); -} - } // namespace phosphor } // namespace software } // namespace openpower diff --git a/serialize.hpp b/serialize.hpp index 604aada..03eea99 100644 --- a/serialize.hpp +++ b/serialize.hpp @@ -30,13 +30,6 @@ bool restoreFromFile(std::string versionId, uint8_t& priority); **/ void removeFile(std::string versionId); -/** @brief Delays until the completion of the supplied service file or until - * specified timeout is reached. - * @param[in] serviceFile - Service file to wait for. - * @param[in] timeout - Fallback timeout so we don't get stuck. - **/ -void waitForServiceFile(const std::string& serviceFile, int timeout); - } // namespace phosphor } // namespace software } // namespace openpower -- cgit v1.2.1