Merge remote-tracking branch 'origin'
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index d42dedb..b894fe4 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -25,7 +25,7 @@
EXIT_STATE_DEPEND = {
'BASE_APPS' : {
- '/org/openbmc/managers/Property': 0,
+ '/org/openbmc/sensors': 0,
},
'BMC_STARTING' : {
'/org/openbmc/control/chassis0': 0,
@@ -62,8 +62,8 @@
APPS = {
'property_manager' : {
'system_state' : 'BASE_APPS',
- 'start_process' : True,
- 'monitor_process' : True,
+ 'start_process' : False,
+ 'monitor_process' : False,
'process_name' : 'property_manager.py',
'args' : [ SYSTEM_NAME ]
},
@@ -93,7 +93,7 @@
'process_name' : 'sensors_virtual_p8.py',
},
'sensor_manager' : {
- 'system_state' : 'BMC_STARTING',
+ 'system_state' : 'BASE_APPS',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensor_manager.py',
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index c1b9238..3c223e9 100755
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -25,7 +25,7 @@
EXIT_STATE_DEPEND = {
'BASE_APPS' : {
- '/org/openbmc/managers/Property': 0,
+ '/org/openbmc/sensors': 0,
},
'BMC_STARTING' : {
'/org/openbmc/control/chassis0': 0,
@@ -62,8 +62,8 @@
APPS = {
'property_manager' : {
'system_state' : 'BASE_APPS',
- 'start_process' : True,
- 'monitor_process' : True,
+ 'start_process' : False,
+ 'monitor_process' : False,
'process_name' : 'property_manager.py',
'args' : [ SYSTEM_NAME ]
},
@@ -93,7 +93,7 @@
'process_name' : 'sensors_virtual_p8.py',
},
'sensor_manager' : {
- 'system_state' : 'BMC_STARTING',
+ 'system_state' : 'BASE_APPS',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensor_manager.py',
diff --git a/bin/PropertyCacher.py b/bin/PropertyCacher.py
new file mode 100644
index 0000000..3b0002f
--- /dev/null
+++ b/bin/PropertyCacher.py
@@ -0,0 +1,47 @@
+import os
+import cPickle
+import Openbmc
+
+CACHE_PATH = '/var/cache/obmc/'
+
+def getCacheFilename(obj_path, iface_name):
+ name = obj_path.replace('/','.')
+ filename = CACHE_PATH+name[1:]+"@"+iface_name+".props"
+ return filename
+
+def save(obj_path, iface_name, properties):
+ print "Caching: "+obj_path
+ try:
+ output = open(getCacheFilename(obj_path, iface_name), 'wb')
+ ## save properties
+ dbus_props = {}
+
+ for p in properties[iface_name].keys():
+ dbus_prop = Openbmc.DbusVariable(p,properties[iface_name][p])
+ dbus_props[str(p)] = dbus_prop.getBaseValue()
+
+ cPickle.dump(dbus_props,output)
+ except Exception as e:
+ print "ERROR: "+str(e)
+ finally:
+ output.close()
+
+def load(obj_path, iface_name, properties):
+ ## overlay with pickled data
+ filename=getCacheFilename(obj_path, iface_name)
+ if (os.path.isfile(filename)):
+ if (properties.has_key(iface_name) == False):
+ properties[iface_name] = {}
+ print "Loading from cache: "+filename
+ try:
+ p = open(filename, 'rb')
+ data = cPickle.load(p)
+ for prop in data.keys():
+ properties[iface_name][prop] = data[prop]
+
+ except Exception as e:
+ print "ERROR: Loading cache file: " +str(e)
+ finally:
+ p.close()
+
+
diff --git a/bin/inventory_items.py b/bin/inventory_items.py
index d23e345..ab1aae3 100755
--- a/bin/inventory_items.py
+++ b/bin/inventory_items.py
@@ -8,6 +8,7 @@
import dbus.mainloop.glib
import cPickle
import json
+import PropertyCacher
if (len(sys.argv) < 2):
print "Usage: inventory_items.py [system name]"
@@ -46,22 +47,20 @@
dbus.service.Object.__init__(self,bus,name)
self.name = name
- ## this will load properties from cache
- self.Register('org.openbmc.InventoryItem')
+ ## this will load properties from cache
+ PropertyCacher.load(name,INTF_NAME,self.properties)
data = {'is_fru': is_fru, 'fru_type': fru_type, 'present': 'Inactive', 'fault': 'None'}
self.SetMultiple(INTF_NAME,data)
+
-
- @dbus.service.signal('org.openbmc.PersistantInterface',
- signature='s')
- def Register(self,interface):
- pass
+
@dbus.service.method(INTF_NAME,
in_signature='a{sv}', out_signature='')
def update(self,data):
self.SetMultiple(INTF_NAME,data)
+ PropertyCacher.save(self.name,INTF_NAME,self.properties)
@dbus.service.method(INTF_NAME,
in_signature='s', out_signature='')
diff --git a/bin/property_manager.py b/bin/property_manager.py
index e891bd4..108f81c 100755
--- a/bin/property_manager.py
+++ b/bin/property_manager.py
@@ -56,11 +56,6 @@
filename = System.CACHE_PATH+name[1:]+"@"+intf_name+".props"
return filename
- def getCacheFilenames(self,obj_path):
- name = obj_path.replace('/','.')
- path = System.CACHE_PATH+name[1:]+"\@*"
- return glob.glob(path)
-
def saveToCache(self, bus_name, object_path, interface_name):
print "Caching: "+object_path
try:
diff --git a/bin/system_manager.py b/bin/system_manager.py
index b33f78f..0ef92c4 100755
--- a/bin/system_manager.py
+++ b/bin/system_manager.py
@@ -107,9 +107,10 @@
try:
cb = System.ENTER_STATE_CALLBACK[state_name]
- obj = bus.get_object(cb['bus_name'],cb['obj_name'])
- method = obj.get_dbus_method(cb['method_name'],cb['interface_name'])
- method()
+ for methd in cb.keys():
+ obj = bus.get_object(cb[methd]['bus_name'],cb[methd]['obj_name'])
+ method = obj.get_dbus_method(methd,cb[methd]['interface_name'])
+ method()
except:
pass