Skip to content
Snippets Groups Projects
Commit 3d7cd10b authored by Iustin Pop's avatar Iustin Pop
Browse files

hbal: Abort for invalid offline node names

Since it's easy to pass a wrong node name as offline, we should abort
instead of silently ignoring it.
parent c5bd8d89
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ module Ganeti.HTools.Utils
, swapPairs
, varianceCoeff
, readData
, commaJoin
) where
import Data.Either
......
......@@ -160,9 +160,16 @@ main = do
putStrLn . unlines . map (\s -> printf " - %s" s) $ fix_msgs
let offline_names = optOffline opts
all_names = snd . unzip $ ktn
offline_wrong = filter (\n -> not $ elem n all_names) offline_names
offline_indices = fst . unzip .
filter (\(_, n) -> elem n offline_names) $ ktn
when (length offline_wrong > 0) $ do
printf "Wrong node name(s) set as offline: %s\n"
(commaJoin offline_wrong)
exitWith $ ExitFailure 1
let nl = Container.map (\n -> if elem (Node.idx n) offline_indices
then Node.setOffline n True
else n) fixed_nl
......
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