Package Products :: Package ZenModel :: Module DeviceHW |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenModel.DeviceHW

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  from Hardware import Hardware
    12
    13  from AccessControl import ClassSecurityInfo
    14  from Globals import InitializeClass
    15
    16  from Products.ZenUtils.Utils import convToUnits
    17  from Products.ZenRelations.RelSchema import *
    18
    19  from Exceptions import *
    20
    21
    22 -class DeviceHW(Hardware):
    23
    24      __pychecker__='no-override'
    25
    26      meta_type = "DeviceHW"
    27
    28      totalMemory = 0L
    29
    30      _properties = Hardware._properties + (
    31          {'id':'totalMemory', 'type':'long', 'mode':'w'},
    32      )
    33
    34      _relations = Hardware._relations + (
    35          ("cpus", ToManyCont(ToOne, "Products.ZenModel.CPU", "hw")),
    36          ("cards", ToManyCont(ToOne, "Products.ZenModel.ExpansionCard", "hw")),
    37          ("harddisks", ToManyCont(ToOne, "Products.ZenModel.HardDisk", "hw")),
    38          ("fans", ToManyCont(ToOne, "Products.ZenModel.Fan", "hw")),
    39          ("powersupplies", ToManyCont(ToOne, "Products.ZenModel.PowerSupply",
    40              "hw")),
    41          ("temperaturesensors", ToManyCont(ToOne,
    42              "Products.ZenModel.TemperatureSensor", "hw")),
    43      )
    44
    45      security = ClassSecurityInfo()
    46
    47 -    def __init__(self):
    48          id = "hw"
    49          Hardware.__init__(self, id)
    50
    51
    52 -    def __call__(self, REQUEST=None):
    53          pp = self.getPrimaryParent()
    54          screen = getattr(pp, "deviceHardwareDetail", False)
    55          if not screen: return pp()
    56          return screen()
    57
    58 -    def totalMemoryString(self):
    59          return self.totalMemory and convToUnits(self.totalMemory) or 'Unknown'
    60
    61 -    def device(self):
    62          """Return our Device object for DeviceResultInt.
    63          """
    64          return self.getPrimaryParent()
    65
    66
    67
    68  InitializeClass(DeviceHW)
    69