Revision 8d38fb72

b/man/hroller.rst
51 51
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52 52

  
53 53
hroller will view the nodes as vertices of an undirected graph,
54
connecting by instances which have both a primary and a secondary node.
55
It will then color the graph using a few different heuristics, and
56
return the minimum-size color set found. Node with the same color don't
57
share an edge, and as such don't have an instance with both primary and
58
secondary node on them, so they are safe to be rebooted concurrently.
54
with two kind of edges. Firstly, there are edges from the primary
55
to the secondary node of every instance. Secondly, two nodes are connected
56
by an edge if they are the primary nodes of two instances that have the
57
same secondary node. It will then color the graph using a few different
58
heuristics, and return the minimum-size color set found. Node with the same
59
color can then simultaneously migrate all instance off to their respective
60
secondary nodes, and it is safe to reboot them simultaneously.
59 61

  
60 62
OPTIONS
61 63
-------
......
69 71
\--one-step-only
70 72
  Restrict to the first reboot group. Output the group one node per line.
71 73

  
74
\--offline-maintenance
75
  Pretend that all instances are shutdown before the reboots are carried
76
  out. I.e., only edges from the primary to the secondary node of an instance
77
  are considered.
78

  
72 79
\--force
73 80
  Do not fail, even if the master node cannot be determined.
74 81

  
......
90 97
EXAMPLE
91 98
-------
92 99

  
93
Offline Rolling node reboot output
94
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100
Rolling node reboot output
101
~~~~~~~~~~~~~~~~~~~~~~~~~~
95 102

  
96 103
With the default options, the program shows one reboot group per line as
97 104
a comma-separated list.
b/src/Ganeti/HTools/CLI.hs
70 70
  , oNoSimulation
71 71
  , oNodeSim
72 72
  , oNodeTags
73
  , oOfflineMaintenance
73 74
  , oOfflineNode
74 75
  , oOneStepOnly
75 76
  , oOutputDir
......
139 140
  , optNodeSim     :: [String]       -- ^ Cluster simulation mode
140 141
  , optNodeTags    :: Maybe [String] -- ^ List of node tags to restrict to 
141 142
  , optOffline     :: [String]       -- ^ Names of offline nodes
143
  , optOfflineMaintenance :: Bool    -- ^ Pretend all instances are offline
142 144
  , optOneStepOnly :: Bool           -- ^ Only do the first step
143 145
  , optOutPath     :: FilePath       -- ^ Path to the output directory
144 146
  , optSaveCluster :: Maybe FilePath -- ^ Save cluster state to this file
......
188 190
  , optNodeSim     = []
189 191
  , optNodeTags    = Nothing
190 192
  , optOffline     = []
193
  , optOfflineMaintenance = False
191 194
  , optOneStepOnly = False
192 195
  , optOutPath     = "."
193 196
  , optSaveCluster = Nothing
......
465 468
    "TAG,...") "Restrict to nodes with the given tags",
466 469
   OptComplString)
467 470
     
471
oOfflineMaintenance :: OptType
472
oOfflineMaintenance =
473
  (Option "" ["offline-maintenance"]
474
   (NoArg (\ opts -> Ok opts {optOfflineMaintenance = True}))
475
   "Schedule offline maintenance, i.e., pretend that all instance are\
476
   \ offline.",
477
   OptComplNone)
478

  
468 479
oOfflineNode :: OptType
469 480
oOfflineNode =
470 481
  (Option "O" ["offline"]
b/src/Ganeti/HTools/Program/Hroller.hs
58 58
    , oDataFile
59 59
    , oIAllocSrc
60 60
    , oOfflineNode
61
    , oOfflineMaintenance
61 62
    , oVerbose
62 63
    , oQuiet
63 64
    , oNoHeaders
......
143 144
                             , hasTag $ optNodeTags opts
144 145
                             , hasGroup wantedGroup ])
145 146
              nlf
147
      mkGraph = if optOfflineMaintenance opts
148
                   then Node.mkNodeGraph
149
                   else Node.mkRebootNodeGraph nlf
146 150

  
147 151
  -- TODO: fail if instances are running (with option to warn only)
148 152

  
149
  nodeGraph <- case Node.mkNodeGraph nodes ilf of
153
  nodeGraph <- case mkGraph nodes ilf of
150 154
                     Nothing -> exitErr "Cannot create node graph"
151 155
                     Just g -> return g
152 156

  

Also available in: Unified diff