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

# Source Code for Module Products.ZenModel.HardDisk

     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 or (at your
     8  # option) any later version as published by the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14  __doc__="""HardDisk
    15
    16  HardDisk is a collection of devices and subsystems that make
    17  up a business function
    18
    19  $Id: HardDisk.py,v 1.7 2004/04/06 22:33:24 edahl Exp $"""
    20
    21  __version__ = "$Revision: 1.7 $"[11:-2]
    22
    23  from Globals import DTMLFile
    24  from Globals import InitializeClass
    25
    26  from Products.ZenRelations.RelSchema import *
    27
    28  from HWComponent import HWComponent
    29
    30  from Products.ZenModel.ZenossSecurity import *
    31
    32 -def manage_addHardDisk(context, id, title = None, REQUEST = None):
    33      """make a filesystem"""
    34      hd = HardDisk(id, title)
    35      context._setObject(id, hd)
    36      hd = context._getOb(id)
    37
    38      if REQUEST is not None:
    39          REQUEST['RESPONSE'].redirect(context.absolute_url()
    40                                       +'/manage_main')
    41
    42  addHardDisk = DTMLFile('dtml/addHardDisk',globals())
    43
    44
    45 -class HardDisk(HWComponent):
    46      """HardDisk object"""
    47
    48      portal_type = meta_type = 'HardDisk'
    49
    50      manage_editHardDiskForm = DTMLFile('dtml/manageEditHardDisk',globals())
    51
    52      description = ""
    53      hostresindex = 0
    54
    55      _properties = HWComponent._properties + (
    56                   {'id':'description', 'type':'string', 'mode':'w'},
    57                   {'id':'hostresindex', 'type':'int', 'mode':'w'},
    58                  )
    59
    60      _relations = HWComponent._relations + (
    61          ("hw", ToOne(ToManyCont, "Products.ZenModel.DeviceHW", "harddisks")),
    62          )
    63
    64
    65      factory_type_information = (
    66          {
    67              'id'             : 'HardDisk',
    68              'meta_type'      : 'HardDisk',
    69              'description'    : """Arbitrary device grouping class""",
    70              'icon'           : 'HardDisk_icon.gif',
    71              'product'        : 'ZenModel',
    72              'factory'        : 'manage_addHardDisk',
    73              'immediate_view' : 'viewHardDisk',
    74              'actions'        :
    75              (
    76                  { 'id'            : 'status'
    77                  , 'name'          : 'Status'
    78                  , 'action'        : 'viewHardDisk'
    79                  , 'permissions'   : ('View',)
    80                  },
    81                  { 'id'            : 'perfConf'
    82                  , 'name'          : 'Template'
    83                  , 'action'        : 'objTemplates'
    84                  , 'permissions'   : ("Change Device", )
    85                  },
    86              )
    87            },
    88          )
    89
    90 -    def viewName(self): return self.description
    91
    92
    93  InitializeClass(HardDisk)
    94