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

# Source Code for Module Products.ZenModel.DeviceHW

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 as published by
     8  # the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14
    15  from Hardware import Hardware
    16
    17  from AccessControl import ClassSecurityInfo
    18  from Globals import InitializeClass
    19
    20  from Products.ZenUtils.Utils import convToUnits
    21  from Products.ZenRelations.RelSchema import *
    22
    23  from Exceptions import *
    24
    25
    26 -class DeviceHW(Hardware):
    27
    28      __pychecker__='no-override'
    29
    30      meta_type = "DeviceHW"
    31
    32      totalMemory = 0L
    33
    34      _properties = Hardware._properties + (
    35          {'id':'totalMemory', 'type':'long', 'mode':'w'},
    36      )
    37
    38      _relations = Hardware._relations + (
    39          ("cpus", ToManyCont(ToOne, "Products.ZenModel.CPU", "hw")),
    40          ("cards", ToManyCont(ToOne, "Products.ZenModel.ExpansionCard", "hw")),
    41          ("harddisks", ToManyCont(ToOne, "Products.ZenModel.HardDisk", "hw")),
    42          ("fans", ToManyCont(ToOne, "Products.ZenModel.Fan", "hw")),
    43          ("powersupplies", ToManyCont(ToOne, "Products.ZenModel.PowerSupply",
    44              "hw")),
    45          ("temperaturesensors", ToManyCont(ToOne,
    46              "Products.ZenModel.TemperatureSensor", "hw")),
    47      )
    48
    49      security = ClassSecurityInfo()
    50
    51 -    def __init__(self):
    52          id = "hw"
    53          Hardware.__init__(self, id)
    54
    55
    56 -    def __call__(self, REQUEST=None):
    57          pp = self.getPrimaryParent()
    58          screen = getattr(pp, "deviceHardwareDetail", False)
    59          if not screen: return pp()
    60          return screen()
    61
    62 -    def totalMemoryString(self):
    63          return self.totalMemory and convToUnits(self.totalMemory) or 'unknown'
    64
    65 -    def device(self):
    66          """Return our Device object for DeviceResultInt.
    67          """
    68          return self.getPrimaryParent()
    69
    70
    71
    72  InitializeClass(DeviceHW)
    73