Revision 10028866

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 = OpCodes.OpMigrateInstance iname True False True
1046
        opR n = OpCodes.OpReplaceDisks iname (lookNode n)
1045
        opF = OpCodes.OpInstanceMigrate iname True False True
1046
        opR n = OpCodes.OpInstanceReplaceDisks iname (lookNode n)
1047 1047
                OpCodes.ReplaceNewSecondary [] Nothing
1048 1048
    in case move of
1049 1049
         Failover -> [ opF ]
b/htools/Ganeti/HTools/QC.hs
222 222
        "OP_TEST_DELAY" ->
223 223
          liftM3 OpCodes.OpTestDelay arbitrary arbitrary arbitrary
224 224
        "OP_INSTANCE_REPLACE_DISKS" ->
225
          liftM5 OpCodes.OpReplaceDisks arbitrary arbitrary
225
          liftM5 OpCodes.OpInstanceReplaceDisks arbitrary arbitrary
226 226
          arbitrary arbitrary arbitrary
227 227
        "OP_INSTANCE_FAILOVER" ->
228
          liftM2 OpCodes.OpFailoverInstance arbitrary arbitrary
228
          liftM2 OpCodes.OpInstanceFailover arbitrary arbitrary
229 229
        "OP_INSTANCE_MIGRATE" ->
230
          liftM4 OpCodes.OpMigrateInstance arbitrary arbitrary arbitrary
230
          liftM4 OpCodes.OpInstanceMigrate arbitrary arbitrary arbitrary
231 231
          arbitrary
232 232
        _ -> fail "Wrong opcode")
233 233

  
b/htools/Ganeti/OpCodes.hs
56 56
                   _ -> J.Error "Can't parse a valid ReplaceDisksMode"
57 57

  
58 58
data OpCode = OpTestDelay Double Bool [String]
59
            | OpReplaceDisks String (Maybe String) ReplaceDisksMode
59
            | OpInstanceReplaceDisks String (Maybe String) ReplaceDisksMode
60 60
              [Int] (Maybe String)
61
            | OpFailoverInstance String Bool
62
            | OpMigrateInstance String Bool Bool Bool
61
            | OpInstanceFailover String Bool
62
            | OpInstanceMigrate String Bool Bool Bool
63 63
            deriving (Show, Read, Eq)
64 64

  
65 65

  
66 66
opID :: OpCode -> String
67 67
opID (OpTestDelay _ _ _) = "OP_TEST_DELAY"
68
opID (OpReplaceDisks _ _ _ _ _) = "OP_INSTANCE_REPLACE_DISKS"
69
opID (OpFailoverInstance _ _) = "OP_INSTANCE_FAILOVER"
70
opID (OpMigrateInstance _ _ _ _) = "OP_INSTANCE_MIGRATE"
68
opID (OpInstanceReplaceDisks _ _ _ _ _) = "OP_INSTANCE_REPLACE_DISKS"
69
opID (OpInstanceFailover _ _) = "OP_INSTANCE_FAILOVER"
70
opID (OpInstanceMigrate _ _ _ _) = "OP_INSTANCE_MIGRATE"
71 71

  
72 72
loadOpCode :: JSValue -> J.Result OpCode
73 73
loadOpCode v = do
......
86 86
                 mode   <- extract "mode"
87 87
                 disks  <- extract "disks"
88 88
                 ialloc <- maybeFromObj o "iallocator"
89
                 return $ OpReplaceDisks inst node mode disks ialloc
89
                 return $ OpInstanceReplaceDisks inst node mode disks ialloc
90 90
    "OP_INSTANCE_FAILOVER" -> do
91 91
                 inst    <- extract "instance_name"
92 92
                 consist <- extract "ignore_consistency"
93
                 return $ OpFailoverInstance inst consist
93
                 return $ OpInstanceFailover inst consist
94 94
    "OP_INSTANCE_MIGRATE" -> do
95 95
                 inst    <- extract "instance_name"
96 96
                 live    <- extract "live"
97 97
                 cleanup <- extract "cleanup"
98 98
                 allow_failover <- fromObjWithDefault o "allow_failover" False
99
                 return $ OpMigrateInstance inst live cleanup allow_failover
99
                 return $ OpInstanceMigrate inst live cleanup allow_failover
100 100
    _ -> J.Error $ "Unknown opcode " ++ op_id
101 101

  
102 102
saveOpCode :: OpCode -> JSValue
......
107 107
             , ("on_nodes", showJSON on_nodes) ]
108 108
    in makeObj ol
109 109

  
110
saveOpCode op@(OpReplaceDisks inst node mode disks iallocator) =
110
saveOpCode op@(OpInstanceReplaceDisks inst node mode disks iallocator) =
111 111
    let ol = [ ("OP_ID", showJSON $ opID op)
112 112
             , ("instance_name", showJSON inst)
113 113
             , ("mode", showJSON mode)
......
120 120
                Nothing -> ol2
121 121
    in makeObj ol3
122 122

  
123
saveOpCode op@(OpFailoverInstance inst consist) =
123
saveOpCode op@(OpInstanceFailover inst consist) =
124 124
    let ol = [ ("OP_ID", showJSON $ opID op)
125 125
             , ("instance_name", showJSON inst)
126 126
             , ("ignore_consistency", showJSON consist) ]
127 127
    in makeObj ol
128 128

  
129
saveOpCode op@(OpMigrateInstance inst live cleanup allow_failover) =
129
saveOpCode op@(OpInstanceMigrate inst live cleanup allow_failover) =
130 130
    let ol = [ ("OP_ID", showJSON $ opID op)
131 131
             , ("instance_name", showJSON inst)
132 132
             , ("live", showJSON live)

Also available in: Unified diff