Revision 2ef8013f
b/htools/Ganeti/HTools/Simu.hs | ||
---|---|---|
31 | 31 |
, parseData |
32 | 32 |
) where |
33 | 33 |
|
34 |
import Control.Monad (mplus) |
|
34 | 35 |
import Text.Printf (printf) |
35 | 36 |
|
36 | 37 |
import Ganeti.HTools.Utils |
... | ... | |
40 | 41 |
import qualified Ganeti.HTools.Group as Group |
41 | 42 |
import qualified Ganeti.HTools.Node as Node |
42 | 43 |
|
44 |
-- | Parse a shortened policy string (for command line usage). |
|
45 |
apolAbbrev :: String -> Result AllocPolicy |
|
46 |
apolAbbrev c | c == "p" = return AllocPreferred |
|
47 |
| c == "a" = return AllocLastResort |
|
48 |
| c == "u" = return AllocUnallocable |
|
49 |
| otherwise = fail $ "Cannot parse AllocPolicy abbreviation '" |
|
50 |
++ c ++ "'" |
|
51 |
|
|
43 | 52 |
-- | Parse the string description into nodes. |
44 | 53 |
parseDesc :: String -> Result (AllocPolicy, Int, Int, Int, Int) |
45 | 54 |
parseDesc desc = |
46 | 55 |
case sepSplit ',' desc of |
47 | 56 |
[a, n, d, m, c] -> do |
48 |
apol <- apolFromString a |
|
57 |
apol <- apolFromString a `mplus` apolAbbrev a
|
|
49 | 58 |
ncount <- tryRead "node count" n |
50 | 59 |
disk <- annotateResult "disk size" (parseUnit d) |
51 | 60 |
mem <- annotateResult "memory size" (parseUnit m) |
b/man/hspace.rst | ||
---|---|---|
282 | 282 |
description. The *description* parameter must be a comma-separated |
283 | 283 |
list of five elements, describing in order: |
284 | 284 |
|
285 |
- the allocation policy for this node group |
|
285 |
- the allocation policy for this node group (*preferred*, *allocable* |
|
286 |
or *unallocable*, or alternatively the short forms *p*, *a* or *u*) |
|
286 | 287 |
- the number of nodes in the cluster |
287 | 288 |
- the disk size of the nodes (default in mebibytes, units can be used) |
288 | 289 |
- the memory size of the nodes (default in mebibytes, units can be used) |
Also available in: Unified diff