diff --git a/htools/hail.hs b/htools/hail.hs index 9e2e3c2e511561ab3c323c10b8579b4061b9c475..59bd20705712f2d67446084bea0aa1a32b4374dc 100644 --- a/htools/hail.hs +++ b/htools/hail.hs @@ -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}) diff --git a/man/hail.rst b/man/hail.rst index 33b2787e1bfae1a68d10d5fdb7445f7a3b188687..23b12e58fae605d75124dce2b9f93b6a6af1dba2 100644 --- a/man/hail.rst +++ b/man/hail.rst @@ -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