summaryrefslogtreecommitdiffstats
path: root/control/zone.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-11-06 11:00:00 -0600
committerMatthew Barth <msbarth@us.ibm.com>2017-11-17 13:14:11 -0600
commit480787c118fb511a8fe23a19f97bcf24b564c11e (patch)
treee3800e1e72c6e206d42f78f872376d2937531bcf /control/zone.cpp
parent2b3db618a00a1360d7a61cf0e712e1c50764297f (diff)
downloadphosphor-fan-presence-480787c118fb511a8fe23a19f97bcf24b564c11e.tar.gz
phosphor-fan-presence-480787c118fb511a8fe23a19f97bcf24b564c11e.zip
Refresh service states for a group
Prior to an action resulting from missing service owners, all of the services for a group should be refreshed to ensure they are in the most up-to-date state. Ensuring the service states are current allows the action to be correctly taken since owners of services could change at anytime. Change-Id: I59c59c6fcf456fa9c0a733d6406c90ea11f6e2b2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r--control/zone.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/control/zone.cpp b/control/zone.cpp
index cb8ebfa..5fe9b01 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -150,6 +150,36 @@ void Zone::setServiceOwner(const Group* group,
}
}
+void Zone::setServices(const Group* group)
+{
+ // TODO Remove empty service name if exists
+ for (auto it = group->begin(); it != group->end(); ++it)
+ {
+ std::string name;
+ bool hasOwner = false;
+ try
+ {
+ name = util::SDBusPlus::getService(
+ _bus,
+ it->first,
+ std::get<intfPos>(it->second));
+ hasOwner = util::SDBusPlus::callMethodAndRead<bool>(
+ _bus,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ "NameHasOwner",
+ name);
+ }
+ catch (const InternalFailure& ife)
+ {
+ // Failed to get service name owner state
+ hasOwner = false;
+ }
+ setServiceOwner(group, name, hasOwner);
+ }
+}
+
void Zone::setFloor(uint64_t speed)
{
// Check all entries are set to allow floor to be set
OpenPOWER on IntegriCloud