summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* build: install into bin instead of sbinHEADmasterPatrick Venture2019-03-281-1/+1
| | | | | | | Installs into bin instead of sbin per guidelines. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I2f61cbda4721533610516c0c91da4b3a16d15b52
* build: pkg anti-pattern: use defaultsPatrick Venture2019-02-131-8/+4
| | | | | | | | Use the defaults in the pkg check where the default error message is sufficient to identify which package is missing. Change-Id: I91e5407066976b4d03e8a6b8d105e9bb8aecf5f7 Signed-off-by: Patrick Venture <venture@google.com>
* README: Add special note on NTP setting changeLei YU2019-01-231-0/+16
| | | | | | | | | | | | | | Systemd timedated from v236 to v239 introduces a behavior change related to setting time while NTP setting is changed. This change causes phosphor-time-manager automation test failure. Add a special note in README to describe the issue, and the test case will be updated. Partially resolves openbmc/openbmc#3459 Change-Id: I8ee31e8de95d8b110bf9cbee7973c377a6d4330a Signed-off-by: Lei YU <mine260309@gmail.com>
* Use a single dbus connection objectBrad Bishop2018-12-193-7/+9
| | | | | | | | | | | | | | | Starting with sdbusplus 8ca6025, calling bus_new_default multiple times doesn't seem to work - making calls that generate dbus traffic on one of the objects results in something like: sd_bus_call: System.Error.ENOTCONN: Transport endpoint is not connected This wasn't ideal anyway - move to a single object, shared application-wide. Tested: Booted a witherspoon QEMU image and there were no coredumps Change-Id: I804a1b1438b22f48e45b26d395135e401ca98a06 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* build: Add missing inclusion of phosphor-loggingPatrick Venture2018-12-061-2/+5
| | | | | | | | | Phosphor-logging is picked up by the configure_ac. Include it in the Makefile such that it's available as defined by the pkgconfig. Change-Id: I173fa376ab3419155267ab08350d7a7ad2e1a0f0 Signed-off-by: Patrick Venture <venture@google.com>
* Fix std::variant usageWilliam A. Kennington III2018-11-062-4/+6
| | | | | | | | We need to conform to the std::variant interface instead of the mapbox specific one. Change-Id: I3edbcb2682ddfebfcbca6e75284b11f2e18cfd11 Signed-off-by: William A. Kennington III <wak@google.com>
* clang-format: Update to match docs repoGunnar Mills2018-10-0824-897/+932
| | | | | | | | | Update the .clang-format file and run clang-format-6.0. This .clang-format matches the example one in https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#clang-formatting Change-Id: Ic2c462525eb27b8295c2b298871e04268d93faf2 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Enable link time optimizationLei YU2018-09-193-3/+7
| | | | | | | | | | | | | | To enable link time optimization, several configures needs to be changed: 1. Add -flto in Makefiles 2. Use C++17 to get inline constexpr 3. Use gcc-ar and gcc-ranlib to generate static library, otherwise it gets link errors. Tested: Build OK and unit tests passes. Change-Id: Ic58cbfb631c97f43c82d5669cbf6ac1ebc5e0ab9 Signed-off-by: Lei YU <mine260309@gmail.com>
* Fix un-initialized time owner/mode in managerLei YU2018-09-123-4/+13
| | | | | | | | | | | | | | | | | The timeOwner/Mode in Manager class has no init value, and it is initialized with the cached time owner/mode in file system. In most of time it is OK because there is cached time owner/mode. But if the BMC does a factory reset, the cached values are cleaned up, and in next reboot the timeOwner/Mode will not be initialized at all. The fix is to give default time owner/mode, so when BMC comes from factory reset it uses default time settings. Tested: Verify the timeOwner/Mode have correct init values after factory reset. Change-Id: Ib1a8fba4d758f33ed09a7afdc9ed684867fca1c5
* Handle SdBusError exception in setting NTPLei YU2018-09-121-4/+6
| | | | | | | | | | | | sdbusplus now throws SdBusError exception when a sd bus call fails. When setting NTP via systemd timedatectl service, it may potentially fail. So handle this exception. Also fix a typo in logging, where it should use `=` in meta. Change-Id: I6c5669b7f06cef47c8d62cb0cbcb0c7fbd2a46e7 Tested: Verify it sets NTP setting OK.
* Handle SdBusError exception in setting timeLei YU2018-09-121-3/+7
| | | | | | | | | | | | | sdbusplus now throws SdBusError exception when a sd bus call fails. When setting time via systemd timedatectl service, it may fail to set time due to time settings. So handle this exception and print the reason. Tested: Verify this service does not crash but prints the exception in journal log, when it fails to set time to systemd. Change-Id: I7d3b2e35e58c3924f95d3664653e68efbae8bd14 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use proper errors when failing to set timeLei YU2018-09-125-18/+36
| | | | | | | | | | | | | | | Previously it reports InsufficientPermission when it is not allowed to set time. Now phosphor-dbus-interfaces defines proper errors for such case, so report NotAllowed error when it is not allowed to set time, and report Failed error when it failed to set time. Tested: Get NotAllowed and Failed error with expected metadata from journal log. Change-Id: I53610bf27ffc3f62608cea6fd0e66ca859d94675 Signed-off-by: Lei YU <mine260309@gmail.com>
* Throw runtime_error instead of MethodErorLei YU2018-09-126-187/+31
| | | | | | | | | | | As suggested, when error occurs in getService/getProperty, it means runtime error, so the code is better to throw std::runtime_error instead of a sdbusplus exception. Tested: Build the code correctly. Change-Id: Iddca72ac1fdd07ed6b731b6509eebbfa9d2579d3 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use correct gtest/gmock flagsLei YU2018-09-122-5/+8
| | | | | | | | | | | The test Makefile.am was using -lgmock -lgmock_main directly, which cause link issues on compiling test. Fix this by using the flags specified by gtest package. Tested: Verify the CI passes build. Change-Id: Id51134d7e2696e18f7439f15f8d899edba51856e Signed-off-by: Lei YU <mine260309@gmail.com>
* Throw excpetion when it is not allowed to set timeLei YU2018-06-134-15/+27
| | | | | | | | | | | | | | When it is not allowed to set time depending on the time setting, previously we only log an error and continue. Now sdbusplus supports errors on properties, so we can throw exception on such case. Tested: Verify in unittest that exception is thrown when it is not allowed to set time. Verify in BMC that busctl gets the error message when it is not allowed to set time. Change-Id: I4a04d1aa8c081abf0f9fd449118dc1107e12f689 Signed-off-by: Lei YU <mine260309@gmail.com>
* Add MAINTAINERS fileAndrew Jeffery2018-05-251-0/+45
| | | | | Change-Id: Idb13c9ab2e30cb6fb5d9e14da604b6e4c133c8a2 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Follow secure coding standards for interactions with the mapperEd Tanous2018-05-092-16/+24
| | | | | | | | | | | | | | | | | This patchset updates phosphor-time-manager to follow secure coding guidelines when interacting with the mapper. Specifically, it replaces uses of std::map with std::vector<std::pair<>>, which should net some small performance wins. This change also causes time-manager to properly enumerate each response. Tested-By: Built with changeset, and verified via d-feet that /xyz/openbmc_project/time/host and /xyz/openbmc_project/time/bmc were present, and verified reading of the "Elapsed" parameter returned the expected time result. Change-Id: If4329d533641595cf0b50c4e50e2dda69b299f52 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
* Spelling fixesGunnar Mills2018-04-081-1/+1
| | | | | | | | | Spelling errors found using github.com/lucasdemarchi/codespell A tool to fix common misspellings. This tool is licensed under GNU General Public License, version 2. Change-Id: I049799e380299bd4290e8f31f2f2c0186c460351 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Enhance documentation with more examplesAndrew Geissler2018-01-251-2/+42
| | | | | | | | | | I found myself looking around for the appropriate curl and busctl commands to configure the time on OpenBMC. I figured them out so figured I'd share. This README was very useful for getting the basics down. Change-Id: I48105d09f2c7afe065ed76c3e27f73e42d0e7807 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
* Fix incorrect host time after setting BMC time in NTP/SplitLei YU2017-11-103-5/+12
| | | | | | | | | | | | | | | The time tests find an issue that after NTP/BMC is changed to NTP/Split, setting BMC time will cause host time change. The root cause is that it fails to set BMC time (which is expected) but still invokes notifyBmcTimeChange(), which cause host to re-calculate the offset. The fix is to not invoke notifyBmcTimeChange() on failure to set BMC time. Change-Id: Id13b5fa8ba7def764eab8afad23661f9b0be37ce Signed-off-by: Lei YU <mine260309@gmail.com>
* Fix incorrect host time issue switching to SPLITLei YU2017-11-101-0/+8
| | | | | | | | | | | | | | | | | The time tests find an issue that when owner is set to Split, and then set the BMC time, the host time becomes incorrect. The root cause is that the diff between host time and steady clock is not updated when the owner is changed to Split, and thus when BMC time is changed, the host time is calculated incorrectly. The fix is to re-calculate the diff between host time and steady clock in this case. Resolves openbmc/openbmc#901 Change-Id: Ida22f27c6adba6b1cf8a41274eb5f26b6f1bdab7 Signed-off-by: Lei YU <mine260309@gmail.com>
* Spelling fixesGunnar Mills2017-10-254-6/+6
| | | | | Change-Id: Ia840360c00cc8d7baaafd797ae2411bc5cc03ed3 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Grammar fixes for README.mdGunnar Mills2017-10-251-12/+12
| | | | | Change-Id: Iaa1c4bc0680c5b0a0cf512e0c61f6b8241070551 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Fix table format in README.mdLei YU2017-10-181-0/+1
| | | | | | | Github flavored markdown requires a blank line between text and table. Change-Id: I55d6b964b9fb699e7b7a57cbd3b8f7b54a617947 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use host state object to check if host is onLei YU2017-10-166-77/+83
| | | | | | | | | The code was using pgood to determine if host is on or off. Now we have host state object, which is a more appropriate way to check host on/off. So change pgood related code to use host state object. Change-Id: I553c1a40922ca2e8bc6904688c55e85971bd4720 Signed-off-by: Lei YU <mine260309@gmail.com>
* Remove use_dhcp_ntp related codeLei YU2017-10-162-116/+0
| | | | | | | | | | Dhcp ntp related functions are now implemented by new network daemon (phosphor-network-manager), so time manager does not need to handle the setting anymore. Remove all the code related to use_dhcp_ntp. Change-Id: Iea7f60dbe9558193585d3cd553dec15bbfe2aaa4 Signed-off-by: Lei YU <mine260309@gmail.com>
* Let timedate1 to decide on setting time in NTP modeLei YU2017-10-164-18/+12
| | | | | | | | In NTP mode, let timedate1 to set BMC time, for now, it results in error. Change-Id: I2d78cdcfe6868642f43198dd932b20b13fd8523d Signed-off-by: Lei YU <mine260309@gmail.com>
* Use new settings APILei YU2017-10-165-18/+104
| | | | | | | | The new time manager code was using the old settings daemon. Now it uses the new settings API. Change-Id: Id551d97c28a6cfbb81c87118b26292b1b5574e93 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use time mode owner enums in dbus interfaceLei YU2017-10-1611-212/+187
| | | | | | | | | | | Dbus interface defines time mode owners in xyz::openbmc_project::Time. Use the enums from the interface instead of repo defined enums and use the generated code to do convertions between strings and enums. Update unit tests accordingly. Change-Id: Ic304aa3b4137375d208bb1702e0f64df512fc5a0 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use elog to throw exceptionsLei YU2017-10-164-62/+69
| | | | | | | Use elog to throw exceptions and update unit tests Change-Id: I338ded4403b3b559a84da311eda5ee15e712569a Signed-off-by: Lei YU <mine260309@gmail.com>
* Add repo specific errorsLei YU2017-10-166-1/+151
| | | | | | | | | 1. Add Internal.errors.yaml to define repo specific errors 2. Update configure.ac and Makefile.am to generate code from error yamls 3. Add elog-gen.hpp generated by elog-gen.py Change-Id: I6858f2c9f3c2100ce106d1effe7ad3f340117fec Signed-off-by: Lei YU <mine260309@gmail.com>
* Change default time mode/owner to MANUAL/BOTHLei YU2017-10-164-8/+13
| | | | | | | | | | OPAL gets error on setting host time because the default time mode/owner is NTP/BMC, which disallows host to set its time. As discussed and requested by OPAL, change the default time mode/owner to MANUAL/BOTH. Change-Id: Ide55f970b66f3025f67ad2ef093a74a3c8f8b8ea Signed-off-by: Lei YU <mine260309@gmail.com>
* Use mapper to find service nameLei YU2017-10-164-25/+103
| | | | | | | | Use objectMapper to find the service name instead of using hard-coded service name. Change-Id: If436c65d9a9a4942eaf30ea20bc7b85e3e7694c1 Signed-off-by: Lei YU <mine260309@gmail.com>
* Implement mode/owner and string conversionsLei YU2017-10-168-107/+230
| | | | | | | | | | Move Manager::convertToMode() to utils::strToMode(); Move Manager::convertToOwner() to utils::strToOwner(); Add utils::modeToStr() and utils::ownerToStr(); Adjust and add unit tests. Change-Id: Ied35d0e732c477017e1b2db1a3464b0425b12387 Signed-off-by: Lei YU <mine260309@gmail.com>
* Remove unused legacy filesLei YU2017-10-166-2257/+0
| | | | | Change-Id: Ieb667636963722d54dba93850dd0e3396e1e83c1 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use gmock on property_change_listenerLei YU2017-10-164-40/+174
| | | | | | | | | | | | | 1. Mock property_change_listener; 2. Make unit test link against gmock 3. Update TestManager to use mocked property change listener. 4. Fix an issue found by the updated test case, that when the properties are changed during host is on, and changed back to the same as before, when host becomes off, the properties shall remain the same and listeners shall not be notified. Change-Id: I815b59cb23edfcac910c2a8c26ea5a71e872d92f Signed-off-by: Lei YU <mine260309@gmail.com>
* Add README.mdLei YU2017-10-161-0/+72
| | | | | Change-Id: I3988740e3666401b4f272f83080edfe7f92513be Signed-off-by: Lei YU <mine260309@gmail.com>
* Invoke SetNTP and UpdateUseNtpField in time managerLei YU2017-10-164-35/+150
| | | | | | | | | | | 1. When time mode is changed, invoke systemd timedate1's SetNTP method to update NTP settings; 2. When settings use_dhcp_ntp property is changed, invoke NetworkManager's UpdateUseNtpField method to update its setting; 3. Move the common code of getProperty() into utils.hpp Change-Id: I981e0e9de9c0430282b3364c38c282312bb2be89 Signed-off-by: Lei YU <mine260309@gmail.com>
* Implement HostEpoch set time logicLei YU2017-10-169-81/+548
| | | | | | | | | | | | | | | | | | | | | | | 1. When setting host epoch, follow below logic: Mode | Owner | Set Host Time ----- | ----- | ------------- NTP | BMC | Not allowed NTP | HOST | Not allowed NTP | SPLIT | OK, and just save offset NTP | BOTH | Not allowed MANUAL| BMC | Not allowed MANUAL| HOST | OK, and set time to BMC MANUAL| SPLIT | OK, and just save offset MANUAL| BOTH | OK, and set time to BMC 2. If owner is SPLIT and BMC time is changed, update the offset accordinly; 3. Use timerfd to get notified on BMC time change, and update host time diff accordingly; 4. Add unit test cases. Change-Id: I2d60a821f7da9b689c579ae7ab672cc37967322c Signed-off-by: Lei YU <mine260309@gmail.com>
* Save properties to persistent storage when host is onLei YU2017-10-167-85/+263
| | | | | | | | | | | | 1. When host is on, set properties as requested properties instead of notify listeners; 2. When host becomes off, and requested properties are not empty, notify the listners and reset the requested properties. Add unit tests. Change-Id: I9359c801c698df0c6e5eab43e12427bb5a6da611 Signed-off-by: Lei YU <mine260309@gmail.com>
* Add pgood signal handler.Lei YU2017-10-162-3/+91
| | | | | | | | Pgood indicate if host is on, which will be used to handle the time mode/owner changes. Change-Id: I7be4f7300aca3d1adc118eb3eb447c1e3734c89f Signed-off-by: Lei YU <mine260309@gmail.com>
* Add time Manager to handle property changes callbackLei YU2017-10-1513-211/+516
| | | | | | | | | | 1. Implement time::Manager who registers property change signal for time mode and owner; 2. Add PropertyChangeListner interface to handle the callback; 3. Make EpochBase to implement the interface. Change-Id: I185580ae37353e1ed82a47e4905fb22e269ac09d Signed-off-by: Lei YU <mine260309@gmail.com>
* Initial implementation of HostEpochLei YU2017-08-019-6/+330
| | | | | | | | | | | | When host time is set, the diff between the BmcTime and the value is saved to persistent storage; When host time is retrieved, return the BmcTime plus the diff as host's time. Add the unit test cases for HostEpoch. Change-Id: Ia55b93bfcba4f226ceaed8491136ea7afda7bd77 Signed-off-by: Lei YU <mine260309@gmail.com>
* Implement BmcEpoch set/get elapsed()Lei YU2017-08-012-15/+44
| | | | | | | | | | | Getting elapsed returns BMC's time; Setting elapsed will check the current time mode/owner, and will return error when mode is NTP or owner is HOST. Add unit test cases. Change-Id: Ibf4e90957f3b26b68c4a1b6dc66dc364c66bef10 Signed-off-by: Lei YU <mine260309@gmail.com>
* Add .gitignoreLei YU2017-08-011-0/+55
| | | | | | | | This will ignore all automake output, built binary and unit-test related files. Change-Id: I4a6d172838850881f47687d464c5f67269b129a7 Signed-off-by: Lei YU <mine260309@gmail.com>
* Implement part of BmcEpochLei YU2017-08-016-2/+150
| | | | | | | | | | Add BmcEpoch which inherits EpochBase and will handle times for BMC, it is partly implemented. Add unit test cases to test basic functions. Change-Id: Ia5e4d0f884156d238f3f84df490a2efbce43e89a Signed-off-by: Lei YU <mine260309@gmail.com>
* Intialize new phosphor-time-managerLei YU2017-08-017-37/+440
| | | | | | | | | | | | | | phosphor-time-manager will be refactored to use sdbusplus interfaces. This is a initial commit that EpochBase is implemented based on dbus interface xyz/openbmc_project/Time/EpochTime.interface.yaml. EpochBase is the base class that wraps EpochTime interface, and is initialized with time mode and owner from settingsd. An initial unit test case is added. Change-Id: Ic944b70f63ec3c0329762cc8874f0f57b09ddce3 Signed-off-by: Lei YU <mine260309@gmail.com>
* Switch to using new settings APIDeepak Kodihalli2017-07-313-48/+166
| | | | | Change-Id: I0b0a9a70fcd8f1eb0f366bb2daf3d1fe77f3d648 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Add API to retrieve settingsDeepak Kodihalli2017-07-285-2/+162
| | | | | | | | Add API to retrieve all settings objects of interest to the time manager. Change-Id: I3d121c08d0156cf481a3468e6c7ca9b71f53d666 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Use error message thrown by timedate1 serviceVishwanatha Subbanna2017-07-062-31/+9
| | | | | | | | | | | | | | | If NTP is set, SetTime from timedate1 service throws a standard error. Current code was throwing a custom error and it was not much helpful. Correct thing is to re-throw what timedate1 throws. Also, current code was gating the SetTime request if the time mode was NTP. This has been removed now and the decision is left to timedate1 service now on whether to allow setting the time or not when NTP is enabled. Change-Id: I2b132bcea57f5181198dfe0c3635666bc8d7c070 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud