Revision 47eed3f4 htools/Ganeti/HTools/IAlloc.hs

b/htools/Ganeti/HTools/IAlloc.hs
254 254
    (_, _, nodes, _):[] -> return (info, showJSON $ map (Node.name) nodes)
255 255
    _ -> fail "Internal error: multiple allocation solutions"
256 256

  
257
-- | Convert a node-evacuation/change group result.
258
formatNodeEvac :: Cluster.EvacSolution -> Result IAllocResult
259
formatNodeEvac es =
260
    let fes = Cluster.esFailed es
261
        mes = Cluster.esMoved es
262
        failed = length fes
263
        moved  = length mes
264
        info = show failed ++ " instances failed to move and " ++ show moved ++
265
               " were moved successfully"
266
    in Ok (info, showJSON (mes, fes, Cluster.esOpCodes es))
267

  
257 268
-- | Process a request and return new node lists
258 269
processRequest :: Request -> Result IAllocResult
259 270
processRequest request =
......
266 277
       Evacuate exnodes ->
267 278
           Cluster.tryMGEvac gl nl il exnodes >>= formatEvacuate
268 279
       MultiReloc _ _ -> fail "multi-reloc not handled"
269
       NodeEvacuate _ _ -> fail "node-evacuate not handled"
280
       NodeEvacuate xi mode ->
281
           Cluster.tryNodeEvac gl nl il mode xi >>= formatNodeEvac
270 282

  
271 283
-- | Reads the request from the data file(s)
272 284
readRequest :: Options -> [String] -> IO Request

Also available in: Unified diff