Revision 4938fa30
b/htools/Ganeti/HTools/Loader.hs | ||
---|---|---|
30 | 30 |
( mergeData |
31 | 31 |
, checkData |
32 | 32 |
, assignIndices |
33 |
, lookupName |
|
34 |
, goodLookupResult |
|
33 | 35 |
, lookupNode |
34 | 36 |
, lookupInstance |
35 | 37 |
, lookupGroup |
b/htools/Ganeti/HTools/Program/Hbal.hs | ||
---|---|---|
49 | 49 |
import Ganeti.HTools.ExtLoader |
50 | 50 |
import Ganeti.HTools.Utils |
51 | 51 |
import Ganeti.HTools.Types |
52 |
import Ganeti.HTools.Loader (ClusterData(..))
|
|
52 |
import Ganeti.HTools.Loader |
|
53 | 53 |
|
54 | 54 |
import qualified Ganeti.Luxi as L |
55 | 55 |
import Ganeti.Jobs |
... | ... | |
240 | 240 |
|
241 | 241 |
ini_cdata@(ClusterData gl fixed_nl ilf ctags) <- loadExternalData opts |
242 | 242 |
|
243 |
let offline_names = optOffline opts
|
|
243 |
let offline_passed = optOffline opts
|
|
244 | 244 |
all_nodes = Container.elems fixed_nl |
245 |
all_names = concatMap allNames all_nodes |
|
246 |
offline_wrong = filter (`notElem` all_names) offline_names |
|
245 |
offline_lkp = map (lookupName (map Node.name all_nodes)) offline_passed |
|
246 |
offline_wrong = filter (not . goodLookupResult) offline_lkp |
|
247 |
offline_names = map lrContent offline_lkp |
|
247 | 248 |
offline_indices = map Node.idx $ |
248 |
filter (\n -> |
|
249 |
Node.name n `elem` offline_names || |
|
250 |
Node.alias n `elem` offline_names) |
|
249 |
filter (\n -> Node.name n `elem` offline_names) |
|
251 | 250 |
all_nodes |
252 | 251 |
m_cpu = optMcpu opts |
253 | 252 |
m_dsk = optMdsk opts |
254 | 253 |
csf = commonSuffix fixed_nl ilf |
255 | 254 |
|
256 |
when (length offline_wrong > 0) $ do
|
|
257 |
hPrintf stderr "Wrong node name(s) set as offline: %s\n" |
|
258 |
(commaJoin offline_wrong) :: IO ()
|
|
255 |
when (not (null offline_wrong)) $ do
|
|
256 |
hPrintf stderr "Error: Wrong node name(s) set as offline: %s\n"
|
|
257 |
(commaJoin (map lrContent offline_wrong)) :: IO ()
|
|
259 | 258 |
exitWith $ ExitFailure 1 |
260 | 259 |
|
261 | 260 |
let nm = Container.map (\n -> if Node.idx n `elem` offline_indices |
b/htools/Ganeti/HTools/Program/Hspace.hs | ||
---|---|---|
46 | 46 |
import Ganeti.HTools.Types |
47 | 47 |
import Ganeti.HTools.CLI |
48 | 48 |
import Ganeti.HTools.ExtLoader |
49 |
import Ganeti.HTools.Loader (ClusterData(..))
|
|
49 |
import Ganeti.HTools.Loader |
|
50 | 50 |
|
51 | 51 |
-- | Options list and functions |
52 | 52 |
options :: [OptType] |
... | ... | |
246 | 246 |
|
247 | 247 |
let num_instances = length $ Container.elems il |
248 | 248 |
|
249 |
let offline_names = optOffline opts
|
|
249 |
let offline_passed = optOffline opts
|
|
250 | 250 |
all_nodes = Container.elems fixed_nl |
251 |
all_names = map Node.name all_nodes |
|
252 |
offline_wrong = filter (`notElem` all_names) offline_names |
|
251 |
offline_lkp = map (lookupName (map Node.name all_nodes)) offline_passed |
|
252 |
offline_wrong = filter (not . goodLookupResult) offline_lkp |
|
253 |
offline_names = map lrContent offline_lkp |
|
253 | 254 |
offline_indices = map Node.idx $ |
254 |
filter (\n -> |
|
255 |
Node.name n `elem` offline_names || |
|
256 |
Node.alias n `elem` offline_names) |
|
255 |
filter (\n -> Node.name n `elem` offline_names) |
|
257 | 256 |
all_nodes |
258 | 257 |
m_cpu = optMcpu opts |
259 | 258 |
m_dsk = optMdsk opts |
260 | 259 |
|
261 |
when (length offline_wrong > 0) $ do
|
|
260 |
when (not (null offline_wrong)) $ do
|
|
262 | 261 |
hPrintf stderr "Error: Wrong node name(s) set as offline: %s\n" |
263 |
(commaJoin offline_wrong) :: IO ()
|
|
262 |
(commaJoin (map lrContent offline_wrong)) :: IO ()
|
|
264 | 263 |
exitWith $ ExitFailure 1 |
265 | 264 |
|
266 | 265 |
when (req_nodes /= 1 && req_nodes /= 2) $ do |
Also available in: Unified diff