Revision 8d66f58a htools/Ganeti/OpCodes.hs
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