diff options
| author | Lei YU <mine260309@gmail.com> | 2017-08-03 17:29:41 +0800 |
|---|---|---|
| committer | Lei YU <mine260309@gmail.com> | 2017-10-16 20:41:02 +0800 |
| commit | 88ad42bd84d05825255c035963afc29eeefcc79d (patch) | |
| tree | 8526aba151be8c6ab38f4338747941ca2d8e11b9 | |
| parent | 1c2ce82c0c3226a94aeefcc6ff2ddee170792ca0 (diff) | |
| download | phosphor-time-manager-88ad42bd84d05825255c035963afc29eeefcc79d.tar.gz phosphor-time-manager-88ad42bd84d05825255c035963afc29eeefcc79d.zip | |
Remove use_dhcp_ntp related code
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>
| -rw-r--r-- | manager.cpp | 91 | ||||
| -rw-r--r-- | manager.hpp | 25 |
2 files changed, 0 insertions, 116 deletions
diff --git a/manager.cpp b/manager.cpp index fc2ca65..15f1cec 100644 --- a/manager.cpp +++ b/manager.cpp @@ -10,16 +10,6 @@ namespace rules = sdbusplus::bus::match::rules; namespace // anonymous { -constexpr auto SETTINGS_PATH = "/org/openbmc/settings/host0"; -constexpr auto SETTINGS_INTERFACE = "org.openbmc.settings.Host"; - -// TODO: Use new settings in xyz.openbmc_project -const auto MATCH_PROPERTY_CHANGE = - rules::type::signal() + - rules::member("PropertiesChanged") + - rules::path("/org/openbmc/settings/host0") + - rules::interface("org.freedesktop.DBus.Properties"); - const auto MATCH_PGOOD_CHANGE = rules::type::signal() + rules::member("PropertiesChanged") + @@ -34,10 +24,6 @@ constexpr auto SYSTEMD_TIME_SERVICE = "org.freedesktop.timedate1"; constexpr auto SYSTEMD_TIME_PATH = "/org/freedesktop/timedate1"; constexpr auto SYSTEMD_TIME_INTERFACE = "org.freedesktop.timedate1"; constexpr auto METHOD_SET_NTP = "SetNTP"; - -constexpr auto OBMC_NETWORK_PATH = "/org/openbmc/NetworkManager/Interface"; -constexpr auto OBMC_NETWORK_INTERFACE = "org.openbmc.NetworkManager"; -constexpr auto METHOD_UPDATE_USE_NTP = "UpdateUseNtpField"; } namespace phosphor @@ -52,7 +38,6 @@ Manager::managedProperties = {PROPERTY_TIME_MODE, PROPERTY_TIME_OWNER}; Manager::Manager(sdbusplus::bus::bus& bus) : bus(bus), - propertyChangeMatch(bus, MATCH_PROPERTY_CHANGE, onPropertyChanged, this), pgoodChangeMatch(bus, MATCH_PGOOD_CHANGE, onPgoodChanged, this) { using namespace sdbusplus::bus::match::rules; @@ -82,8 +67,6 @@ Manager::Manager(sdbusplus::bus::bus& bus) onPropertyChanged(PROPERTY_TIME_MODE, mode); onPropertyChanged(PROPERTY_TIME_OWNER, owner); - - checkDhcpNtp(); } void Manager::addListener(PropertyChangeListner* listener) @@ -123,12 +106,6 @@ void Manager::checkHostOn() hostOn = static_cast<bool>(pgood); } -void Manager::checkDhcpNtp() -{ - std::string useDhcpNtp = getSettings(PROPERTY_DHCP_NTP); - updateDhcpNtpSetting(useDhcpNtp); -} - void Manager::onPropertyChanged(const std::string& key, const std::string& value) { @@ -154,35 +131,6 @@ void Manager::onPropertyChanged(const std::string& key, } } -int Manager::onPropertyChanged(sd_bus_message* msg, - void* userData, - sd_bus_error* retError) -{ - using properties = std::map < std::string, - sdbusplus::message::variant<std::string> >; - auto m = sdbusplus::message::message(msg); - // message type: sa{sv}as - std::string ignore; - properties props; - m.read(ignore, props); - auto manager = static_cast<Manager*>(userData); - for (const auto& item : props) - { - if (managedProperties.find(item.first) != managedProperties.end()) - { - // For managed properties, notify listeners - manager->onPropertyChanged( - item.first, item.second.get<std::string>()); - } - else if (item.first == PROPERTY_DHCP_NTP) - { - // For other manager interested properties, handle specifically - manager->updateDhcpNtpSetting(item.second.get<std::string>()); - } - } - return 0; -} - int Manager::onSettingsChanged(sdbusplus::message::message& msg) { using Interface = std::string; @@ -258,29 +206,6 @@ void Manager::updateNtpSetting(const std::string& value) } } -void Manager::updateDhcpNtpSetting(const std::string& useDhcpNtp) -{ - std::string networkService = utils::getService(bus, - OBMC_NETWORK_PATH, - OBMC_NETWORK_INTERFACE); - - auto method = bus.new_method_call(networkService.c_str(), - OBMC_NETWORK_PATH, - OBMC_NETWORK_INTERFACE, - METHOD_UPDATE_USE_NTP); - method.append(useDhcpNtp); - - if (bus.call(method)) - { - log<level::INFO>("Updated use ntp field", - entry("USENTPFIELD:%s", useDhcpNtp.c_str())); - } - else - { - log<level::ERR>("Failed to update UseNtpField"); - } -} - void Manager::onPgoodChanged(bool pgood) { hostOn = pgood; @@ -380,22 +305,6 @@ void Manager::onTimeOwnerChanged() } } -// TODO: This function is here only for use_dhcp_ntp. -// When use_dhcp_ntp is transferred to new settings daemon, -// this function can be removed. -std::string Manager::getSettings(const char* setting) const -{ - std::string settingsService = utils::getService(bus, - SETTINGS_PATH, - SETTINGS_INTERFACE); - - return utils::getProperty<std::string>(bus, - settingsService.c_str(), - SETTINGS_PATH, - SETTINGS_INTERFACE, - setting); -} - std::string Manager::getSetting(const char* path, const char* interface, const char* setting) const diff --git a/manager.hpp b/manager.hpp index dc0885e..f9ee511 100644 --- a/manager.hpp +++ b/manager.hpp @@ -43,11 +43,6 @@ class Manager sdbusplus::bus::bus& bus; /** @brief The match of settings property change */ - // TODO: This is to be removed when all properties are handled in - // new settings daemon - sdbusplus::bus::match::match propertyChangeMatch; - - /** @brief The match of settings property change */ std::vector<sdbusplus::bus::match::match> settingsMatches; /** @brief The match of pgood change */ @@ -80,17 +75,6 @@ class Manager /** @brief Check if host is on and update hostOn variable */ void checkHostOn(); - /** @brief Check if use_dhcp_ntp is used and update NTP setting */ - void checkDhcpNtp(); - - /** @brief Get setting from settingsd service - * - * @param[in] setting - The string of the setting - * - * @return The setting value in string - */ - std::string getSettings(const char* setting) const; - /** @brief Get setting from settingsd service * * @param[in] path - The dbus object path @@ -185,12 +169,6 @@ class Manager */ void updateNtpSetting(const std::string& value); - /** @brief Update dhcp_ntp setting to OpenBMC network service - * - * @param[in] value - The use_dhcp_ntp value, e.g. "yes" or "no" - */ - void updateDhcpNtpSetting(const std::string& useDhcpNtp); - /** @brief The static function called on settings property changed * * @param[in] msg - Data associated with subscribed signal @@ -217,9 +195,6 @@ class Manager /** @brief The string of time owner property */ static constexpr auto PROPERTY_TIME_OWNER = "TimeOwner"; - /** @brief The string of use dhcp ntp property */ - static constexpr auto PROPERTY_DHCP_NTP = "use_dhcp_ntp"; - using Updater = std::function<void(const std::string&)>; /** @brief Map the property string to functions that shall |

