Revision 00b51a14

b/src/Cluster.hs
67 67
data Removal = Removal NodeList [Instance.Instance]
68 68

  
69 69
-- | An instance move definition
70
data IMove = Failover
71
           | ReplacePrimary Int
72
           | ReplaceSecondary Int
73
           | ReplaceAndFailover Int
70
data IMove = Failover                -- ^ Failover the instance (f)
71
           | ReplacePrimary Int      -- ^ Replace the primary (f, r:np, f)
72
           | ReplaceSecondary Int    -- ^ Replace the secondary (r:ns)
73
           | ReplaceAndFailover Int  -- ^ Replace the secondary and
74
                                     -- failover (r:ns, f)
74 75
             deriving (Show)
75 76

  
76 77
-- | The complete state for the balancing solution
......
329 330
-- | Apply a move
330 331
applyMove :: NodeList -> Instance.Instance
331 332
          -> IMove -> (Maybe NodeList, Instance.Instance, Int, Int)
333
-- Failover (f)
332 334
applyMove nl inst Failover =
333 335
    let old_pdx = Instance.pnode inst
334 336
        old_sdx = Instance.snode inst
......
343 345
                      old_sdx (fromJust new_p) nl
344 346
    in (new_nl, Instance.setBoth inst old_sdx old_pdx, old_sdx, old_pdx)
345 347

  
348
-- Replace the primary (f:, r:np, f)
346 349
applyMove nl inst (ReplacePrimary new_pdx) =
347 350
    let old_pdx = Instance.pnode inst
348 351
        old_sdx = Instance.snode inst
......
359 362
                               old_sdx (fromJust new_s) nl
360 363
    in (new_nl, Instance.setPri inst new_pdx, new_pdx, old_sdx)
361 364

  
365
-- Replace the secondary (r:ns)
362 366
applyMove nl inst (ReplaceSecondary new_sdx) =
363 367
    let old_pdx = Instance.pnode inst
364 368
        old_sdx = Instance.snode inst
......
371 375
                      old_sdx int_s nl
372 376
    in (new_nl, Instance.setSec inst new_sdx, old_pdx, new_sdx)
373 377

  
378
-- Replace the secondary and failover (r:np, f)
374 379
applyMove nl inst (ReplaceAndFailover new_pdx) =
375 380
    let old_pdx = Instance.pnode inst
376 381
        old_sdx = Instance.snode inst

Also available in: Unified diff