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: ...@@ -33,6 +33,7 @@ Reporting options:
**[ -v... | -q ]** **[ -v... | -q ]**
**[ -S *file* ]** **[ -S *file* ]**
**[ --one-step-only ]**
DESCRIPTION DESCRIPTION
----------- -----------
...@@ -65,6 +66,9 @@ For a description of the standard options check **htools**\(7) and ...@@ -65,6 +66,9 @@ For a description of the standard options check **htools**\(7) and
\--node-tags *tag,...* \--node-tags *tag,...*
Restrict to nodes having at least one of the given tags. 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 \--force
Do not fail, even if the master node cannot be determined. Do not fail, even if the master node cannot be determined.
......
...@@ -71,6 +71,7 @@ module Ganeti.HTools.CLI ...@@ -71,6 +71,7 @@ module Ganeti.HTools.CLI
, oNodeSim , oNodeSim
, oNodeTags , oNodeTags
, oOfflineNode , oOfflineNode
, oOneStepOnly
, oOutputDir , oOutputDir
, oPrintCommands , oPrintCommands
, oPrintInsts , oPrintInsts
...@@ -138,6 +139,7 @@ data Options = Options ...@@ -138,6 +139,7 @@ data Options = Options
, optNodeSim :: [String] -- ^ Cluster simulation mode , optNodeSim :: [String] -- ^ Cluster simulation mode
, optNodeTags :: Maybe [String] -- ^ List of node tags to restrict to , optNodeTags :: Maybe [String] -- ^ List of node tags to restrict to
, optOffline :: [String] -- ^ Names of offline nodes , optOffline :: [String] -- ^ Names of offline nodes
, optOneStepOnly :: Bool -- ^ Only do the first step
, optOutPath :: FilePath -- ^ Path to the output directory , optOutPath :: FilePath -- ^ Path to the output directory
, optSaveCluster :: Maybe FilePath -- ^ Save cluster state to this file , optSaveCluster :: Maybe FilePath -- ^ Save cluster state to this file
, optShowCmds :: Maybe FilePath -- ^ Whether to show the command list , optShowCmds :: Maybe FilePath -- ^ Whether to show the command list
...@@ -186,6 +188,7 @@ defaultOptions = Options ...@@ -186,6 +188,7 @@ defaultOptions = Options
, optNodeSim = [] , optNodeSim = []
, optNodeTags = Nothing , optNodeTags = Nothing
, optOffline = [] , optOffline = []
, optOneStepOnly = False
, optOutPath = "." , optOutPath = "."
, optSaveCluster = Nothing , optSaveCluster = Nothing
, optShowCmds = Nothing , optShowCmds = Nothing
...@@ -469,6 +472,13 @@ oOfflineNode = ...@@ -469,6 +472,13 @@ oOfflineNode =
"set node as offline", "set node as offline",
OptComplOneNode) OptComplOneNode)
oOneStepOnly :: OptType
oOneStepOnly =
(Option "" ["one-step-only"]
(NoArg (\ opts -> Ok opts {optOneStepOnly = True}))
"Only do the first step",
OptComplNone)
oOutputDir :: OptType oOutputDir :: OptType
oOutputDir = oOutputDir =
(Option "d" ["output-dir"] (Option "d" ["output-dir"]
......
...@@ -65,6 +65,7 @@ options = do ...@@ -65,6 +65,7 @@ options = do
, oSaveCluster , oSaveCluster
, oGroup , oGroup
, oForce , oForce
, oOneStepOnly
] ]
-- | The list of arguments supported by the program. -- | The list of arguments supported by the program.
...@@ -169,6 +170,15 @@ main opts args = do ...@@ -169,6 +170,15 @@ main opts args = do
when (verbose > 1) . putStrLn $ getStats colorings when (verbose > 1) . putStrLn $ getStats colorings
unless (optNoHeaders opts) $ if optOneStepOnly opts
putStrLn "'Node Reboot Groups'" then do
mapM_ (putStrLn . commaJoin) outputRebootNames 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