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

Make some CLI options more consistent

Both the simulate and the tiered allocation mode take a machine spec on
input via a comma-separated list. This patch makes this a little bit
more consistent (always use disk,ram,cpu in this order).
parent fcebc9db
No related branches found
No related tags found
No related merge requests found
...@@ -195,7 +195,7 @@ oInstFile = Option "i" ["instances"] ...@@ -195,7 +195,7 @@ oInstFile = Option "i" ["instances"]
oNodeSim :: OptType oNodeSim :: OptType
oNodeSim = Option "" ["simulate"] oNodeSim = Option "" ["simulate"]
(ReqArg (\ f o -> Ok o { optNodeSim = Just f }) "SPEC") (ReqArg (\ f o -> Ok o { optNodeSim = Just f }) "SPEC")
"simulate an empty cluster, given as 'num_nodes,disk,memory,cpus'" "simulate an empty cluster, given as 'num_nodes,disk,ram,cpu'"
oRapiMaster :: OptType oRapiMaster :: OptType
oRapiMaster = Option "m" ["master"] oRapiMaster = Option "m" ["master"]
...@@ -297,12 +297,11 @@ oTieredSpec = Option "" ["tiered-alloc"] ...@@ -297,12 +297,11 @@ oTieredSpec = Option "" ["tiered-alloc"]
prs <- mapM (tryRead "tiered specs") sp prs <- mapM (tryRead "tiered specs") sp
tspec <- tspec <-
case prs of case prs of
[cpu, ram, dsk] -> return $ RSpec cpu ram dsk [dsk, ram, cpu] -> return $ RSpec cpu ram dsk
_ -> Bad $ "Invalid specification: " ++ inp _ -> Bad $ "Invalid specification: " ++ inp
return $ opts { optTieredSpec = Just tspec } ) return $ opts { optTieredSpec = Just tspec } )
"TSPEC") "TSPEC")
"enable tiered specs allocation, where we decrease the instance\ "enable tiered specs allocation, given as 'disk,ram,cpu'"
\ spec on failure to allocate and restart the allocation process"
oShowVer :: OptType oShowVer :: OptType
oShowVer = Option "V" ["version"] oShowVer = Option "V" ["version"]
......
...@@ -42,7 +42,7 @@ import qualified Ganeti.HTools.Instance as Instance ...@@ -42,7 +42,7 @@ import qualified Ganeti.HTools.Instance as Instance
parseDesc :: String -> Result (Int, Int, Int, Int) parseDesc :: String -> Result (Int, Int, Int, Int)
parseDesc desc = parseDesc desc =
case sepSplit ',' desc of case sepSplit ',' desc of
n:d:m:c:[] -> do [n, d, m, c] -> do
ncount <- tryRead "node count" n ncount <- tryRead "node count" n
disk <- tryRead "disk size" d disk <- tryRead "disk size" d
mem <- tryRead "memory size" m mem <- tryRead "memory size" m
......
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