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

htools: add cluster state saving support to hail


This add support for saving the cluster state (both pre- and
post-iallocator run) to a text file such that it can be fed back into
any of the htools commands.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent f9283686
No related branches found
No related tags found
No related merge requests found
......@@ -35,11 +35,13 @@ import qualified Ganeti.HTools.Cluster as Cluster
import Ganeti.HTools.CLI
import Ganeti.HTools.IAlloc
import Ganeti.HTools.Loader (Request(..), ClusterData(..))
import Ganeti.HTools.ExtLoader (maybeSaveData)
-- | Options list and functions
options :: [OptType]
options =
[ oPrintNodes
, oSaveCluster
, oDataFile
, oNodeSim
, oVerbose
......@@ -55,6 +57,7 @@ main = do
let shownodes = optShowNodes opts
verbose = optVerbose opts
savecluster = optSaveCluster opts
request <- readRequest opts args
......@@ -71,9 +74,14 @@ main = do
hPutStrLn stderr $ Cluster.printNodes (cdNodes cdata)
(fromJust shownodes)
maybeSaveData savecluster "pre-ialloc" "before iallocator run" cdata
let (maybe_ni, resp) = runIAllocator request
(fin_nl, fin_il) = maybe (cdNodes cdata, cdInstances cdata) id maybe_ni
putStrLn resp
when (isJust shownodes) $ do
hPutStrLn stderr "Final cluster status:"
hPutStrLn stderr $ Cluster.printNodes fin_nl (fromJust shownodes)
maybeSaveData savecluster "post-ialloc" "after iallocator run"
(cdata { cdNodes = fin_nl, cdInstances = fin_il})
......@@ -68,6 +68,12 @@ The options that can be passed to the program are as follows:
data with a simulated cluster. For details about the description,
see the man page **hspace**(1).
-S *filename*, --save-cluster=*filename*
If given, the state of the cluster before and the iallocator run is
saved to a file named *filename.pre-ialloc*, respectively
*filename.post-ialloc*. This allows re-feeding the cluster state to
any of the htools utilities.
-v
This option increases verbosity and can be used for debugging in order
to understand how the IAllocator request is parsed; it can be passed
......
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