doc/walkthrough.rst
HS_PROGS = htools/htools
-HS_BIN_ROLES = hbal hscan hspace hinfo
+HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
HS_ALL_PROGS = $(HS_PROGS) htools/test htools/hpc-htools htools/hconfd
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
htools/Ganeti/HTools/Program.hs \
htools/Ganeti/HTools/Program/Hail.hs \
htools/Ganeti/HTools/Program/Hbal.hs \
+ htools/Ganeti/HTools/Program/Hcheck.hs \
htools/Ganeti/HTools/Program/Hinfo.hs \
htools/Ganeti/HTools/Program/Hscan.hs \
htools/Ganeti/HTools/Program/Hspace.hs \
man/gnt-os.8 \
man/hail.1 \
man/hbal.1 \
+ man/hcheck.1 \
man/hinfo.1 \
man/hscan.1 \
man/hspace.1 \
, oMinGainLim
, oMinScore
, oNoHeaders
+ , oNoSimulation
, oNodeSim
, oOfflineNode
, oOutputDir
, optMinGainLim :: Score -- ^ Limit below which we apply mingain
, optMinScore :: Score -- ^ The minimum score we aim for
, optNoHeaders :: Bool -- ^ Do not show a header line
+ , optNoSimulation :: Bool -- ^ Skip the rebalancing dry-run
, optNodeSim :: [String] -- ^ Cluster simulation mode
, optOffline :: [String] -- ^ Names of offline nodes
, optOutPath :: FilePath -- ^ Path to the output directory
, optMinGainLim = 1e-1
, optMinScore = 1e-9
, optNoHeaders = False
+ , optNoSimulation = False
, optNodeSim = []
, optOffline = []
, optOutPath = "."
(NoArg (\ opts -> Ok opts { optNoHeaders = True }))
"do not show a header line"
+oNoSimulation :: OptType
+oNoSimulation = Option "" ["no-simulation"]
+ (NoArg (\opts -> Ok opts {optNoSimulation = True}))
+ "do not perform rebalancing simulation"
+
oNodeSim :: OptType
oNodeSim = Option "" ["simulate"]
(ReqArg (\ f o -> Ok o { optNodeSim = f:optNodeSim o }) "SPEC")
import qualified Ganeti.HTools.Program.Hail as Hail
import qualified Ganeti.HTools.Program.Hbal as Hbal
+import qualified Ganeti.HTools.Program.Hcheck as Hcheck
import qualified Ganeti.HTools.Program.Hscan as Hscan
import qualified Ganeti.HTools.Program.Hspace as Hspace
import qualified Ganeti.HTools.Program.Hinfo as Hinfo
personalities :: [(String, (Options -> [String] -> IO (), [OptType]))]
personalities = [ ("hail", (Hail.main, Hail.options))
, ("hbal", (Hbal.main, Hbal.options))
+ , ("hcheck", (Hcheck.main, Hcheck.options))
, ("hscan", (Hscan.main, Hscan.options))
, ("hspace", (Hspace.main, Hspace.options))
, ("hinfo", (Hinfo.main, Hinfo.options))
--- /dev/null
+{-| Cluster checker.
+
+-}
+
+{-
+
+Copyright (C) 2012 Google Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU Gene52al Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.
+
+-}
+
+module Ganeti.HTools.Program.Hcheck (main, options) where
+
+import Control.Monad
+import System.Exit
+import System.IO
+
+import Ganeti.HTools.CLI
+
+-- | Options list and functions.
+options :: [OptType]
+options =
+ [ oDataFile
+ , oDiskMoves
+ , oDynuFile
+ , oEvacMode
+ , oExInst
+ , oExTags
+ , oIAllocSrc
+ , oInstMoves
+ , oLuxiSocket
+ , oMachineReadable
+ , oMaxCpu
+ , oMaxSolLength
+ , oMinDisk
+ , oMinGain
+ , oMinGainLim
+ , oMinScore
+ , oNoSimulation
+ , oOfflineNode
+ , oQuiet
+ , oRapiMaster
+ , oSelInst
+ , oShowHelp
+ , oShowVer
+ , oVerbose
+ ]
+
+-- | Main function.
+main :: Options -> [String] -> IO ()
+main _ args = do
+ unless (null args) $ do
+ hPutStrLn stderr "Error: this program doesn't take any arguments."
+ exitWith $ ExitFailure 1
HTOOLS=hinfo $HBINARY "$@"
}
-ALL_ROLES="hbal hscan hail hspace hinfo"
+hcheck() {
+ HTOOLS=hinfo $HBINARY "$@"
+}
+
+ALL_ROLES="hbal hscan hail hspace hinfo hcheck"
--- /dev/null
+HCHECK(1) Ganeti | Version @GANETI_VERSION@
+===========================================
+
+NAME
+----
+
+hcheck \- Cluster checker
+
+SYNOPSIS
+--------
+
+**hcheck** {backend options...} [algorithm options...] [reporting options...]
+
+**hcheck** \--version
+
+
+Backend options:
+
+{ **-m** *cluster* | **-L[** *path* **] | **-t** *data-file* |
+**-I** *path* }
+
+Algorithm options:
+
+**[ \--no-simulation ]**
+**[ \--max-cpu *cpu-ratio* ]**
+**[ \--min-disk *disk-ratio* ]**
+**[ -l *limit* ]**
+**[ -e *score* ]**
+**[ -g *delta* ]** **[ \--min-gain-limit *threshold* ]**
+**[ -O *name...* ]**
+**[ \--no-disk-moves ]**
+**[ \--no-instance-moves ]**
+**[ -U *util-file* ]**
+**[ \--evac-mode ]**
+**[ \--select-instances *inst...* ]**
+**[ \--exclude-instances *inst...* ]**
+
+Reporting options:
+
+**[\--machine-readable**[=*CHOICE*] **]**
+**[ -p[ *fields* ] ]**
+**[ \--print-instances ]**
+**[ -v... | -q ]**
+
+
+DESCRIPTION
+-----------
+
+hcheck is the cluster checker. It prints information about cluster's
+health and checks whether a rebalance done using **hbal** would help.
+This information can be presented in both human-readable and
+machine-readable way.
+Note that it does not take any action, only performs a rebalance
+simulation if necessary.
+For more information about the algorithm details check **hbal(1)**.
+
+OPTIONS
+-------
+
+\--no-simulation
+ Only perform checks based on current cluster state, without trying
+ to simulate rebalancing.
+
+For a detailed description about the options listed above have a look at
+**htools(7)**, **hspace(1)** and **hbal(1)**.
+
+.. vim: set textwidth=72 :
+.. Local Variables:
+.. mode: rst
+.. fill-column: 72
+.. End:
**hbal**
cluster balancer
+**hcheck**
+ cluster checker
+
**hspace**
cluster capacity computation
Installed as ``hbal``, it computes and optionally executes a suite of
instance moves in order to balance the cluster.
+Installed as ``hcheck``, it preforms cluster checks and optionally
+simulates rebalancing with all the ``hbal`` options available.
+
Installed as ``hspace``, it computes how many additional instances can
be fit on a cluster, while maintaining N+1 status. It can run on models
of existing clusters or of simulated clusters.