Skip to content
Snippets Groups Projects
Commit 0c7d4422 authored by Iustin Pop's avatar Iustin Pop
Browse files

htools: support spindles in simu backend


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent f951bd09
No related branches found
No related tags found
No related merge requests found
......@@ -49,32 +49,38 @@ apolAbbrev c | c == "p" = return AllocPreferred
++ c ++ "'"
-- | Parse the string description into nodes.
parseDesc :: String -> Result (AllocPolicy, Int, Int, Int, Int)
parseDesc desc =
case sepSplit ',' desc of
[a, n, d, m, c] -> do
apol <- allocPolicyFromRaw a `mplus` apolAbbrev a
ncount <- tryRead "node count" n
disk <- annotateResult "disk size" (parseUnit d)
mem <- annotateResult "memory size" (parseUnit m)
cpu <- tryRead "cpu count" c
return (apol, ncount, disk, mem, cpu)
es -> fail $ printf
"Invalid cluster specification, expected 5 comma-separated\
\ sections (allocation policy, node count, disk size,\
\ memory size, number of CPUs) but got %d: '%s'" (length es) desc
parseDesc :: String -> [String]
-> Result (AllocPolicy, Int, Int, Int, Int, Int)
parseDesc _ [a, n, d, m, c, s] = do
apol <- allocPolicyFromRaw a `mplus` apolAbbrev a
ncount <- tryRead "node count" n
disk <- annotateResult "disk size" (parseUnit d)
mem <- annotateResult "memory size" (parseUnit m)
cpu <- tryRead "cpu count" c
spindles <- tryRead "spindles" s
return (apol, ncount, disk, mem, cpu, spindles)
parseDesc desc [a, n, d, m, c] = parseDesc desc [a, n, d, m, c, "1"]
parseDesc desc es =
fail $ printf
"Invalid cluster specification, expected 6 comma-separated\
\ sections (allocation policy, node count, disk size,\
\ memory size, number of CPUs, spindles) but got %d: '%s'"
(length es) desc
-- | Creates a node group with the given specifications.
createGroup :: Int -- ^ The group index
-> String -- ^ The group specification
-> Result (Group.Group, [Node.Node])
createGroup grpIndex spec = do
(apol, ncount, disk, mem, cpu) <- parseDesc spec
(apol, ncount, disk, mem, cpu, spindles) <- parseDesc spec $
sepSplit ',' spec
let nodes = map (\idx ->
Node.create (printf "node-%02d-%03d" grpIndex idx)
(fromIntegral mem) 0 mem
(fromIntegral disk) disk
(fromIntegral cpu) False 1 grpIndex
(fromIntegral cpu) False spindles grpIndex
) [1..ncount]
grp = Group.create (printf "group-%02d" grpIndex)
(printf "fake-uuid-%02d" grpIndex) apol defIPolicy
......
......@@ -214,11 +214,12 @@ support all options. Some common options are:
- the disk size of the nodes (default in mebibytes, units can be used)
- the memory size of the nodes (default in mebibytes, units can be used)
- the cpu core count for the nodes
- the spindle count for the nodes
An example description would be **preferred,B20,100G,16g,4**
describing a 20-node cluster where each node has 100GB of disk
space, 16GiB of memory and 4 CPU cores. Note that all nodes must
have the same specs currently.
An example description would be **preferred,B20,100G,16g,4,2**
describing a 20-node cluster where each node has 100GB of disk space,
16GiB of memory, 4 CPU cores and 2 disk spindles. Note that all nodes
must have the same specs currently.
This option can be given multiple times, and each new use defines a
new node group. Hence different node groups can have different
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment