Revision d66aa238
b/htest/Test/Ganeti/HTools/CLI.hs | ||
---|---|---|
119 | 119 |
-- | Test that all binaries support some common options. |
120 | 120 |
case_stdopts :: Assertion |
121 | 121 |
case_stdopts = |
122 |
mapM_ (\(name, (_, o, a)) -> checkEarlyExit defaultOptions name |
|
123 |
(o ++ genericOpts) a) Program.personalities |
|
122 |
mapM_ (\(name, (_, o, a)) -> do |
|
123 |
o' <- o |
|
124 |
checkEarlyExit defaultOptions name |
|
125 |
(o' ++ genericOpts) a) Program.personalities |
|
124 | 126 |
|
125 | 127 |
testSuite "HTools/CLI" |
126 | 128 |
[ 'prop_parseISpec |
b/htools/Ganeti/HTools/Program.hs | ||
---|---|---|
39 | 39 |
|
40 | 40 |
-- | Supported binaries. |
41 | 41 |
personalities :: [(String, |
42 |
(Options -> [String] -> IO (), [OptType], [ArgCompletion]))] |
|
42 |
(Options -> [String] -> IO (), IO [OptType], |
|
43 |
[ArgCompletion]))] |
|
43 | 44 |
personalities = [ ("hail", (Hail.main, Hail.options, Hail.arguments)) |
44 | 45 |
, ("hbal", (Hbal.main, Hbal.options, Hbal.arguments)) |
45 | 46 |
, ("hcheck", (Hcheck.main, Hcheck.options, Hcheck.arguments)) |
b/htools/Ganeti/HTools/Program/Hail.hs | ||
---|---|---|
43 | 43 |
import Ganeti.Utils |
44 | 44 |
|
45 | 45 |
-- | Options list and functions. |
46 |
options :: [OptType] |
|
46 |
options :: IO [OptType]
|
|
47 | 47 |
options = |
48 |
[ oPrintNodes |
|
49 |
, oSaveCluster |
|
50 |
, oDataFile |
|
51 |
, oNodeSim |
|
52 |
, oVerbose |
|
53 |
] |
|
48 |
return |
|
49 |
[ oPrintNodes |
|
50 |
, oSaveCluster |
|
51 |
, oDataFile |
|
52 |
, oNodeSim |
|
53 |
, oVerbose |
|
54 |
] |
|
54 | 55 |
|
55 | 56 |
-- | The list of arguments supported by the program. |
56 | 57 |
arguments :: [ArgCompletion] |
b/htools/Ganeti/HTools/Program/Hbal.hs | ||
---|---|---|
62 | 62 |
import Ganeti.Jobs |
63 | 63 |
|
64 | 64 |
-- | Options list and functions. |
65 |
options :: [OptType] |
|
65 |
options :: IO [OptType]
|
|
66 | 66 |
options = |
67 |
[ oPrintNodes |
|
68 |
, oPrintInsts |
|
69 |
, oPrintCommands |
|
70 |
, oDataFile |
|
71 |
, oEvacMode |
|
72 |
, oRapiMaster |
|
73 |
, oLuxiSocket |
|
74 |
, oIAllocSrc |
|
75 |
, oExecJobs |
|
76 |
, oGroup |
|
77 |
, oMaxSolLength |
|
78 |
, oVerbose |
|
79 |
, oQuiet |
|
80 |
, oOfflineNode |
|
81 |
, oMinScore |
|
82 |
, oMaxCpu |
|
83 |
, oMinDisk |
|
84 |
, oMinGain |
|
85 |
, oMinGainLim |
|
86 |
, oDiskMoves |
|
87 |
, oSelInst |
|
88 |
, oInstMoves |
|
89 |
, oDynuFile |
|
90 |
, oExTags |
|
91 |
, oExInst |
|
92 |
, oSaveCluster |
|
93 |
] |
|
67 |
return |
|
68 |
[ oPrintNodes |
|
69 |
, oPrintInsts |
|
70 |
, oPrintCommands |
|
71 |
, oDataFile |
|
72 |
, oEvacMode |
|
73 |
, oRapiMaster |
|
74 |
, oLuxiSocket |
|
75 |
, oIAllocSrc |
|
76 |
, oExecJobs |
|
77 |
, oGroup |
|
78 |
, oMaxSolLength |
|
79 |
, oVerbose |
|
80 |
, oQuiet |
|
81 |
, oOfflineNode |
|
82 |
, oMinScore |
|
83 |
, oMaxCpu |
|
84 |
, oMinDisk |
|
85 |
, oMinGain |
|
86 |
, oMinGainLim |
|
87 |
, oDiskMoves |
|
88 |
, oSelInst |
|
89 |
, oInstMoves |
|
90 |
, oDynuFile |
|
91 |
, oExTags |
|
92 |
, oExInst |
|
93 |
, oSaveCluster |
|
94 |
] |
|
94 | 95 |
|
95 | 96 |
-- | The list of arguments supported by the program. |
96 | 97 |
arguments :: [ArgCompletion] |
b/htools/Ganeti/HTools/Program/Hcheck.hs | ||
---|---|---|
50 | 50 |
import Ganeti.Utils |
51 | 51 |
|
52 | 52 |
-- | Options list and functions. |
53 |
options :: [OptType] |
|
53 |
options :: IO [OptType]
|
|
54 | 54 |
options = |
55 |
[ oDataFile |
|
56 |
, oDiskMoves |
|
57 |
, oDynuFile |
|
58 |
, oEvacMode |
|
59 |
, oExInst |
|
60 |
, oExTags |
|
61 |
, oIAllocSrc |
|
62 |
, oInstMoves |
|
63 |
, oLuxiSocket |
|
64 |
, oMachineReadable |
|
65 |
, oMaxCpu |
|
66 |
, oMaxSolLength |
|
67 |
, oMinDisk |
|
68 |
, oMinGain |
|
69 |
, oMinGainLim |
|
70 |
, oMinScore |
|
71 |
, oNoSimulation |
|
72 |
, oOfflineNode |
|
73 |
, oQuiet |
|
74 |
, oRapiMaster |
|
75 |
, oSelInst |
|
76 |
, oVerbose |
|
77 |
] |
|
55 |
return |
|
56 |
[ oDataFile |
|
57 |
, oDiskMoves |
|
58 |
, oDynuFile |
|
59 |
, oEvacMode |
|
60 |
, oExInst |
|
61 |
, oExTags |
|
62 |
, oIAllocSrc |
|
63 |
, oInstMoves |
|
64 |
, oLuxiSocket |
|
65 |
, oMachineReadable |
|
66 |
, oMaxCpu |
|
67 |
, oMaxSolLength |
|
68 |
, oMinDisk |
|
69 |
, oMinGain |
|
70 |
, oMinGainLim |
|
71 |
, oMinScore |
|
72 |
, oNoSimulation |
|
73 |
, oOfflineNode |
|
74 |
, oQuiet |
|
75 |
, oRapiMaster |
|
76 |
, oSelInst |
|
77 |
, oVerbose |
|
78 |
] |
|
78 | 79 |
|
79 | 80 |
-- | The list of arguments supported by the program. |
80 | 81 |
arguments :: [ArgCompletion] |
b/htools/Ganeti/HTools/Program/Hinfo.hs | ||
---|---|---|
48 | 48 |
import Ganeti.Utils |
49 | 49 |
|
50 | 50 |
-- | Options list and functions. |
51 |
options :: [OptType] |
|
51 |
options :: IO [OptType]
|
|
52 | 52 |
options = |
53 |
[ oPrintNodes |
|
54 |
, oPrintInsts |
|
55 |
, oDataFile |
|
56 |
, oRapiMaster |
|
57 |
, oLuxiSocket |
|
58 |
, oIAllocSrc |
|
59 |
, oVerbose |
|
60 |
, oQuiet |
|
61 |
, oOfflineNode |
|
62 |
] |
|
53 |
return |
|
54 |
[ oPrintNodes |
|
55 |
, oPrintInsts |
|
56 |
, oDataFile |
|
57 |
, oRapiMaster |
|
58 |
, oLuxiSocket |
|
59 |
, oIAllocSrc |
|
60 |
, oVerbose |
|
61 |
, oQuiet |
|
62 |
, oOfflineNode |
|
63 |
] |
|
63 | 64 |
|
64 | 65 |
-- | The list of arguments supported by the program. |
65 | 66 |
arguments :: [ArgCompletion] |
b/htools/Ganeti/HTools/Program/Hscan.hs | ||
---|---|---|
52 | 52 |
import Ganeti.HTools.CLI |
53 | 53 |
|
54 | 54 |
-- | Options list and functions. |
55 |
options :: [OptType] |
|
55 |
options :: IO [OptType]
|
|
56 | 56 |
options = |
57 |
[ oPrintNodes |
|
58 |
, oOutputDir |
|
59 |
, oLuxiSocket |
|
60 |
, oVerbose |
|
61 |
, oNoHeaders |
|
62 |
] |
|
57 |
return |
|
58 |
[ oPrintNodes |
|
59 |
, oOutputDir |
|
60 |
, oLuxiSocket |
|
61 |
, oVerbose |
|
62 |
, oNoHeaders |
|
63 |
] |
|
63 | 64 |
|
64 | 65 |
-- | The list of arguments supported by the program. |
65 | 66 |
arguments :: [ArgCompletion] |
b/htools/Ganeti/HTools/Program/Hspace.hs | ||
---|---|---|
53 | 53 |
import Ganeti.Utils |
54 | 54 |
|
55 | 55 |
-- | Options list and functions. |
56 |
options :: [OptType] |
|
56 |
options :: IO [OptType]
|
|
57 | 57 |
options = |
58 |
[ oPrintNodes |
|
59 |
, oDataFile |
|
60 |
, oDiskTemplate |
|
61 |
, oSpindleUse |
|
62 |
, oNodeSim |
|
63 |
, oRapiMaster |
|
64 |
, oLuxiSocket |
|
65 |
, oIAllocSrc |
|
66 |
, oVerbose |
|
67 |
, oQuiet |
|
68 |
, oOfflineNode |
|
69 |
, oMachineReadable |
|
70 |
, oMaxCpu |
|
71 |
, oMaxSolLength |
|
72 |
, oMinDisk |
|
73 |
, oStdSpec |
|
74 |
, oTieredSpec |
|
75 |
, oSaveCluster |
|
76 |
] |
|
58 |
return |
|
59 |
[ oPrintNodes |
|
60 |
, oDataFile |
|
61 |
, oDiskTemplate |
|
62 |
, oSpindleUse |
|
63 |
, oNodeSim |
|
64 |
, oRapiMaster |
|
65 |
, oLuxiSocket |
|
66 |
, oIAllocSrc |
|
67 |
, oVerbose |
|
68 |
, oQuiet |
|
69 |
, oOfflineNode |
|
70 |
, oMachineReadable |
|
71 |
, oMaxCpu |
|
72 |
, oMaxSolLength |
|
73 |
, oMinDisk |
|
74 |
, oStdSpec |
|
75 |
, oTieredSpec |
|
76 |
, oSaveCluster |
|
77 |
] |
|
77 | 78 |
|
78 | 79 |
-- | The list of arguments supported by the program. |
79 | 80 |
arguments :: [ArgCompletion] |
b/htools/htools.hs | ||
---|---|---|
56 | 56 |
Nothing -> usage name |
57 | 57 |
Just (fn, options, arguments) -> do |
58 | 58 |
cmd_args <- getArgs |
59 |
(opts, args) <- parseOpts cmd_args name (options ++ genericOpts) |
|
59 |
real_options <- options |
|
60 |
(opts, args) <- parseOpts cmd_args name (real_options ++ genericOpts) |
|
60 | 61 |
arguments |
61 | 62 |
fn opts args |
Also available in: Unified diff