Commit c4d98278 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add a type alias for UUIDs



This is to pottentially allow easier changes later.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarBalazs Lecz <leczb@google.com>
parent e474b5b5
......@@ -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
......
......@@ -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'
......
......@@ -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, [], [])
......
......@@ -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
......
......@@ -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
......
......@@ -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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment