[platform][barefoot] Lazy initialize fans and thermals list (#7103)
Initialize fans and thermals lists on demand; make them properties in order to reduce Chassis object initialization time Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com>
This commit is contained in:
parent
9b5e0694e3
commit
384680a83f
@ -28,8 +28,28 @@ class Chassis(ChassisBase):
|
|||||||
psu = Psu(i)
|
psu = Psu(i)
|
||||||
self._psu_list.append(psu)
|
self._psu_list.append(psu)
|
||||||
|
|
||||||
self._fan_drawer_list = fan_drawer_list_get()
|
self.__fan_drawers = None
|
||||||
self._thermal_list = thermal_list_get()
|
self.__thermals = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _fan_drawer_list(self):
|
||||||
|
if self.__fan_drawers is None:
|
||||||
|
self.__fan_drawers = fan_drawer_list_get()
|
||||||
|
return self.__fan_drawers
|
||||||
|
|
||||||
|
@_fan_drawer_list.setter
|
||||||
|
def _fan_drawer_list(self, value):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _thermal_list(self):
|
||||||
|
if self.__thermals is None:
|
||||||
|
self.__thermals = thermal_list_get()
|
||||||
|
return self.__thermals
|
||||||
|
|
||||||
|
@_thermal_list.setter
|
||||||
|
def _thermal_list(self, value):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user