Revision 22e513e7

b/Makefile.am
356 356
	doc/walkthrough.rst
357 357

  
358 358
HS_PROGS = htools/htools
359
HS_BIN_ROLES = hbal hscan hspace hinfo
359
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
360 360

  
361 361
HS_ALL_PROGS = $(HS_PROGS) htools/test htools/hpc-htools htools/hconfd
362 362
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
......
399 399
	htools/Ganeti/HTools/Program.hs \
400 400
	htools/Ganeti/HTools/Program/Hail.hs \
401 401
	htools/Ganeti/HTools/Program/Hbal.hs \
402
	htools/Ganeti/HTools/Program/Hcheck.hs \
402 403
	htools/Ganeti/HTools/Program/Hinfo.hs \
403 404
	htools/Ganeti/HTools/Program/Hscan.hs \
404 405
	htools/Ganeti/HTools/Program/Hspace.hs \
......
692 693
	man/gnt-os.8 \
693 694
	man/hail.1 \
694 695
	man/hbal.1 \
696
  man/hcheck.1 \
695 697
	man/hinfo.1 \
696 698
	man/hscan.1 \
697 699
	man/hspace.1 \
b/htools/Ganeti/HTools/CLI.hs
62 62
  , oMinGainLim
63 63
  , oMinScore
64 64
  , oNoHeaders
65
  , oNoSimulation
65 66
  , oNodeSim
66 67
  , oOfflineNode
67 68
  , oOutputDir
......
133 134
  , optMinGainLim  :: Score          -- ^ Limit below which we apply mingain
134 135
  , optMinScore    :: Score          -- ^ The minimum score we aim for
135 136
  , optNoHeaders   :: Bool           -- ^ Do not show a header line
137
  , optNoSimulation :: Bool          -- ^ Skip the rebalancing dry-run
136 138
  , optNodeSim     :: [String]       -- ^ Cluster simulation mode
137 139
  , optOffline     :: [String]       -- ^ Names of offline nodes
138 140
  , optOutPath     :: FilePath       -- ^ Path to the output directory
......
175 177
  , optMinGainLim  = 1e-1
176 178
  , optMinScore    = 1e-9
177 179
  , optNoHeaders   = False
180
  , optNoSimulation = False
178 181
  , optNodeSim     = []
179 182
  , optOffline     = []
180 183
  , optOutPath     = "."
......
349 352
             (NoArg (\ opts -> Ok opts { optNoHeaders = True }))
350 353
             "do not show a header line"
351 354

  
355
oNoSimulation :: OptType
356
oNoSimulation = Option "" ["no-simulation"]
357
                (NoArg (\opts -> Ok opts {optNoSimulation = True}))
358
                "do not perform rebalancing simulation"
359

  
352 360
oNodeSim :: OptType
353 361
oNodeSim = Option "" ["simulate"]
354 362
            (ReqArg (\ f o -> Ok o { optNodeSim = f:optNodeSim o }) "SPEC")
