In a simulated cluster as created by the simulation backend to the htools, make the first node of the first node group the master node. In this way, hools (like hroller) that require a master node can also be used on simulated clusters, e.g., for testing.
Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/HTools/Backend/Simu.hs | 1 + test/hs/shelltests/htools-single-group.test | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Ganeti/HTools/Backend/Simu.hs b/src/Ganeti/HTools/Backend/Simu.hs index fe779df..b26a178 100644 --- a/src/Ganeti/HTools/Backend/Simu.hs +++ b/src/Ganeti/HTools/Backend/Simu.hs @@ -78,6 +78,7 @@ createGroup grpIndex spec = do (apol, ncount, disk, mem, cpu, spindles) <- parseDesc spec $ sepSplit ',' spec let nodes = map (\idx -> + flip Node.setMaster (grpIndex == 1 && idx == 1) $ Node.create (printf "node-%02d-%03d" grpIndex idx) (fromIntegral mem) 0 mem (fromIntegral disk) disk diff --git a/test/hs/shelltests/htools-single-group.test b/test/hs/shelltests/htools-single-group.test index 0f27132..f8e629c 100644 --- a/test/hs/shelltests/htools-single-group.test +++ b/test/hs/shelltests/htools-single-group.test @@ -28,12 +28,10 @@ >>> /HCHECK_INIT_CLUSTER_NEED_REBALANCE=0/ >>>= 0 -# FIXME: remove option -f once the text backend supports indicating -# the master node # hroller should be able to print the solution -./test/hs/hroller -f -t$T/simu-onegroup.tiered +./test/hs/hroller -t$T/simu-onegroup.tiered >>>= 0 # hroller should be able to print the solution, in verbose mode as well -./test/hs/hroller -f -t$T/simu-onegroup.tiered -v -v +./test/hs/hroller -t$T/simu-onegroup.tiered -v -v >>>= 0 -- 1.8.2.1
