changed to where property mgr does caching
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index 13ae975..f38fd73 100755
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -5,7 +5,6 @@
HOME_PATH = './'
CACHE_PATH = HOME_PATH+'cache/'
-FRU_PATH = CACHE_PATH+'frus/'
FLASH_DOWNLOAD_PATH = "/tmp"
SYSTEM_NAME = "Palmetto"
@@ -16,6 +15,7 @@
## - a process emits a GotoSystemState signal with state name to goto
## - objects specified in EXIT_STATE_DEPEND have started
SYSTEM_STATES = [
+ 'BASE_APPS',
'BMC_INIT',
'BMC_STARTING',
'BMC_READY',
@@ -27,6 +27,9 @@
]
EXIT_STATE_DEPEND = {
+ 'BASE_APPS' : {
+ '/org/openbmc/managers/Property': 0,
+ },
'BMC_STARTING' : {
'/org/openbmc/control/chassis0': 0,
'/org/openbmc/control/power0' : 0,
@@ -54,11 +57,10 @@
SYSTEM_CONFIG = {}
SYSTEM_CONFIG['org.openbmc.managers.Property'] = {
- 'system_state' : 'BMC_INIT',
- 'start_process' : False,
- 'monitor_process' : False,
+ 'system_state' : 'BASE_APPS',
+ 'start_process' : True,
+ 'monitor_process' : True,
'process_name' : 'property_manager.py',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : SYSTEM_NAME } ]
}
@@ -67,7 +69,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'control_bmc.exe',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'Bmc_0' } ]
}
@@ -76,7 +77,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'inventory_items.py',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : SYSTEM_NAME } ]
}
SYSTEM_CONFIG['org.openbmc.control.PciePresent'] = {
@@ -84,7 +84,6 @@
'start_process' : True,
'monitor_process' : False,
'process_name' : 'pcie_slot_present.exe',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'Slots_0' } ]
}
SYSTEM_CONFIG['org.openbmc.sensor.Power8Virtual'] = {
@@ -92,7 +91,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensors_virtual_p8.py',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'virtual' } ]
}
@@ -101,7 +99,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensor_manager.py',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : SYSTEM_NAME } ]
}
@@ -110,7 +107,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'host_watchdog.exe',
- 'heartbeat' : 'no',
'instances' : [
{
'name' : 'HostWatchdog_0',
@@ -128,7 +124,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'power_control.exe',
- 'heartbeat' : 'no',
'instances' : [
{
'name' : 'power0',
@@ -150,7 +145,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'button_power.exe',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'PowerButton_0' } ]
}
SYSTEM_CONFIG['org.openbmc.control.led'] = {
@@ -158,7 +152,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'led_controller.exe',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'Dummy' } ]
}
SYSTEM_CONFIG['org.openbmc.control.Flash'] = {
@@ -166,7 +159,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'flash_bios.exe',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'dummy' } ]
}
@@ -175,7 +167,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'download_manager.py',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : SYSTEM_NAME } ]
}
@@ -184,7 +175,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'control_host.exe',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'Host_0' } ]
}
SYSTEM_CONFIG['org.openbmc.control.Chassis'] = {
@@ -192,7 +182,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'chassis_control.py',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'chassis0' } ]
}
@@ -201,7 +190,6 @@
'start_process' : False,
'monitor_process' : False,
'process_name' : 'board_vpd.exe',
- 'heartbeat' : 'no',
'instances' : [ { 'name' : 'MBVPD_0' } ]
}
@@ -210,7 +198,6 @@
'start_process' : True,
'monitor_process' : True,
'process_name' : 'fan.exe',
- 'heartbeat' : 'no',
'instances' : [ {'name' : 'Fan_0' }, {'name' : 'Fan_1'}, {'name' : 'Fan_2'} ]
}
diff --git a/bin/inventory_items.py b/bin/inventory_items.py
index 78691d6..d23e345 100755
--- a/bin/inventory_items.py
+++ b/bin/inventory_items.py
@@ -21,16 +21,10 @@
ENUM_INTF = 'org.openbmc.Object.Enumerate'
FRUS = System.FRU_INSTANCES
-FRU_PATH = System.FRU_PATH
class Inventory(dbus.service.Object):
def __init__(self,bus,name):
- global FRU_PATH
dbus.service.Object.__init__(self,bus,name)
- if not os.path.exists(FRU_PATH):
- os.makedirs(FRU_PATH)
-
-
self.objects = [ ]
def addItem(self,item):
@@ -47,78 +41,37 @@
class InventoryItem(Openbmc.DbusProperties):
- def __init__(self,bus,name):
+ def __init__(self,bus,name,is_fru,fru_type):
Openbmc.DbusProperties.__init__(self)
dbus.service.Object.__init__(self,bus,name)
+
self.name = name
- self.cache = True
- self.Set(INTF_NAME,'is_fru',False)
- self.Set(INTF_NAME,'fru_type',0)
- self.Set(INTF_NAME,'present',"INACTIVE")
- self.Set(INTF_NAME,'fault',"NONE")
-
+ ## this will load properties from cache
+ self.Register('org.openbmc.InventoryItem')
+
+ 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):
- ## translate dbus data into basic data types
- self.SetAll(INTF_NAME,data)
- #self.saveToCache()
+ self.SetMultiple(INTF_NAME,data)
@dbus.service.method(INTF_NAME,
in_signature='s', out_signature='')
def setPresent(self,present):
- self.setField('present',present)
+ self.Set(INTF_NAME,'present',present)
@dbus.service.method(INTF_NAME,
in_signature='s', out_signature='')
def setFault(self,fault):
- self.setField('fault',fault)
-
- def setField(self,field,value):
- f = str(field)
- d = Openbmc.DbusVariable(f,value)
- self.Set(INTF_NAME,f,d.getBaseValue())
-
- def isCached(self):
- return self.cache
-
- def getCacheFilename(self):
- global FRU_PATH
- name = self.name.replace('/','.')
- filename = FRU_PATH+name[1:]+".fru"
- return filename
-
- def saveToCache(self):
- if (self.isCached() == False):
- return
- print "Caching: "+self.name
- try:
- output = open(self.getCacheFilename(), 'wb')
- ## save properties
- cPickle.dump(self.properties[INTF_NAME],output)
- except Exception as e:
- print "ERROR: "+str(e)
- finally:
- output.close()
-
- def loadFromCache(self):
- if (self.isCached() == False):
- return;
- ## overlay with pickled data
- filename=self.getCacheFilename()
- if (os.path.isfile(filename)):
- print "Loading from cache: "+filename
- try:
- p = open(filename, 'rb')
- data2 = cPickle.load(p)
- for k in data2.keys():
- self.setField(k,data2[k])
- except Exception as e:
- print "No cache file found: " +str(e)
- finally:
- p.close()
+ self.Set(INTF_NAME,'fault',fault)
if __name__ == '__main__':
@@ -130,10 +83,7 @@
for f in FRUS.keys():
obj_path=f.replace("<inventory_root>",System.INVENTORY_ROOT)
- obj = InventoryItem(bus,obj_path)
- obj.setField('is_fru',FRUS[f]['is_fru'])
- obj.setField('fru_type',FRUS[f]['fru_type'])
- #obj.loadFromCache();
+ obj = InventoryItem(bus,obj_path,FRUS[f]['is_fru'],FRUS[f]['fru_type'])
obj_parent.addItem(obj)
print "Running Inventory Manager"