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

Add option --one-step-only to hroller


Add a new option to hroller to only output information about the first
reboot group. Together with the option --node-tags this allows for the
following work flow. First tag all nodes; then repeatedly compute the
first node group, handle these nodes and remove the tags. In between
these steps, other operations can be carried out on the cluster.

Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent a39779f6
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ Reporting options:
**[ -v... | -q ]**
**[ -S *file* ]**
**[ --one-step-only ]**
DESCRIPTION
-----------
......@@ -65,6 +66,9 @@ For a description of the standard options check **htools**\(7) and
\--node-tags *tag,...*
Restrict to nodes having at least one of the given tags.
\--one-step-only
Restrict to the first reboot group. Output the group one node per line.
\--force
Do not fail, even if the master node cannot be determined.
......
......@@ -71,6 +71,7 @@ module Ganeti.HTools.CLI
, oNodeSim
, oNodeTags
, oOfflineNode
, oOneStepOnly
, oOutputDir
, oPrintCommands
, oPrintInsts
......@@ -138,6 +139,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
, optOneStepOnly :: Bool -- ^ Only do the first step
, optOutPath :: FilePath -- ^ Path to the output directory
, optSaveCluster :: Maybe FilePath -- ^ Save cluster state to this file
, optShowCmds :: Maybe FilePath -- ^ Whether to show the command list
......@@ -186,6 +188,7 @@ defaultOptions = Options
, optNodeSim = []
, optNodeTags = Nothing
, optOffline = []
, optOneStepOnly = False
, optOutPath = "."
, optSaveCluster = Nothing
, optShowCmds = Nothing
......@@ -469,6 +472,13 @@ oOfflineNode =
"set node as offline",
OptComplOneNode)
oOneStepOnly :: OptType
oOneStepOnly =
(Option "" ["one-step-only"]
(NoArg (\ opts -> Ok opts {optOneStepOnly = True}))
"Only do the first step",
OptComplNone)
oOutputDir :: OptType
oOutputDir =
(Option "d" ["output-dir"]
......
......@@ -65,6 +65,7 @@ options = do
, oSaveCluster
, oGroup
, oForce
, oOneStepOnly
]
-- | The list of arguments supported by the program.
......@@ -169,6 +170,15 @@ main opts args = do
when (verbose > 1) . putStrLn $ getStats colorings
unless (optNoHeaders opts) $
putStrLn "'Node Reboot Groups'"
mapM_ (putStrLn . commaJoin) outputRebootNames
if optOneStepOnly opts
then do
unless (optNoHeaders opts) $
putStrLn "'First Reboot Group'"
case outputRebootNames of
[] -> return ()
y : _ -> mapM_ putStrLn y
else do
unless (optNoHeaders opts) $
putStrLn "'Node Reboot Groups'"
mapM_ (putStrLn . commaJoin) outputRebootNames
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