summaryrefslogtreecommitdiffstats
path: root/mainapp.cpp
Commit message (Collapse)AuthorAgeFilesLines
* mainapp: Fix missing includesWilliam A. Kennington III2019-01-161-0/+4
| | | | | | | | Tested: Built and run through unit tests. Change-Id: Iede17218b421f2694135600683c7ad185b8766f4 Signed-off-by: William A. Kennington III <wak@google.com>
* Convert to standard CLI11 argument parserWilliam A. Kennington III2018-10-051-112/+107
| | | | | | | | | | | | This simplifies the argument parsing logic drastically and still provides the same error handling as before. Tested: Ran through unit test suite and manually verified that the command line functions as expected on a real BMC. Change-Id: Ic5d69adf5359f9f64f2ada17e6a8f3242ca03e25 Signed-off-by: William A. Kennington III <wak@google.com>
* Convert to using sdeventplusWilliam A. Kennington III2018-10-051-24/+12
| | | | | | | | | | | | This gets rid of the ad-hoc timer class in favor of using the timer source built into sdeventplus. Tested: Unit tests pass and everything still builds. Manually verified the functionality is still in tact on a zaius machine. Change-Id: I90619f0fe5a9fdfcecd24a49de672c0c99dc95e9 Signed-off-by: William A. Kennington III <wak@google.com>
* mainapp: Detect duplicate action targetsWilliam A. Kennington III2018-09-171-0/+6
| | | | | | | | | | | Tested: Passes the unit test suite and manually verified that the daemon works with a normal config on a zaius machine. Also verified that it produces an error if configured with multiple targets for a single action. Change-Id: I8fba74f5fdfeb22c465e27b478805dc1ca702cd3 Signed-off-by: William A. Kennington III <wak@google.com>
* Standardize Action -> Target Map TypeWilliam A. Kennington III2018-09-171-13/+12
| | | | | | | | | | | | | | | This change refactors the watchdog header to export the type of watchdog action to systemd target map, so it can be directly used by other files. This makes enumerating the map type more trivial. Also convert to an unordered_map instead of map since we don't need the ordering guarantees. Tested: Builds and tests still pass Change-Id: I77d315210ec27fde295589479c50d46dc5d1b32a Signed-off-by: William A. Kennington III <wak@google.com>
* Switch to C++17William A. Kennington III2018-09-131-2/+2
| | | | | | | | | | | | There is no harm in doing this since we are not a client library and all environments using this project should have c++17 compliant compilers at this point. Tested: Run through unit test suite. Change-Id: Iceae5375fd69b1929e1c4e2c6c297d131c61de68 Signed-off-by: William A. Kennington III <wak@google.com>
* add .clang-formatPatrick Venture2018-09-111-23/+27
| | | | | Change-Id: I6d9ec8401dcd46781ea258bf8998faa2507fa91d Signed-off-by: Patrick Venture <venture@google.com>
* Implement a flag to enable fallback alwaysWilliam A. Kennington III2018-03-071-0/+12
| | | | | | | | | On some machines we want our watchdog running as long as the phosphor-watchdog daemon is alive. This patch adds an option to enter fallback mode any time the watchdog expires or is set to be disabled. Change-Id: Ic96d2f15c761aeb4e25158c5bd861076cca6497d Signed-off-by: William A. Kennington III <wak@google.com>
* Implement a fallback watchdog optionWilliam A. Kennington III2018-03-071-1/+45
| | | | | | | | | | | | | | | | | | Sometimes our initial watchdog action is not enough to recover the host from the state it transitioned into. However, always using a more power form of power cycle is not desirable as we can lose useful CPU crash state. It is desirable in this case to have two levels of watchog timers. This patch implements the ability for the service to specify a fallback watchdog action and interval. After the initial watchdog timeout is encountered, the watchdog will be re-armed with the new parameters. Once the watchdog times out again it will execute the fallback action. Attempts to update the timeRemaining will reset the fallback just in case something is still alive. Change-Id: I69f4422c7e3963f02200815f3cef620af9e6cf8b Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Rewrite timeoutHandler() to make disabling part of the timeoutWilliam A. Kennington III2018-03-071-19/+2
| | | | | | | | This makes no functional changes to the user interface but make future code reworks shorter. Change-Id: Ibd57a5d1090588c8a7b2a67730660c3cf47c832e Signed-off-by: William A. Kennington III <wak@google.com>
* mainapp: Parse action -> target mappings on the command lineWilliam A. Kennington III2018-02-211-0/+28
| | | | | | | | | | This adds the argument --action_target=<action>=<systemd_target>. Depending on the HostAction that is set when the watchdog expires we can start different systemd targets. The configuration of this mapping is now configurable at the command line. Change-Id: I7482e038d9abafc81cec0df15345cbfc670dbed2 Signed-off-by: William A. Kennington III <wak@google.com>
* mainapp: Print out the action -> target map at startupWilliam A. Kennington III2018-02-211-0/+16
| | | | | | | | | We have multiple methods for setting the action to systemd target mappings on the command line. This makes it more clear to the end user what the daemon interprets as the final mapping when it starts up. Change-Id: Ib57dc04575a578bba54f5bf8cb47d6a61690d3a3 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Support multiple timeout actionsWilliam A. Kennington III2018-02-151-5/+13
| | | | | | | | | | | | This change adds the infrastructure to support having different actions map to different systemd targets being started when the watchdog expires. Right now this maintains compatability with the current --target argument and populates all of the watchdog actions, except for None, with the same target. A follow up patch will implement setting independent targets for each action. Change-Id: I0f0601f9e94d488650f20a9cebfc7c967007d78c Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Support multiple argumentsWilliam A. Kennington III2018-02-051-6/+21
| | | | | | | | | | This will be used in future patches. Right now this should retain similar behavior to the current argument parsing semantics. The difference is we now require arguments to be specified only once and error if they are specified multiple times. Change-Id: I21e4cf9734f045c2b0991f7ed0ec6e6a569eec7d Signed-off-by: William A. Kennington III <wak@google.com>
* Add option for daemon to continue running after timeoutPatrick Venture2017-08-231-2/+28
| | | | | | | | | Added new command line option that lets someone disable the watchdog timer on timer expiration instead of the default action of it exiting. Change-Id: I1c3414d4378872860ac083836cda4809fa26237a Signed-off-by: Patrick Venture <venture@google.com>
* Commit error and exit the application on error scenariosVishwanatha Subbanna2017-06-081-15/+28
| | | | | | | | Typically sd_event* calls can not go wrong and if they do, better would be to terminate the application so we get a coredump. Change-Id: I899177c369332cabf6d9bc22daaa142b50d758d0 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
* Call systemd target on timer expirationVishwanatha Subbanna2017-06-051-1/+2
| | | | | | | | | | User can pass an optional command line argument stating which systemd target needs to be called on timer expiration. The timeout handler will make sure that the systemd target is started prior to exiting. Change-Id: I37213ab28ad4166a47920dcb3dc79769c7f2af1a Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
* Implement Watchdog interfaceVishwanatha Subbanna2017-06-021-5/+17
| | | | | | | This commit gives concrete implementation of the interface. Change-Id: I3951c5811c8e6cff87c87842a1e3c538463bfde7 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
* Add timer class supportVishwanatha Subbanna2017-06-021-0/+28
| | | | | | | | Watchdog implementation uses sd_event_timer at the backend and this commit has that timer backend support. Change-Id: Ib6dbd5d6bb617c20d7361e0852a916aa506d5aad Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
* Add code to accept command line argumentsVishwanatha Subbanna2017-06-021-0/+52
Accepts command line arguments for dbus object path, dbus service name and an optional systemd unit file to be called into when the timer expires. Change-Id: I3fbe59b36d73ed9f28de2596d77e6d2e99371622 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud