Skip to content
Snippets Groups Projects
Commit 8d38fb72 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Support online-maintenance in hroller


Make hroller take into account the nodes (redundant) instances
will be migrated to. This be behavior can be overridden by the
--offline-maintenance option which will make hroller plan under
the assumption that all instances will be shutdown before starting
with the rolling reboots.

Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent 30fded87
No related branches found
No related tags found
No related merge requests found
......@@ -51,11 +51,13 @@ ALGORITHM FOR CALCULATING OFFLINE REBOOT GROUPS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hroller will view the nodes as vertices of an undirected graph,
connecting by instances which have both a primary and a secondary node.
It will then color the graph using a few different heuristics, and
return the minimum-size color set found. Node with the same color don't
share an edge, and as such don't have an instance with both primary and
secondary node on them, so they are safe to be rebooted concurrently.
with two kind of edges. Firstly, there are edges from the primary
to the secondary node of every instance. Secondly, two nodes are connected
by an edge if they are the primary nodes of two instances that have the
same secondary node. It will then color the graph using a few different
heuristics, and return the minimum-size color set found. Node with the same
color can then simultaneously migrate all instance off to their respective
secondary nodes, and it is safe to reboot them simultaneously.
OPTIONS
-------
......@@ -69,6 +71,11 @@ For a description of the standard options check **htools**\(7) and
\--one-step-only
Restrict to the first reboot group. Output the group one node per line.
\--offline-maintenance
Pretend that all instances are shutdown before the reboots are carried
out. I.e., only edges from the primary to the secondary node of an instance
are considered.
\--force
Do not fail, even if the master node cannot be determined.
......@@ -90,8 +97,8 @@ should support them both with and without secondary node replacement.
EXAMPLE
-------
Offline Rolling node reboot output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rolling node reboot output
~~~~~~~~~~~~~~~~~~~~~~~~~~
With the default options, the program shows one reboot group per line as
a comma-separated list.
......
......@@ -70,6 +70,7 @@ module Ganeti.HTools.CLI
, oNoSimulation
, oNodeSim
, oNodeTags
, oOfflineMaintenance
, oOfflineNode
, oOneStepOnly
, oOutputDir
......@@ -139,6 +140,7 @@ data Options = Options
, optNodeSim :: [String] -- ^ Cluster simulation mode
, optNodeTags :: Maybe [String] -- ^ List of node tags to restrict to
, optOffline :: [String] -- ^ Names of offline nodes
, optOfflineMaintenance :: Bool -- ^ Pretend all instances are offline
, optOneStepOnly :: Bool -- ^ Only do the first step
, optOutPath :: FilePath -- ^ Path to the output directory
, optSaveCluster :: Maybe FilePath -- ^ Save cluster state to this file
......@@ -188,6 +190,7 @@ defaultOptions = Options
, optNodeSim = []
, optNodeTags = Nothing
, optOffline = []
, optOfflineMaintenance = False
, optOneStepOnly = False
, optOutPath = "."
, optSaveCluster = Nothing
......@@ -465,6 +468,14 @@ oNodeTags =
"TAG,...") "Restrict to nodes with the given tags",
OptComplString)
oOfflineMaintenance :: OptType
oOfflineMaintenance =
(Option "" ["offline-maintenance"]
(NoArg (\ opts -> Ok opts {optOfflineMaintenance = True}))
"Schedule offline maintenance, i.e., pretend that all instance are\
\ offline.",
OptComplNone)
oOfflineNode :: OptType
oOfflineNode =
(Option "O" ["offline"]
......
......@@ -58,6 +58,7 @@ options = do
, oDataFile
, oIAllocSrc
, oOfflineNode
, oOfflineMaintenance
, oVerbose
, oQuiet
, oNoHeaders
......@@ -143,10 +144,13 @@ main opts args = do
, hasTag $ optNodeTags opts
, hasGroup wantedGroup ])
nlf
mkGraph = if optOfflineMaintenance opts
then Node.mkNodeGraph
else Node.mkRebootNodeGraph nlf
-- TODO: fail if instances are running (with option to warn only)
nodeGraph <- case Node.mkNodeGraph nodes ilf of
nodeGraph <- case mkGraph nodes ilf of
Nothing -> exitErr "Cannot create node graph"
Just g -> return g
......
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