Revision 914c6df4 src/Ganeti/HTools/CLI.hs
b/src/Ganeti/HTools/CLI.hs | ||
---|---|---|
232 | 232 |
let sp = sepSplit ',' inp |
233 | 233 |
err = Bad ("Invalid " ++ descr ++ " specification: '" ++ inp ++ |
234 | 234 |
"', expected disk,ram,cpu") |
235 |
when (length sp /= 3) err
|
|
235 |
when (length sp < 3 || length sp > 4) err
|
|
236 | 236 |
prs <- mapM (\(fn, val) -> fn val) $ |
237 | 237 |
zip [ annotateResult (descr ++ " specs disk") . parseUnit |
238 | 238 |
, annotateResult (descr ++ " specs memory") . parseUnit |
239 | 239 |
, tryRead (descr ++ " specs cpus") |
240 |
, tryRead (descr ++ " specs spindles") |
|
240 | 241 |
] sp |
241 | 242 |
case prs of |
242 |
[dsk, ram, cpu] -> return $ RSpec cpu ram dsk |
|
243 |
{- Spindles are optional, so that they are not needed when exclusive storage |
|
244 |
is disabled. When exclusive storage is disabled, spindles are ignored, |
|
245 |
so the actual value doesn't matter. We use 1 as a default so that in |
|
246 |
case someone forgets and exclusive storage is enabled, we don't run into |
|
247 |
weird situations. -} |
|
248 |
[dsk, ram, cpu] -> return $ RSpec cpu ram dsk 1 |
|
249 |
[dsk, ram, cpu, spn] -> return $ RSpec cpu ram dsk spn |
|
243 | 250 |
_ -> err |
244 | 251 |
|
245 | 252 |
-- | Disk template choices. |
Also available in: Unified diff