Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 1 | #include "fru-fault-monitor.hpp" |
| 2 | |
Patrick Williams | 9bd334f | 2022-03-16 11:28:26 -0500 | [diff] [blame] | 3 | #include <phosphor-logging/elog-errors.hpp> |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 4 | #include <phosphor-logging/elog.hpp> |
George Liu | e9fb5c6 | 2021-07-01 14:05:32 +0800 | [diff] [blame] | 5 | #include <phosphor-logging/lg2.hpp> |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 6 | #include <sdbusplus/exception.hpp> |
Patrick Williams | 9bd334f | 2022-03-16 11:28:26 -0500 | [diff] [blame] | 7 | #include <xyz/openbmc_project/Common/error.hpp> |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 8 | |
Dhruvaraj Subhashchandran | 59b86cd | 2017-04-13 00:19:44 -0500 | [diff] [blame] | 9 | namespace phosphor |
| 10 | { |
| 11 | namespace led |
| 12 | { |
| 13 | namespace fru |
| 14 | { |
| 15 | namespace fault |
| 16 | { |
| 17 | namespace monitor |
| 18 | { |
| 19 | |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 20 | using namespace phosphor::logging; |
| 21 | |
George Liu | 1f0b715 | 2023-07-18 09:24:34 +0800 | [diff] [blame] | 22 | static constexpr auto mapperBusName = "xyz.openbmc_project.ObjectMapper"; |
| 23 | static constexpr auto mapperObjPath = "/xyz/openbmc_project/object_mapper"; |
| 24 | static constexpr auto mapperIntf = "xyz.openbmc_project.ObjectMapper"; |
| 25 | static constexpr auto objMgrIntf = "org.freedesktop.DBus.ObjectManager"; |
| 26 | static constexpr auto ledGroups = "/xyz/openbmc_project/led/groups/"; |
| 27 | static constexpr auto logIntf = "xyz.openbmc_project.Logging.Entry"; |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 28 | |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 29 | using AssociationList = |
| 30 | std::vector<std::tuple<std::string, std::string, std::string>>; |
Patrick Williams | a41d282 | 2020-05-13 17:57:23 -0500 | [diff] [blame] | 31 | using Attributes = std::variant<bool, AssociationList>; |
Dhruvaraj Subhashchandran | aebfde8 | 2017-07-11 01:36:33 -0500 | [diff] [blame] | 32 | using PropertyName = std::string; |
Patrick Williams | f204403 | 2022-03-17 05:12:30 -0500 | [diff] [blame] | 33 | using PropertyMap = std::unordered_map<PropertyName, Attributes>; |
Matt Spinler | b2f253b | 2018-06-13 09:54:13 -0500 | [diff] [blame] | 34 | using InterfaceName = std::string; |
Patrick Williams | f204403 | 2022-03-17 05:12:30 -0500 | [diff] [blame] | 35 | using InterfaceMap = std::unordered_map<InterfaceName, PropertyMap>; |
Dhruvaraj Subhashchandran | aebfde8 | 2017-07-11 01:36:33 -0500 | [diff] [blame] | 36 | |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 37 | using Service = std::string; |
| 38 | using Path = std::string; |
| 39 | using Interface = std::string; |
| 40 | using Interfaces = std::vector<Interface>; |
Patrick Williams | f204403 | 2022-03-17 05:12:30 -0500 | [diff] [blame] | 41 | using MapperResponseType = |
| 42 | std::unordered_map<Path, std::unordered_map<Service, Interfaces>>; |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 43 | |
Patrick Williams | 9bd334f | 2022-03-16 11:28:26 -0500 | [diff] [blame] | 44 | using ResourceNotFoundErr = |
| 45 | sdbusplus::xyz::openbmc_project::Common::Error::ResourceNotFound; |
| 46 | using InvalidArgumentErr = |
| 47 | sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument; |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 48 | |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 49 | std::string getService(sdbusplus::bus_t& bus, const std::string& path) |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 50 | { |
George Liu | 1f0b715 | 2023-07-18 09:24:34 +0800 | [diff] [blame] | 51 | auto mapper = bus.new_method_call(mapperBusName, mapperObjPath, mapperIntf, |
| 52 | "GetObject"); |
| 53 | mapper.append(path.c_str(), std::vector<std::string>({objMgrIntf})); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 54 | |
Patrick Williams | f204403 | 2022-03-17 05:12:30 -0500 | [diff] [blame] | 55 | std::unordered_map<std::string, std::vector<std::string>> mapperResponse; |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 56 | try |
| 57 | { |
George Liu | d78de14 | 2021-08-23 16:16:32 +0800 | [diff] [blame] | 58 | auto mapperResponseMsg = bus.call(mapper); |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 59 | mapperResponseMsg.read(mapperResponse); |
| 60 | } |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 61 | catch (const sdbusplus::exception_t& e) |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 62 | { |
George Liu | e9fb5c6 | 2021-07-01 14:05:32 +0800 | [diff] [blame] | 63 | lg2::error( |
| 64 | "Failed to parse getService mapper response, ERROR = {ERROR}", |
| 65 | "ERROR", e); |
Patrick Williams | 9bd334f | 2022-03-16 11:28:26 -0500 | [diff] [blame] | 66 | using namespace xyz::openbmc_project::Common; |
| 67 | elog<ResourceNotFoundErr>(ResourceNotFound::RESOURCE(path.c_str())); |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 68 | } |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 69 | if (mapperResponse.empty()) |
| 70 | { |
Patrick Williams | 9bd334f | 2022-03-16 11:28:26 -0500 | [diff] [blame] | 71 | using namespace xyz::openbmc_project::Common; |
| 72 | elog<ResourceNotFoundErr>(ResourceNotFound::RESOURCE(path.c_str())); |
George Liu | c5e0f31 | 2021-12-27 15:54:31 +0800 | [diff] [blame] | 73 | return {}; |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | return mapperResponse.cbegin()->first; |
| 77 | } |
| 78 | |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 79 | void action(sdbusplus::bus_t& bus, const std::string& path, bool assert) |
Dhruvaraj Subhashchandran | 59b86cd | 2017-04-13 00:19:44 -0500 | [diff] [blame] | 80 | { |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 81 | std::string service; |
| 82 | try |
| 83 | { |
George Liu | 1f0b715 | 2023-07-18 09:24:34 +0800 | [diff] [blame] | 84 | std::string groups{ledGroups}; |
Matt Spinler | e77b834 | 2018-09-12 10:41:53 -0500 | [diff] [blame] | 85 | groups.pop_back(); |
| 86 | service = getService(bus, groups); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 87 | } |
Patrick Williams | 9bd334f | 2022-03-16 11:28:26 -0500 | [diff] [blame] | 88 | catch (const ResourceNotFoundErr& e) |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 89 | { |
Patrick Williams | 9bd334f | 2022-03-16 11:28:26 -0500 | [diff] [blame] | 90 | commit<ResourceNotFoundErr>(); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 91 | return; |
| 92 | } |
| 93 | |
George Liu | 4bb15d8 | 2024-08-22 19:10:44 +0800 | [diff] [blame^] | 94 | auto pos = path.rfind('/'); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 95 | if (pos == std::string::npos) |
| 96 | { |
Patrick Williams | 9bd334f | 2022-03-16 11:28:26 -0500 | [diff] [blame] | 97 | using namespace xyz::openbmc_project::Common; |
| 98 | report<InvalidArgumentErr>( |
| 99 | InvalidArgument::ARGUMENT_NAME("path"), |
| 100 | InvalidArgument::ARGUMENT_VALUE(path.c_str())); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 101 | return; |
| 102 | } |
| 103 | auto unit = path.substr(pos + 1); |
| 104 | |
George Liu | 1f0b715 | 2023-07-18 09:24:34 +0800 | [diff] [blame] | 105 | std::string ledPath = ledGroups + unit + '_' + LED_FAULT; |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 106 | |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 107 | auto method = bus.new_method_call(service.c_str(), ledPath.c_str(), |
| 108 | "org.freedesktop.DBus.Properties", "Set"); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 109 | method.append("xyz.openbmc_project.Led.Group"); |
| 110 | method.append("Asserted"); |
| 111 | |
Patrick Williams | a41d282 | 2020-05-13 17:57:23 -0500 | [diff] [blame] | 112 | method.append(std::variant<bool>(assert)); |
Adriana Kobylak | 08d613e | 2018-07-18 15:30:39 -0500 | [diff] [blame] | 113 | |
| 114 | try |
| 115 | { |
| 116 | bus.call_noreply(method); |
| 117 | } |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 118 | catch (const sdbusplus::exception_t& e) |
Adriana Kobylak | 08d613e | 2018-07-18 15:30:39 -0500 | [diff] [blame] | 119 | { |
| 120 | // Log an info message, system may not have all the LED Groups defined |
George Liu | e9fb5c6 | 2021-07-01 14:05:32 +0800 | [diff] [blame] | 121 | lg2::info("Failed to Assert LED Group, ERROR = {ERROR}", "ERROR", e); |
Adriana Kobylak | 08d613e | 2018-07-18 15:30:39 -0500 | [diff] [blame] | 122 | } |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 123 | |
Dhruvaraj Subhashchandran | 59b86cd | 2017-04-13 00:19:44 -0500 | [diff] [blame] | 124 | return; |
| 125 | } |
| 126 | |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 127 | void Add::created(sdbusplus::message_t& msg) |
Dhruvaraj Subhashchandran | 59b86cd | 2017-04-13 00:19:44 -0500 | [diff] [blame] | 128 | { |
Patrick Williams | 3eedbe4 | 2017-05-31 17:27:05 -0500 | [diff] [blame] | 129 | auto bus = msg.get_bus(); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 130 | |
Matt Spinler | b2f253b | 2018-06-13 09:54:13 -0500 | [diff] [blame] | 131 | sdbusplus::message::object_path objectPath; |
| 132 | InterfaceMap interfaces; |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 133 | try |
| 134 | { |
Matt Spinler | b2f253b | 2018-06-13 09:54:13 -0500 | [diff] [blame] | 135 | msg.read(objectPath, interfaces); |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 136 | } |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 137 | catch (const sdbusplus::exception_t& e) |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 138 | { |
George Liu | e9fb5c6 | 2021-07-01 14:05:32 +0800 | [diff] [blame] | 139 | lg2::error("Failed to parse created message, ERROR = {ERROR}", "ERROR", |
| 140 | e); |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 141 | return; |
| 142 | } |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 143 | |
Matt Spinler | b2f253b | 2018-06-13 09:54:13 -0500 | [diff] [blame] | 144 | std::size_t found = objectPath.str.find(ELOG_ENTRY); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 145 | if (found == std::string::npos) |
| 146 | { |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 147 | // Not a new error entry skip |
Patrick Williams | 3eedbe4 | 2017-05-31 17:27:05 -0500 | [diff] [blame] | 148 | return; |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 149 | } |
Andrew Geissler | a6e4892 | 2019-11-06 08:43:54 -0600 | [diff] [blame] | 150 | auto iter = interfaces.find("xyz.openbmc_project.Association.Definitions"); |
Matt Spinler | b2f253b | 2018-06-13 09:54:13 -0500 | [diff] [blame] | 151 | if (iter == interfaces.end()) |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 152 | { |
Patrick Williams | 3eedbe4 | 2017-05-31 17:27:05 -0500 | [diff] [blame] | 153 | return; |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 154 | } |
| 155 | |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 156 | // Nothing else shows when a specific error log |
| 157 | // has been created. Do it here. |
George Liu | b4c82cf | 2023-01-04 10:23:36 +0800 | [diff] [blame] | 158 | lg2::info("{PATH} created", "PATH", objectPath); |
Matt Spinler | 3d2b0d6 | 2018-03-29 08:48:37 -0500 | [diff] [blame] | 159 | |
Andrew Geissler | a6e4892 | 2019-11-06 08:43:54 -0600 | [diff] [blame] | 160 | auto attr = iter->second.find("Associations"); |
Dhruvaraj Subhashchandran | aebfde8 | 2017-07-11 01:36:33 -0500 | [diff] [blame] | 161 | if (attr == iter->second.end()) |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 162 | { |
Patrick Williams | 3eedbe4 | 2017-05-31 17:27:05 -0500 | [diff] [blame] | 163 | return; |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 164 | } |
| 165 | |
Patrick Williams | 5ebebef | 2020-05-13 11:47:27 -0500 | [diff] [blame] | 166 | auto& assocs = std::get<AssociationList>(attr->second); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 167 | |
| 168 | for (const auto& item : assocs) |
| 169 | { |
| 170 | if (std::get<1>(item).compare(CALLOUT_REV_ASSOCIATION) == 0) |
| 171 | { |
Patrick Williams | 3eedbe4 | 2017-05-31 17:27:05 -0500 | [diff] [blame] | 172 | removeWatches.emplace_back( |
Dhruvaraj Subhashchandran | aebfde8 | 2017-07-11 01:36:33 -0500 | [diff] [blame] | 173 | std::make_unique<Remove>(bus, std::get<2>(item))); |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 174 | action(bus, std::get<2>(item), true); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 175 | } |
| 176 | } |
Dhruvaraj Subhashchandran | aebfde8 | 2017-07-11 01:36:33 -0500 | [diff] [blame] | 177 | |
Patrick Williams | 3eedbe4 | 2017-05-31 17:27:05 -0500 | [diff] [blame] | 178 | return; |
Dhruvaraj Subhashchandran | 59b86cd | 2017-04-13 00:19:44 -0500 | [diff] [blame] | 179 | } |
| 180 | |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 181 | void getLoggingSubTree(sdbusplus::bus_t& bus, MapperResponseType& subtree) |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 182 | { |
| 183 | auto depth = 0; |
George Liu | 1f0b715 | 2023-07-18 09:24:34 +0800 | [diff] [blame] | 184 | auto mapperCall = bus.new_method_call(mapperBusName, mapperObjPath, |
| 185 | mapperIntf, "GetSubTree"); |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 186 | mapperCall.append("/"); |
| 187 | mapperCall.append(depth); |
George Liu | 1f0b715 | 2023-07-18 09:24:34 +0800 | [diff] [blame] | 188 | mapperCall.append(std::vector<Interface>({logIntf})); |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 189 | |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 190 | try |
| 191 | { |
Matt Spinler | 9112292 | 2018-09-24 11:31:44 -0500 | [diff] [blame] | 192 | auto mapperResponseMsg = bus.call(mapperCall); |
George Liu | d78de14 | 2021-08-23 16:16:32 +0800 | [diff] [blame] | 193 | mapperResponseMsg.read(subtree); |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 194 | } |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 195 | catch (const sdbusplus::exception_t& e) |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 196 | { |
George Liu | e9fb5c6 | 2021-07-01 14:05:32 +0800 | [diff] [blame] | 197 | lg2::error( |
| 198 | "Failed to parse existing callouts subtree message, ERROR = {ERROR}", |
| 199 | "ERROR", e); |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 200 | } |
Matt Spinler | 9112292 | 2018-09-24 11:31:44 -0500 | [diff] [blame] | 201 | } |
| 202 | |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 203 | void Add::processExistingCallouts(sdbusplus::bus_t& bus) |
Matt Spinler | 9112292 | 2018-09-24 11:31:44 -0500 | [diff] [blame] | 204 | { |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 205 | MapperResponseType mapperResponse; |
Matt Spinler | 9112292 | 2018-09-24 11:31:44 -0500 | [diff] [blame] | 206 | |
| 207 | getLoggingSubTree(bus, mapperResponse); |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 208 | if (mapperResponse.empty()) |
| 209 | { |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 210 | // No errors to process. |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 211 | return; |
| 212 | } |
| 213 | |
| 214 | for (const auto& elem : mapperResponse) |
| 215 | { |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 216 | auto method = bus.new_method_call( |
| 217 | elem.second.begin()->first.c_str(), elem.first.c_str(), |
| 218 | "org.freedesktop.DBus.Properties", "Get"); |
Andrew Geissler | a6e4892 | 2019-11-06 08:43:54 -0600 | [diff] [blame] | 219 | method.append("xyz.openbmc_project.Association.Definitions"); |
| 220 | method.append("Associations"); |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 221 | auto reply = bus.call(method); |
| 222 | if (reply.is_method_error()) |
| 223 | { |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 224 | // do not stop, continue with next elog |
George Liu | e9fb5c6 | 2021-07-01 14:05:32 +0800 | [diff] [blame] | 225 | lg2::error("Error in getting associations"); |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 226 | continue; |
| 227 | } |
| 228 | |
Patrick Williams | a41d282 | 2020-05-13 17:57:23 -0500 | [diff] [blame] | 229 | std::variant<AssociationList> assoc; |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 230 | try |
| 231 | { |
| 232 | reply.read(assoc); |
| 233 | } |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 234 | catch (const sdbusplus::exception_t& e) |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 235 | { |
George Liu | e9fb5c6 | 2021-07-01 14:05:32 +0800 | [diff] [blame] | 236 | lg2::error( |
| 237 | "Failed to parse existing callouts associations message, ERROR = {ERROR}", |
| 238 | "ERROR", e); |
William A. Kennington III | 151122a | 2018-05-15 12:00:32 -0700 | [diff] [blame] | 239 | continue; |
| 240 | } |
Patrick Williams | 5ebebef | 2020-05-13 11:47:27 -0500 | [diff] [blame] | 241 | auto& assocs = std::get<AssociationList>(assoc); |
Dhruvaraj Subhashchandran | 891c476 | 2017-07-31 14:26:37 -0500 | [diff] [blame] | 242 | |
| 243 | for (const auto& item : assocs) |
| 244 | { |
| 245 | if (std::get<1>(item).compare(CALLOUT_REV_ASSOCIATION) == 0) |
| 246 | { |
| 247 | removeWatches.emplace_back( |
| 248 | std::make_unique<Remove>(bus, std::get<2>(item))); |
| 249 | action(bus, std::get<2>(item), true); |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
Patrick Williams | 3e073ba | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 255 | void Remove::removed(sdbusplus::message_t& msg) |
Dhruvaraj Subhashchandran | 59b86cd | 2017-04-13 00:19:44 -0500 | [diff] [blame] | 256 | { |
Patrick Williams | 3eedbe4 | 2017-05-31 17:27:05 -0500 | [diff] [blame] | 257 | auto bus = msg.get_bus(); |
Dhruvaraj Subhashchandran | 3c6f29a | 2017-04-20 09:47:28 -0500 | [diff] [blame] | 258 | |
Patrick Williams | 3eedbe4 | 2017-05-31 17:27:05 -0500 | [diff] [blame] | 259 | action(bus, inventoryPath, false); |
| 260 | return; |
Dhruvaraj Subhashchandran | 59b86cd | 2017-04-13 00:19:44 -0500 | [diff] [blame] | 261 | } |
| 262 | |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 263 | } // namespace monitor |
| 264 | } // namespace fault |
| 265 | } // namespace fru |
| 266 | } // namespace led |
| 267 | } // namespace phosphor |