Commit 3bebda52 authored by Dato Simó's avatar Dato Simó Committed by Iustin Pop

OpCodes.hs: add OpTagsSet and OpTagsDel

Also, adjust comment to $(genOpCode) block to avoid repetition of
"only".
Signed-off-by: default avatarDato Simó <dato@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 367c4241
......@@ -71,6 +71,10 @@ instance Arbitrary OpCodes.OpCode where
"OP_INSTANCE_MIGRATE" ->
OpCodes.OpInstanceMigrate <$> getFQDN <*> arbitrary <*>
arbitrary <*> arbitrary <*> getMaybe getFQDN
"OP_TAGS_SET" ->
OpCodes.OpTagsSet <$> arbitrary <*> genTags <*> getMaybe getFQDN
"OP_TAGS_DEL" ->
OpCodes.OpTagsSet <$> arbitrary <*> genTags <*> getMaybe getFQDN
_ -> fail "Wrong opcode"
-- * Test cases
......
......@@ -79,8 +79,8 @@ instance JSON DiskIndex where
-- | OpCode representation.
--
-- We only implement a subset of Ganeti opcodes, but only what we
-- actually use in the htools codebase.
-- We only implement a subset of Ganeti opcodes: those which are actually used
-- in the htools codebase.
$(genOpCode "OpCode"
[ ("OpTestDelay",
[ simpleField "duration" [t| Double |]
......@@ -106,6 +106,16 @@ $(genOpCode "OpCode"
, defaultField [| False |] $ simpleField "allow_failover" [t| Bool |]
, optionalField $ simpleField "target_node" [t| String |]
])
, ("OpTagsSet",
[ simpleField "kind" [t| TagObject |]
, simpleField "tags" [t| [String] |]
, optionalNullSerField $ simpleField "name" [t| String |]
])
, ("OpTagsDel",
[ simpleField "kind" [t| TagObject |]
, simpleField "tags" [t| [String] |]
, optionalNullSerField $ simpleField "name" [t| String |]
])
])
-- | Returns the OP_ID for a given opcode value.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment