diff --git a/man/hroller.rst b/man/hroller.rst index 1caaf7be8eeaf702cb8b9dd944b384401baea49d..e39061d738c372ed190fbc5acfb90caac7d74662 100644 --- a/man/hroller.rst +++ b/man/hroller.rst @@ -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. diff --git a/src/Ganeti/HTools/CLI.hs b/src/Ganeti/HTools/CLI.hs index c0687233d4e759bbf736f96c5e61f225dead3268..33e241d5e317fa27d2888f55dd2d4381d4f2ef0d 100644 --- a/src/Ganeti/HTools/CLI.hs +++ b/src/Ganeti/HTools/CLI.hs @@ -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"] diff --git a/src/Ganeti/HTools/Program/Hroller.hs b/src/Ganeti/HTools/Program/Hroller.hs index 576ffb85fabda2ac6f2e6b523f8c3ee8cd47633a..d62263b1bf45dea1fa43fdcc690a24b71462534c 100644 --- a/src/Ganeti/HTools/Program/Hroller.hs +++ b/src/Ganeti/HTools/Program/Hroller.hs @@ -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