Add Cluster.splitCluster for node groups
[ganeti-local] / Ganeti / HTools / Types.hs
index 9fc409c..200163b 100644 (file)
@@ -4,7 +4,7 @@
 
 {-
 
-Copyright (C) 2009 Google Inc.
+Copyright (C) 2009, 2010 Google Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ module Ganeti.HTools.Types
     , NameAssoc
     , Score
     , Weight
+    , GroupID
     , RSpec(..)
     , DynUtil(..)
     , zeroUtil
@@ -40,6 +41,7 @@ module Ganeti.HTools.Types
     , unitMem
     , unitCpu
     , unitDsk
+    , unknownField
     , Placement
     , IMove(..)
     , MoveJob
@@ -68,6 +70,9 @@ type Score = Double
 -- | A separate name for a weight metric.
 type Weight = Double
 
+-- | The Group UUID type
+type GroupID = String
+
 -- | The resource spec type.
 data RSpec = RSpec
     { rspecCpu  :: Int  -- ^ Requested VCPUs
@@ -82,7 +87,7 @@ data DynUtil = DynUtil
     , memWeight :: Weight -- ^ Standardised memory load
     , dskWeight :: Weight -- ^ Standardised disk I\/O usage
     , netWeight :: Weight -- ^ Standardised network usage
-    } deriving (Show)
+    } deriving (Show, Eq)
 
 -- | Initial empty utilisation
 zeroUtil :: DynUtil
@@ -118,6 +123,10 @@ data IMove = Failover                -- ^ Failover the instance (f)
 -- commands
 type MoveJob = ([Ndx], Idx, IMove, [String])
 
+-- | Unknown field in table output
+unknownField :: String
+unknownField = "<unknown field>"
+
 -- | A list of command elements
 type JobSet = [MoveJob]
 
@@ -192,6 +201,8 @@ instance Monad OpResult where
 class Element a where
     -- | Returns the name of the element
     nameOf  :: a -> String
+    -- | Returns all the known names of the element
+    allNames :: a -> [String]
     -- | Returns the index of the element
     idxOf   :: a -> Int
     -- | Updates the alias of the element