Commit 3131adc7 authored by Iustin Pop's avatar Iustin Pop
Browse files

Abstract query common opcode definitions



It would be even better if the opcodes would actually have all the
same definitions, until then we have two sets of definitions.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 5006418e
......@@ -176,7 +176,7 @@ instance Arbitrary OpCodes.OpCode where
genMaybe genName <*> genMaybe genNameNE <*> arbitrary <*>
genMaybe genNameNE <*> arbitrary <*> arbitrary <*> emptyMUD
"OP_NODE_QUERY" ->
OpCodes.OpNodeQuery <$> genFieldsNE <*> arbitrary <*> genNamesNE
OpCodes.OpNodeQuery <$> genFieldsNE <*> genNamesNE <*> arbitrary
"OP_NODE_QUERYVOLS" ->
OpCodes.OpNodeQueryvols <$> arbitrary <*> genNodeNamesNE
"OP_NODE_QUERY_STORAGE" ->
......
......@@ -187,11 +187,7 @@ $(genOpCode "OpCode"
, pVmCapable
, pNdParams
])
, ("OpNodeQuery",
[ pOutputFields
, pUseLocking
, pNames
])
, ("OpNodeQuery", dOldQuery)
, ("OpNodeQueryvols",
[ pOutputFields
, pNodes
......@@ -347,11 +343,7 @@ $(genOpCode "OpCode"
, pNodes
, pIallocator
])
, ("OpInstanceQuery",
[ pOutputFields
, pNames
, pUseLocking
])
, ("OpInstanceQuery", dOldQuery)
, ("OpInstanceQueryData",
[ pUseLocking
, pInstances
......@@ -402,10 +394,7 @@ $(genOpCode "OpCode"
, pForce
, pRequiredNodes
])
, ("OpGroupQuery",
[ pOutputFields
, pNames
])
, ("OpGroupQuery", dOldQueryNoLocking)
, ("OpGroupSetParams",
[ pGroupName
, pNodeGroupAllocPolicy
......@@ -518,10 +507,7 @@ $(genOpCode "OpCode"
, pNetworkName
, pIpConflictsCheck
])
, ("OpNetworkQuery",
[ pOutputFields
, pNames
])
, ("OpNetworkQuery", dOldQueryNoLocking)
, ("OpRestrictedCommand",
[ pUseLocking
, pRequiredNodes
......
......@@ -221,6 +221,8 @@ module Ganeti.OpParams
, pNetworkRemoveRsvdIps
, pNetworkMode
, pNetworkLink
, dOldQuery
, dOldQueryNoLocking
) where
import Control.Monad (liftM)
......@@ -1342,3 +1344,20 @@ pNetworkMode = simpleField "network_mode" [t| NICMode |]
-- | Network link when connecting to a group.
pNetworkLink :: Field
pNetworkLink = simpleField "network_link" [t| NonEmptyString |]
-- * Entire opcode parameter list
-- | Old-style query opcode, with locking.
dOldQuery :: [Field]
dOldQuery =
[ pOutputFields
, pNames
, pUseLocking
]
-- | Old-style query opcode, without locking.
dOldQueryNoLocking :: [Field]
dOldQueryNoLocking =
[ pOutputFields
, pNames
]
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