Revision 2cae47e9 Ganeti/HTools/Cluster.hs

b/Ganeti/HTools/Cluster.hs
289 289
        old_s = Container.find old_sdx nl
290 290
        int_p = Node.removePri old_p inst
291 291
        int_s = Node.removeSec old_s inst
292
        force_p = Node.offline old_p
292 293
        new_nl = do -- Maybe monad
293
          new_p <- Node.addPri int_s inst
294
          new_p <- Node.addPriEx force_p int_s inst
294 295
          new_s <- Node.addSec int_p inst old_sdx
295 296
          let new_inst = Instance.setBoth inst old_sdx old_pdx
296 297
          return (Container.addTwo old_pdx new_s old_sdx new_p nl,
......
306 307
        tgt_n = Container.find new_pdx nl
307 308
        int_p = Node.removePri old_p inst
308 309
        int_s = Node.removeSec old_s inst
310
        force_p = Node.offline old_p
309 311
        new_nl = do -- Maybe monad
310 312
          -- check that the current secondary can host the instance
311 313
          -- during the migration
312
          tmp_s <- Node.addPri int_s inst
314
          tmp_s <- Node.addPriEx force_p int_s inst
313 315
          let tmp_s' = Node.removePri tmp_s inst
314
          new_p <- Node.addPri tgt_n inst
315
          new_s <- Node.addSec tmp_s' inst new_pdx
316
          new_p <- Node.addPriEx force_p tgt_n inst
317
          new_s <- Node.addSecEx force_p tmp_s' inst new_pdx
316 318
          let new_inst = Instance.setPri inst new_pdx
317 319
          return (Container.add new_pdx new_p $
318 320
                  Container.addTwo old_pdx int_p old_sdx new_s nl,
......
326 328
        old_s = Container.find old_sdx nl
327 329
        tgt_n = Container.find new_sdx nl
328 330
        int_s = Node.removeSec old_s inst
331
        force_s = Node.offline old_s
329 332
        new_inst = Instance.setSec inst new_sdx
330
        new_nl = Node.addSec tgt_n inst old_pdx >>=
333
        new_nl = Node.addSecEx force_s tgt_n inst old_pdx >>=
331 334
                 \new_s -> return (Container.addTwo new_sdx
332 335
                                   new_s old_sdx int_s nl,
333 336
                                   new_inst, old_pdx, new_sdx)
......
342 345
        tgt_n = Container.find new_pdx nl
343 346
        int_p = Node.removePri old_p inst
344 347
        int_s = Node.removeSec old_s inst
348
        force_s = Node.offline old_s
345 349
        new_nl = do -- Maybe monad
346 350
          new_p <- Node.addPri tgt_n inst
347
          new_s <- Node.addSec int_p inst new_pdx
351
          new_s <- Node.addSecEx force_s int_p inst new_pdx
348 352
          let new_inst = Instance.setBoth inst new_pdx old_pdx
349 353
          return (Container.add new_pdx new_p $
350 354
                  Container.addTwo old_pdx new_s old_sdx int_s nl,
......
360 364
        tgt_n = Container.find new_sdx nl
361 365
        int_p = Node.removePri old_p inst
362 366
        int_s = Node.removeSec old_s inst
367
        force_p = Node.offline old_p
363 368
        new_nl = do -- Maybe monad
364
          new_p <- Node.addPri int_s inst
365
          new_s <- Node.addSec tgt_n inst old_sdx
369
          new_p <- Node.addPriEx force_p int_s inst
370
          new_s <- Node.addSecEx force_p tgt_n inst old_sdx
366 371
          let new_inst = Instance.setBoth inst old_sdx new_sdx
367 372
          return (Container.add new_sdx new_s $
368 373
                  Container.addTwo old_sdx new_p old_pdx int_p nl,

Also available in: Unified diff