b/htools/Ganeti/HTools/Program.hs
31 31

  
32 32
import qualified Ganeti.HTools.Program.Hail as Hail
33 33
import qualified Ganeti.HTools.Program.Hbal as Hbal
34
import qualified Ganeti.HTools.Program.Hcheck as Hcheck
34 35
import qualified Ganeti.HTools.Program.Hscan as Hscan
35 36
import qualified Ganeti.HTools.Program.Hspace as Hspace
36 37
import qualified Ganeti.HTools.Program.Hinfo as Hinfo
......
39 40
personalities :: [(String, (Options -> [String] -> IO (), [OptType]))]
40 41
personalities = [ ("hail",   (Hail.main,   Hail.options))
41 42
                , ("hbal",   (Hbal.main,   Hbal.options))
43
                , ("hcheck", (Hcheck.main, Hcheck.options))
42 44
                , ("hscan",  (Hscan.main,  Hscan.options))
43 45
                , ("hspace", (Hspace.main, Hspace.options))
44 46
                , ("hinfo",  (Hinfo.main,  Hinfo.options))
b/htools/Ganeti/HTools/Program/Hcheck.hs
1
{-| Cluster checker.
2

  
3
-}
4

  
5
{-
6

  
7
Copyright (C) 2012 Google Inc.
8

  
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2 of the License, or
12
(at your option) any later version.
13

  
14
This program is distributed in the hope that it will be useful, but
15
WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
General Public License for more details.
18

  
19
You should have received a copy of the GNU Gene52al Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
02110-1301, USA.
23

  
24
-}
25

  
26
module Ganeti.HTools.Program.Hcheck (main, options) where
27

  
28
import Control.Monad
29
import System.Exit
30
import System.IO
31

  
32
import Ganeti.HTools.CLI
33

  
34
-- | Options list and functions.
35
options :: [OptType]
36
options =
37
  [ oDataFile
38
  , oDiskMoves
39
  , oDynuFile
40
  , oEvacMode
41
  , oExInst
42
  , oExTags
43
  , oIAllocSrc
44
  , oInstMoves
45
  , oLuxiSocket
46
  , oMachineReadable
47
  , oMaxCpu
48
  , oMaxSolLength
49
  , oMinDisk
50
  , oMinGain
51
  , oMinGainLim
52
  , oMinScore
53
  , oNoSimulation
54
  , oOfflineNode
55
  , oQuiet
56
  , oRapiMaster
57
  , oSelInst
58
  , oShowHelp
59
  , oShowVer
60
  , oVerbose
61
  ]
62

  
63
-- | Main function.
64
main :: Options -> [String] -> IO ()
65
main _ args = do
66
  unless (null args) $ do
67
         hPutStrLn stderr "Error: this program doesn't take any arguments."
68
         exitWith $ ExitFailure 1
b/htools/cli-tests-defs.sh
43 43
  HTOOLS=hinfo $HBINARY "$@"
44 44
}
45 45

  
46
ALL_ROLES="hbal hscan hail hspace hinfo"
46
hcheck() {
47
  HTOOLS=hinfo $HBINARY "$@"
48
}
49

  
50
ALL_ROLES="hbal hscan hail hspace hinfo hcheck"
b/man/hcheck.rst
1
HCHECK(1) Ganeti | Version @GANETI_VERSION@
2
===========================================
3

  
4
NAME
5
----
6

  
7
hcheck \- Cluster checker
8

  
9
SYNOPSIS
10
--------
11

  
12
**hcheck** {backend options...} [algorithm options...] [reporting options...]
13

  
14
**hcheck** \--version
15

  
16

  
17
Backend options:
18

  
19
{ **-m** *cluster* | **-L[** *path* **] | **-t** *data-file* |
20
**-I** *path* }
21

  
22
Algorithm options:
23

  
24
**[ \--no-simulation ]**
25
**[ \--max-cpu *cpu-ratio* ]**
26
**[ \--min-disk *disk-ratio* ]**
27
**[ -l *limit* ]**
28
**[ -e *score* ]**
29
**[ -g *delta* ]** **[ \--min-gain-limit *threshold* ]**
30
**[ -O *name...* ]**
31
**[ \--no-disk-moves ]**
32
**[ \--no-instance-moves ]**
33
**[ -U *util-file* ]**
34
**[ \--evac-mode ]**
35
**[ \--select-instances *inst...* ]**
36
**[ \--exclude-instances *inst...* ]**
37

  
38
Reporting options:
39

  
40
**[\--machine-readable**[=*CHOICE*] **]**
41
**[ -p[ *fields* ] ]**
42
**[ \--print-instances ]**
43
**[ -v... | -q ]**
44

  
45

  
46
DESCRIPTION
47
-----------
48

  
49
hcheck is the cluster checker. It prints information about cluster's
50
health and checks whether a rebalance done using **hbal** would help.
51
This information can be presented in both human-readable and
52
machine-readable way.
53
Note that it does not take any action, only performs a rebalance
54
simulation if necessary.
55
For more information about the algorithm details check **hbal(1)**.
56

  
57
OPTIONS
58
-------
59

  
60
\--no-simulation
61
  Only perform checks based on current cluster state, without trying
62
  to simulate rebalancing.
63

  
64
For a detailed description about the options listed above have a look at
65
**htools(7)**, **hspace(1)** and **hbal(1)**.
66

  
67
.. vim: set textwidth=72 :
68
.. Local Variables:
69
.. mode: rst
70
.. fill-column: 72
71
.. End:
b/man/htools.rst
12 12
**hbal**
13 13
  cluster balancer
14 14

  
15
**hcheck**
16
  cluster checker
17

  
15 18
**hspace**
16 19
  cluster capacity computation
17 20

  
......
35 38
Installed as ``hbal``, it computes and optionally executes a suite of
36 39
instance moves in order to balance the cluster.
37 40

  
41
Installed as ``hcheck``, it preforms cluster checks and optionally
42
simulates rebalancing with all the ``hbal`` options available.
43

  
38 44
Installed as ``hspace``, it computes how many additional instances can
39 45
be fit on a cluster, while maintaining N+1 status. It can run on models
40 46
of existing clusters or of simulated clusters.

Also available in: Unified diff