Commit 1cd563e2 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add two last missing opcodes



OpInstanceQuery was missing accidentally, whereas OpRestrictedCommand
was just recently added without Haskell definitions.

The patch also slightly improves the OpNodeQuery arbitrary generation.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 8d239fa4
......@@ -177,7 +177,7 @@ instance Arbitrary OpCodes.OpCode where
getMaybe getName <*> getMaybe genNameNE <*> arbitrary <*>
getMaybe genNameNE <*> arbitrary <*> arbitrary <*> emptyMUD
"OP_NODE_QUERY" ->
OpCodes.OpNodeQuery <$> arbitrary <*> arbitrary <*> arbitrary
OpCodes.OpNodeQuery <$> genFieldsNE <*> arbitrary <*> genNamesNE
"OP_NODE_QUERYVOLS" ->
OpCodes.OpNodeQueryvols <$> arbitrary <*> genNodeNamesNE
"OP_NODE_QUERY_STORAGE" ->
......@@ -248,6 +248,8 @@ instance Arbitrary OpCodes.OpCode where
"OP_INSTANCE_RECREATE_DISKS" ->
OpCodes.OpInstanceRecreateDisks <$> getFQDN <*> arbitrary <*>
genNodeNamesNE <*> getMaybe genNameNE
"OP_INSTANCE_QUERY" ->
OpCodes.OpInstanceQuery <$> genFieldsNE <*> genNamesNE <*> arbitrary
"OP_INSTANCE_QUERY_DATA" ->
OpCodes.OpInstanceQueryData <$> arbitrary <*>
genNodeNamesNE <*> arbitrary
......@@ -328,6 +330,9 @@ instance Arbitrary OpCodes.OpCode where
OpCodes.OpNetworkDisconnect <$> genNameNE <*> genNameNE <*> arbitrary
"OP_NETWORK_QUERY" ->
OpCodes.OpNetworkQuery <$> genFieldsNE <*> genNamesNE
"OP_RESTRICTED_COMMAND" ->
OpCodes.OpRestrictedCommand <$> arbitrary <*> genNodeNamesNE <*>
genNameNE
_ -> fail $ "Undefined arbitrary for opcode " ++ op_id
-- * Helper functions
......
......@@ -347,6 +347,11 @@ $(genOpCode "OpCode"
, pNodes
, pIallocator
])
, ("OpInstanceQuery",
[ pOutputFields
, pNames
, pUseLocking
])
, ("OpInstanceQueryData",
[ pUseLocking
, pInstances
......@@ -517,6 +522,11 @@ $(genOpCode "OpCode"
[ pOutputFields
, pNames
])
, ("OpRestrictedCommand",
[ pUseLocking
, pRequiredNodes
, pRestrictedCommand
])
])
-- | Returns the OP_ID for a given opcode value.
......
......@@ -188,6 +188,7 @@ module Ganeti.OpParams
, pX509KeyName
, pX509DestCA
, pTagSearchPattern
, pRestrictedCommand
, pDelayRepeat
, pIAllocatorDirection
, pIAllocatorMode
......@@ -1152,6 +1153,12 @@ pTagSearchPattern :: Field
pTagSearchPattern =
renameField "TagSearchPattern" $ simpleField "pattern" [t| NonEmptyString |]
-- | Restricted command name.
pRestrictedCommand :: Field
pRestrictedCommand =
renameField "RestrictedCommand" $
simpleField "command" [t| NonEmptyString |]
-- * Test opcode parameters
-- | Repeat parameter for OpTestDelay.
......
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