summaryrefslogtreecommitdiffstats
path: root/pysystemmgr
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2016-06-29 22:21:49 -0400
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2016-07-10 22:34:50 -0400
commitfa736499c75aa7b5d15134188c2a3875ec5b2f37 (patch)
tree7c98fd80273aee938184252b23e01c2b5577cd3e /pysystemmgr
parent4de4264355ceb0b7db953da0f472b1a4be8d6e4c (diff)
downloadtalos-skeleton-fa736499c75aa7b5d15134188c2a3875ec5b2f37.tar.gz
talos-skeleton-fa736499c75aa7b5d15134188c2a3875ec5b2f37.zip
system_mananger: Add a name owner handler
Add a bus name handler so the system manager can detect objects implemented by services that create objects before owning a bus name. Change-Id: Ic311133a8e532e7f2441102689632f5821dbf589 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'pysystemmgr')
-rw-r--r--pysystemmgr/system_manager.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/pysystemmgr/system_manager.py b/pysystemmgr/system_manager.py
index 8bcb239..6af8727 100644
--- a/pysystemmgr/system_manager.py
+++ b/pysystemmgr/system_manager.py
@@ -12,6 +12,8 @@ import obmc.dbuslib.propertycacher as PropertyCacher
from obmc.dbuslib.bindings import DbusProperties, DbusObjectManager, get_dbus
import obmc.enums
import obmc_system_config as System
+import obmc.dbuslib.introspection
+import obmc.utils.misc
DBUS_NAME = 'org.openbmc.managers.System'
OBJ_NAME = '/org/openbmc/managers/System'
@@ -27,7 +29,12 @@ class SystemManager(DbusProperties,DbusObjectManager):
DbusProperties.__init__(self)
DbusObjectManager.__init__(self)
dbus.service.Object.__init__(self,bus,obj_name)
+ self.bus = bus
+ bus.add_signal_receiver(
+ self.bus_handler,
+ dbus_interface=dbus.BUS_DAEMON_IFACE,
+ signal_name='NameOwnerChanged')
bus.add_signal_receiver(self.NewObjectHandler,
signal_name = "InterfacesAdded", sender_keyword = 'bus_name')
bus.add_signal_receiver(self.SystemStateHandler,signal_name = "GotoSystemState")
@@ -56,6 +63,10 @@ class SystemManager(DbusProperties,DbusObjectManager):
print "Creating cache directory: "+PropertyCacher.CACHE_PATH
os.makedirs(PropertyCacher.CACHE_PATH)
+ for s in self.bus.list_names():
+ if obmc.utils.misc.org_dot_openbmc_match(s):
+ self.bus_handler(s, '', s)
+
self.InterfacesAdded(obj_name,self.properties)
print "SystemManager Init Done"
@@ -194,6 +205,29 @@ class SystemManager(DbusProperties,DbusObjectManager):
return True
+ def bus_handler(self, owned_name, old, new):
+ if obmc.dbuslib.bindings.is_unique(owned_name) or not new:
+ return
+
+ if owned_name == DBUS_NAME:
+ return
+
+ objs = obmc.dbuslib.introspection.find_dbus_interfaces(
+ self.bus, owned_name, '/', bool)
+ current_state = self.Get(DBUS_NAME,"current_state")
+ for o in objs.keys():
+ if o in self.bus_name_lookup:
+ continue
+ self.bus_name_lookup[o] = owned_name
+
+ if current_state not in System.EXIT_STATE_DEPEND:
+ continue
+ if o in System.EXIT_STATE_DEPEND[current_state]:
+ print "New object: "+o+" ("+owned_name+")"
+ System.EXIT_STATE_DEPEND[current_state][o] = 1
+
+ self.try_next_state()
+
def NewObjectHandler(self, obj_path, iprops, bus_name = None):
current_state = self.Get(DBUS_NAME,"current_state")
if (self.bus_name_lookup.has_key(obj_path)):
OpenPOWER on IntegriCloud