Revision 3bebda52
b/htest/Test/Ganeti/OpCodes.hs | ||
---|---|---|
71 | 71 |
"OP_INSTANCE_MIGRATE" -> |
72 | 72 |
OpCodes.OpInstanceMigrate <$> getFQDN <*> arbitrary <*> |
73 | 73 |
arbitrary <*> arbitrary <*> getMaybe getFQDN |
74 |
"OP_TAGS_SET" -> |
|
75 |
OpCodes.OpTagsSet <$> arbitrary <*> genTags <*> getMaybe getFQDN |
|
76 |
"OP_TAGS_DEL" -> |
|
77 |
OpCodes.OpTagsSet <$> arbitrary <*> genTags <*> getMaybe getFQDN |
|
74 | 78 |
_ -> fail "Wrong opcode" |
75 | 79 |
|
76 | 80 |
-- * Test cases |
b/htools/Ganeti/OpCodes.hs | ||
---|---|---|
79 | 79 |
|
80 | 80 |
-- | OpCode representation. |
81 | 81 |
-- |
82 |
-- We only implement a subset of Ganeti opcodes, but only what we
|
|
83 |
-- actually use in the htools codebase.
|
|
82 |
-- We only implement a subset of Ganeti opcodes: those which are actually used
|
|
83 |
-- in the htools codebase. |
|
84 | 84 |
$(genOpCode "OpCode" |
85 | 85 |
[ ("OpTestDelay", |
86 | 86 |
[ simpleField "duration" [t| Double |] |
... | ... | |
106 | 106 |
, defaultField [| False |] $ simpleField "allow_failover" [t| Bool |] |
107 | 107 |
, optionalField $ simpleField "target_node" [t| String |] |
108 | 108 |
]) |
109 |
, ("OpTagsSet", |
|
110 |
[ simpleField "kind" [t| TagObject |] |
|
111 |
, simpleField "tags" [t| [String] |] |
|
112 |
, optionalNullSerField $ simpleField "name" [t| String |] |
|
113 |
]) |
|
114 |
, ("OpTagsDel", |
|
115 |
[ simpleField "kind" [t| TagObject |] |
|
116 |
, simpleField "tags" [t| [String] |] |
|
117 |
, optionalNullSerField $ simpleField "name" [t| String |] |
|
118 |
]) |
|
109 | 119 |
]) |
110 | 120 |
|
111 | 121 |
-- | Returns the OP_ID for a given opcode value. |
Also available in: Unified diff