Revision 8d66f58a
b/htools/Ganeti/HTools/Cluster.hs | ||
---|---|---|
1042 | 1042 |
let inst = Container.find idx il |
1043 | 1043 |
iname = Instance.name inst |
1044 | 1044 |
lookNode = Just . Container.nameOf nl |
1045 |
opF = if Instance.running inst |
|
1046 |
then OpCodes.OpMigrateInstance iname True False |
|
1047 |
else OpCodes.OpFailoverInstance iname False |
|
1045 |
opF = OpCodes.OpMigrateInstance iname True False True |
|
1048 | 1046 |
opR n = OpCodes.OpReplaceDisks iname (lookNode n) |
1049 | 1047 |
OpCodes.ReplaceNewSecondary [] Nothing |
1050 | 1048 |
in case move of |
b/htools/Ganeti/HTools/QC.hs | ||
---|---|---|
227 | 227 |
"OP_INSTANCE_FAILOVER" -> |
228 | 228 |
liftM2 OpCodes.OpFailoverInstance arbitrary arbitrary |
229 | 229 |
"OP_INSTANCE_MIGRATE" -> |
230 |
liftM3 OpCodes.OpMigrateInstance arbitrary arbitrary arbitrary |
|
230 |
liftM4 OpCodes.OpMigrateInstance arbitrary arbitrary arbitrary |
|
231 |
arbitrary |
|
231 | 232 |
_ -> fail "Wrong opcode") |
232 | 233 |
|
233 | 234 |
instance Arbitrary Jobs.OpStatus where |
b/htools/Ganeti/OpCodes.hs | ||
---|---|---|
59 | 59 |
| OpReplaceDisks String (Maybe String) ReplaceDisksMode |
60 | 60 |
[Int] (Maybe String) |
61 | 61 |
| OpFailoverInstance String Bool |
62 |
| OpMigrateInstance String Bool Bool |
|
62 |
| OpMigrateInstance String Bool Bool Bool
|
|
63 | 63 |
deriving (Show, Read, Eq) |
64 | 64 |
|
65 | 65 |
|
... | ... | |
67 | 67 |
opID (OpTestDelay _ _ _) = "OP_TEST_DELAY" |
68 | 68 |
opID (OpReplaceDisks _ _ _ _ _) = "OP_INSTANCE_REPLACE_DISKS" |
69 | 69 |
opID (OpFailoverInstance _ _) = "OP_INSTANCE_FAILOVER" |
70 |
opID (OpMigrateInstance _ _ _) = "OP_INSTANCE_MIGRATE" |
|
70 |
opID (OpMigrateInstance _ _ _ _) = "OP_INSTANCE_MIGRATE"
|
|
71 | 71 |
|
72 | 72 |
loadOpCode :: JSValue -> J.Result OpCode |
73 | 73 |
loadOpCode v = do |
... | ... | |
95 | 95 |
inst <- extract "instance_name" |
96 | 96 |
live <- extract "live" |
97 | 97 |
cleanup <- extract "cleanup" |
98 |
return $ OpMigrateInstance inst live cleanup |
|
98 |
allow_failover <- extract "allow_failover" |
|
99 |
return $ OpMigrateInstance inst live cleanup allow_failover |
|
99 | 100 |
_ -> J.Error $ "Unknown opcode " ++ op_id |
100 | 101 |
|
101 | 102 |
saveOpCode :: OpCode -> JSValue |
... | ... | |
125 | 126 |
, ("ignore_consistency", showJSON consist) ] |
126 | 127 |
in makeObj ol |
127 | 128 |
|
128 |
saveOpCode op@(OpMigrateInstance inst live cleanup) = |
|
129 |
saveOpCode op@(OpMigrateInstance inst live cleanup allow_failover) =
|
|
129 | 130 |
let ol = [ ("OP_ID", showJSON $ opID op) |
130 | 131 |
, ("instance_name", showJSON inst) |
131 | 132 |
, ("live", showJSON live) |
132 |
, ("cleanup", showJSON cleanup) ] |
|
133 |
, ("cleanup", showJSON cleanup) |
|
134 |
, ("allow_failover", showJSON allow_failover) ] |
|
133 | 135 |
in makeObj ol |
134 | 136 |
|
135 | 137 |
instance JSON OpCode where |
Also available in: Unified diff