diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs index be2a3dc8bf645519d621f8a042006e8b0f77f826..88a6000fc28e0c15fe32422667650959ec179c24 100644 --- a/Ganeti/HTools/Node.hs +++ b/Ganeti/HTools/Node.hs @@ -119,7 +119,7 @@ data Node = Node , utilPool :: T.DynUtil -- ^ Total utilisation capacity , utilLoad :: T.DynUtil -- ^ Sum of instance utilisation , pTags :: TagMap -- ^ Map of primary instance tags and their count - , group :: String -- ^ The node's group (as UUID) + , group :: T.GroupID -- ^ The node's group (as UUID) } deriving (Show, Eq) instance T.Element Node where diff --git a/Ganeti/HTools/QC.hs b/Ganeti/HTools/QC.hs index 5e7120ea09b504f020869f1424f7d6f8dcbbebcb..8b46aa559f56b77347333bbd2d10b3b51d084c0a 100644 --- a/Ganeti/HTools/QC.hs +++ b/Ganeti/HTools/QC.hs @@ -176,7 +176,7 @@ instance Arbitrary Node.Node where offl <- arbitrary let n = Node.create name (fromIntegral mem_t) mem_n mem_f (fromIntegral dsk_t) dsk_f (fromIntegral cpu_t) offl - Utils.defaultUUID + Utils.defaultGroupID n' = Node.buildPeers n Container.empty return n' diff --git a/Ganeti/HTools/Simu.hs b/Ganeti/HTools/Simu.hs index d41f4a39bee7c38db4f4e5fdf2ad3e68a3ed8ac3..c29f3f58b80184918362430fa4e4ae1381b6324e 100644 --- a/Ganeti/HTools/Simu.hs +++ b/Ganeti/HTools/Simu.hs @@ -59,7 +59,7 @@ parseData ndata = do let n = Node.create (printf "node%03d" idx) (fromIntegral mem) 0 mem (fromIntegral disk) disk - (fromIntegral cpu) False defaultUUID + (fromIntegral cpu) False defaultGroupID in (idx, Node.setIdx n idx) ) [1..cnt] return (nodes, [], []) diff --git a/Ganeti/HTools/Text.hs b/Ganeti/HTools/Text.hs index 7c7fcad747d8735dd1d0dc368b2b8a165adb7f75..e61014d72dbbe5b50f3e59a9fb7058917438869e 100644 --- a/Ganeti/HTools/Text.hs +++ b/Ganeti/HTools/Text.hs @@ -95,7 +95,7 @@ serializeCluster nl il = loadNode :: (Monad m) => [String] -> m (String, Node.Node) -- compatibility wrapper for old text files loadNode [name, tm, nm, fm, td, fd, tc, fo] = - loadNode [name, tm, nm, fm, td, fd, tc, fo, defaultUUID] + loadNode [name, tm, nm, fm, td, fd, tc, fo, defaultGroupID] loadNode [name, tm, nm, fm, td, fd, tc, fo, gu] = do new_node <- if any (== "?") [tm,nm,fm,td,fd,tc] || fo == "Y" then diff --git a/Ganeti/HTools/Types.hs b/Ganeti/HTools/Types.hs index 7cab64113fb4365bc855480f80353fb7c4d34fae..200163b9c97f8619359ca089c9c7df420b4465c1 100644 --- a/Ganeti/HTools/Types.hs +++ b/Ganeti/HTools/Types.hs @@ -29,6 +29,7 @@ module Ganeti.HTools.Types , NameAssoc , Score , Weight + , GroupID , RSpec(..) , DynUtil(..) , zeroUtil @@ -69,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 diff --git a/Ganeti/HTools/Utils.hs b/Ganeti/HTools/Utils.hs index 4cb4418a8d0543add730f406d750c209e332244b..7ae236777044918c87e8e74fa05781a9ffa776d8 100644 --- a/Ganeti/HTools/Utils.hs +++ b/Ganeti/HTools/Utils.hs @@ -41,7 +41,7 @@ module Ganeti.HTools.Utils , tryRead , formatTable , annotateResult - , defaultUUID + , defaultGroupID ) where import Control.Monad (liftM) @@ -211,6 +211,6 @@ formatTable vals numpos = ) (zip3 vtrans numpos mlens) in transpose expnd --- | Default UUID (just a string, not a real UUID) -defaultUUID :: String -defaultUUID = "00000000-0000-0000-0000-000000000000" +-- | Default group UUID (just a string, not a real UUID) +defaultGroupID :: GroupID +defaultGroupID = "00000000-0000-0000-0000-000000000000"