Revision 3d7d3a1f
b/htools/Ganeti/HTools/IAlloc.hs | ||
---|---|---|
268 | 268 |
processRelocate gl nl il idx 1 exndx = do |
269 | 269 |
let orig = Container.find idx il |
270 | 270 |
sorig = Instance.sNode orig |
271 |
when (exndx /= [sorig]) $ |
|
271 |
porig = Instance.pNode orig |
|
272 |
mir_type = templateMirrorType $ Instance.diskTemplate orig |
|
273 |
(exp_node, node_type, reloc_type) <- |
|
274 |
case mir_type of |
|
275 |
MirrorNone -> fail "Can't relocate non-mirrored instances" |
|
276 |
MirrorInternal -> return (sorig, "secondary", ChangeSecondary) |
|
277 |
MirrorExternal -> return (porig, "primary", ChangePrimary) |
|
278 |
when (exndx /= [exp_node]) $ |
|
272 | 279 |
-- FIXME: we can't use the excluded nodes here; the logic is |
273 | 280 |
-- already _but only partially_ implemented in tryNodeEvac... |
274 | 281 |
fail $ "Unsupported request: excluded nodes not equal to\ |
275 |
\ instance's secondary node (" ++ show sorig ++ " versus " ++
|
|
276 |
show exndx ++ ")" |
|
277 |
(nl', il', esol) <- Cluster.tryNodeEvac gl nl il ChangeSecondary [idx]
|
|
282 |
\ instance's " ++ node_type ++ "(" ++ show exp_node
|
|
283 |
++ " versus " ++ show exndx ++ ")"
|
|
284 |
(nl', il', esol) <- Cluster.tryNodeEvac gl nl il reloc_type [idx]
|
|
278 | 285 |
nodes <- case lookup idx (Cluster.esFailed esol) of |
279 | 286 |
Just msg -> fail msg |
280 | 287 |
Nothing -> |
... | ... | |
286 | 293 |
let inst = Container.find idx il' |
287 | 294 |
pnode = Instance.pNode inst |
288 | 295 |
snode = Instance.sNode inst |
289 |
when (snode == sorig) $ |
|
290 |
fail "Internal error: instance didn't change secondary node?!" |
|
291 |
when (snode == pnode) $ |
|
292 |
fail "Internal error: selected primary as new secondary?!" |
|
293 |
|
|
294 |
nodes' <- if nodes == [pnode, snode] |
|
296 |
nodes' <- |
|
297 |
case mir_type of |
|
298 |
MirrorNone -> fail "Internal error: mirror type none after relocation?!" |
|
299 |
MirrorInternal -> |
|
300 |
do |
|
301 |
when (snode == sorig) $ |
|
302 |
fail "Internal error: instance didn't change secondary node?!" |
|
303 |
when (snode == pnode) $ |
|
304 |
fail "Internal error: selected primary as new secondary?!" |
|
305 |
if nodes == [pnode, snode] |
|
295 | 306 |
then return [snode] -- only the new secondary is needed |
296 | 307 |
else fail $ "Internal error: inconsistent node list (" ++ |
297 | 308 |
show nodes ++ ") versus instance nodes (" ++ show pnode ++ |
298 | 309 |
"," ++ show snode ++ ")" |
310 |
MirrorExternal -> |
|
311 |
do |
|
312 |
when (pnode == porig) $ |
|
313 |
fail "Internal error: instance didn't change primary node?!" |
|
314 |
if nodes == [pnode] |
|
315 |
then return nodes |
|
316 |
else fail $ "Internal error: inconsistent node list (" ++ |
|
317 |
show nodes ++ ") versus instance node (" ++ show pnode ++ ")" |
|
299 | 318 |
return (nl', il', nodes') |
300 | 319 |
|
301 | 320 |
processRelocate _ _ _ _ reqn _ = |
Also available in: Unified diff