Revision fafd0773
b/htools/Ganeti/HTools/Cluster.hs | ||
---|---|---|
563 | 563 |
osdx = Instance.sNode target |
564 | 564 |
bad_nodes = [opdx, osdx] |
565 | 565 |
nodes = filter (`notElem` bad_nodes) nodes_idx |
566 |
mir_type = templateMirrorType $ Instance.diskTemplate target
|
|
566 |
mir_type = Instance.mirrorType target
|
|
567 | 567 |
use_secondary = elem osdx nodes_idx && inst_moves |
568 | 568 |
aft_failover = if mir_type == MirrorInternal && use_secondary |
569 | 569 |
-- if drbd and allowed to failover |
... | ... | |
970 | 970 |
-- for allocation |
971 | 971 |
-> Result (Node.List, Instance.List, [OpCodes.OpCode]) |
972 | 972 |
evacOneNodeOnly nl il inst gdx avail_nodes = do |
973 |
op_fn <- case templateMirrorType (Instance.diskTemplate inst) of
|
|
973 |
op_fn <- case Instance.mirrorType inst of
|
|
974 | 974 |
MirrorNone -> Bad "Can't relocate/evacuate non-mirrored instances" |
975 | 975 |
MirrorInternal -> Ok ReplaceSecondary |
976 | 976 |
MirrorExternal -> Ok FailoverToAny |
b/htools/Ganeti/HTools/IAlloc.hs | ||
---|---|---|
270 | 270 |
let orig = Container.find idx il |
271 | 271 |
sorig = Instance.sNode orig |
272 | 272 |
porig = Instance.pNode orig |
273 |
mir_type = templateMirrorType $ Instance.diskTemplate orig
|
|
273 |
mir_type = Instance.mirrorType orig
|
|
274 | 274 |
(exp_node, node_type, reloc_type) <- |
275 | 275 |
case mir_type of |
276 | 276 |
MirrorNone -> fail "Can't relocate non-mirrored instances" |
b/htools/Ganeti/HTools/Instance.hs | ||
---|---|---|
54 | 54 |
, requiredNodes |
55 | 55 |
, allNodes |
56 | 56 |
, usesLocalStorage |
57 |
, mirrorType |
|
57 | 58 |
) where |
58 | 59 |
|
59 | 60 |
import qualified Ganeti.HTools.Types as T |
... | ... | |
304 | 305 |
-- | Checks whether a given disk template supported moves. |
305 | 306 |
supportsMoves :: T.DiskTemplate -> Bool |
306 | 307 |
supportsMoves = (`elem` movableDiskTemplates) |
308 |
|
|
309 |
-- | A simple wrapper over 'T.templateMirrorType'. |
|
310 |
mirrorType :: Instance -> T.MirrorType |
|
311 |
mirrorType = T.templateMirrorType . diskTemplate |
b/htools/Ganeti/HTools/QC.hs | ||
---|---|---|
237 | 237 |
|
238 | 238 |
-- | Checks if an instance is mirrored. |
239 | 239 |
isMirrored :: Instance.Instance -> Bool |
240 |
isMirrored = |
|
241 |
(/= Types.MirrorNone) . Types.templateMirrorType . Instance.diskTemplate |
|
240 |
isMirrored = (/= Types.MirrorNone) . Instance.mirrorType |
|
242 | 241 |
|
243 | 242 |
-- | Returns the possible change node types for a disk template. |
244 | 243 |
evacModeOptions :: Types.MirrorType -> [Types.EvacMode] |
... | ... | |
1297 | 1296 |
conjoin $ map (\mode -> check_EvacMode defGroup inst' $ |
1298 | 1297 |
Cluster.tryNodeEvac defGroupList nl il mode |
1299 | 1298 |
[Instance.idx inst']) . |
1300 |
evacModeOptions . Types.templateMirrorType .
|
|
1301 |
Instance.diskTemplate $ inst'
|
|
1299 |
evacModeOptions . |
|
1300 |
Instance.mirrorType $ inst'
|
|
1302 | 1301 |
|
1303 | 1302 |
-- | Checks that on a 4-8 node cluster with two node groups, once we |
1304 | 1303 |
-- allocate an instance on the first node group, we can also change |
Also available in: Unified diff