Revision 88b58ed6 src/Ganeti/Objects.hs

b/src/Ganeti/Objects.hs
47 47
  , allBeParamFields
48 48
  , Instance(..)
49 49
  , toDictInstance
50
  , getDiskSizeRequirements
50 51
  , PartialNDParams(..)
51 52
  , FilledNDParams(..)
52 53
  , fillNDParams
......
459 460
instance TagsObject Instance where
460 461
  tagsOf = instTags
461 462

  
463
-- | Retrieves the real disk size requirements for all the disks of the
464
-- instance. This includes the metadata etc. and is different from the values
465
-- visible to the instance.
466
getDiskSizeRequirements :: Instance -> Int
467
getDiskSizeRequirements inst =
468
  sum . map
469
    (\disk -> case instDiskTemplate inst of
470
                DTDrbd8    -> diskSize disk + C.drbdMetaSize
471
                DTDiskless -> 0
472
                DTBlock    -> 0
473
                _          -> diskSize disk )
474
    $ instDisks inst
475

  
462 476
-- * IPolicy definitions
463 477

  
464 478
$(buildParam "ISpec" "ispec"

Also available in: Unified diff