PEL: Shorten D-Bus timeout value

There are several D-Bus method calls made when creating a PEL to collect
data, and if one of the daemons called into is hung, then
phosphor-log-manager can also hang up to the default timeout value of
25s and an error will be returned to the PEL creator even though the PEL
will eventually be created successfully.

This can cause all sorts of issues for the callers, such as preventing
the PEL from begin reported to the hardware management console to
causing a boot fail because hostboot gets a failure trying to log an
error and shuts down.

To help prevent this, change the timeout value of all D-Bus calls to 10
seconds down from the 25.  This would allow two timeouts to occur during
the creation of a PEL without hitting the 25s timeout that callers use.
When timeouts are hit creating a PEL, that field just won't be filled in
and the PEL can otherwise be created with no issues.

Ten seconds was chosen to allow two failures to occur while still
allowing plenty of time for completion from a healthy daemon.  Also it
seems like if an operation doesn't complete within 10s it wouldn't
complete within 25 either.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ib9f2150c235e19109468d562dad697c4949c09a9
diff --git a/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index fa7b087..a582d88 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -26,6 +26,11 @@
 #include <phosphor-logging/log.hpp>
 #include <xyz/openbmc_project/State/Boot/Progress/server.hpp>
 
+// Use a timeout of 10s for D-Bus calls so if there are
+// timeouts the callers of the PEL creation method won't
+// also timeout.
+constexpr auto dbusTimeout = 10000000;
+
 namespace openpower
 {
 namespace pels
@@ -195,7 +200,7 @@
     auto method = _bus.new_method_call(service.c_str(), objectPath.c_str(),
                                        interface::dbusProperty, "GetAll");
     method.append(interface);
-    auto reply = _bus.call(method);
+    auto reply = _bus.call(method, dbusTimeout);
 
     reply.read(properties);
 
@@ -212,7 +217,7 @@
     auto method = _bus.new_method_call(service.c_str(), objectPath.c_str(),
                                        interface::dbusProperty, "Get");
     method.append(interface, property);
-    auto reply = _bus.call(method);
+    auto reply = _bus.call(method, dbusTimeout);
 
     reply.read(value);
 }
@@ -226,7 +231,7 @@
 
     method.append(std::string{"/"}, 0, interfaces);
 
-    auto reply = _bus.call(method);
+    auto reply = _bus.call(method, dbusTimeout);
 
     DBusPathList paths;
     reply.read(paths);
@@ -243,7 +248,7 @@
 
     method.append(objectPath, std::vector<std::string>({interface}));
 
-    auto reply = _bus.call(method);
+    auto reply = _bus.call(method, dbusTimeout);
 
     std::map<DBusService, DBusInterfaceList> response;
     reply.read(response);
@@ -462,7 +467,7 @@
 
     method.append(addLocationCodePrefix(baseLoc), static_cast<uint16_t>(0));
 
-    auto reply = _bus.call(method);
+    auto reply = _bus.call(method, dbusTimeout);
 
     std::string expandedLocationCode;
     reply.read(expandedLocationCode);
@@ -501,7 +506,7 @@
         method.append(addLocationCodePrefix(baseLoc), node);
     }
 
-    auto reply = _bus.call(method);
+    auto reply = _bus.call(method, dbusTimeout);
 
     std::vector<sdbusplus::message::object_path> entries;
     reply.read(entries);
@@ -531,7 +536,7 @@
         _bus.new_method_call(service_name::ledGroupManager, ledGroup.c_str(),
                              interface::dbusProperty, "Set");
     method.append(interface::ledGroup, "Asserted", variant);
-    _bus.call(method);
+    _bus.call(method, dbusTimeout);
 }
 
 void DataInterface::setFunctional(const std::string& objectPath,
@@ -544,7 +549,7 @@
                                        interface::dbusProperty, "Set");
 
     method.append(interface::operationalStatus, "Functional", variant);
-    _bus.call(method);
+    _bus.call(method, dbusTimeout);
 }
 
 using AssociationTuple = std::tuple<std::string, std::string, std::string>;
@@ -576,7 +581,7 @@
 
         method.append(interface::associationDef, "Associations",
                       setAssociationValue);
-        _bus.call(method);
+        _bus.call(method, dbusTimeout);
     }
 }
 
@@ -590,7 +595,7 @@
                                        interface::objectMapper, "GetSubTree");
     method.append(std::string{"/"}, 0,
                   std::vector<std::string>{interface::compatible});
-    auto reply = _bus.call(method);
+    auto reply = _bus.call(method, dbusTimeout);
 
     reply.read(subtree);
     if (subtree.empty())
@@ -648,7 +653,7 @@
                                        interface::objectMapper, "GetSubTree");
     method.append(std::string{"/"}, 0,
                   std::vector<std::string>{interface::dumpEntry});
-    auto reply = _bus.call(method);
+    auto reply = _bus.call(method, dbusTimeout);
 
     reply.read(subtree);
 
@@ -717,8 +722,8 @@
         // api's. Making d-bus call no reply type to avoid cyclic dependency.
         // Added minimal timeout to catch initial failures.
         // Need to revisit this design later to avoid cyclic dependency.
-        constexpr auto dbusTimeout = 100000; // in micro seconds
-        _bus.call_noreply(method, dbusTimeout);
+        constexpr auto hwIsolationTimeout = 100000; // in micro seconds
+        _bus.call_noreply(method, hwIsolationTimeout);
     }
 
     catch (const sdbusplus::exception::exception& e)
@@ -749,7 +754,7 @@
 
     method.append(interface::bootRawProgress, "Value", variant);
 
-    _bus.call(method);
+    _bus.call(method, dbusTimeout);
 }
 
 std::vector<uint32_t> DataInterface::getLogIDWithHwIsolation() const