Commit a451dae2 authored by Iustin Pop's avatar Iustin Pop
Browse files

Complete the Tag opcodes and fix OpTestDelay missing param



The regexp in OpTagsSearch is loaded as is, without testing for
validity; the rest of the patch is trivial.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 398e9066
......@@ -105,7 +105,7 @@ instance Arbitrary OpCodes.OpCode where
case op_id of
"OP_TEST_DELAY" ->
OpCodes.OpTestDelay <$> arbitrary <*> arbitrary
<*> genNodeNames
<*> genNodeNames <*> arbitrary
"OP_INSTANCE_REPLACE_DISKS" ->
OpCodes.OpInstanceReplaceDisks <$> getFQDN <*>
getMaybe genNodeNameNE <*> arbitrary <*> genDiskIndices <*>
......@@ -116,6 +116,10 @@ instance Arbitrary OpCodes.OpCode where
"OP_INSTANCE_MIGRATE" ->
OpCodes.OpInstanceMigrate <$> getFQDN <*> arbitrary <*>
arbitrary <*> arbitrary <*> getMaybe genNodeNameNE
"OP_TAGS_GET" ->
OpCodes.OpTagsGet <$> arbitrary <*> arbitrary
"OP_TAGS_SEARCH" ->
OpCodes.OpTagsSearch <$> genNameNE
"OP_TAGS_SET" ->
OpCodes.OpTagsSet <$> arbitrary <*> genTags
"OP_TAGS_DEL" ->
......
......@@ -54,6 +54,7 @@ $(genOpCode "OpCode"
[ simpleField "duration" [t| Double |]
, simpleField "on_master" [t| Bool |]
, simpleField "on_nodes" [t| [String] |]
, pDelayRepeat
])
, ("OpInstanceReplaceDisks",
[ pInstanceName
......@@ -74,6 +75,12 @@ $(genOpCode "OpCode"
, defaultField [| False |] $ simpleField "allow_failover" [t| Bool |]
, pMigrationTargetNode
])
, ("OpTagsGet",
[ pTagsObject
, pUseLocking
])
, ("OpTagsSearch",
[ pTagSearchPattern ])
, ("OpTagsSet",
[ pTagsObject
, pTagsList
......
......@@ -187,6 +187,8 @@ module Ganeti.OpParams
, pIgnoreRemoveFailures
, pX509KeyName
, pX509DestCA
, pTagSearchPattern
, pDelayRepeat
) where
import Control.Monad (liftM)
......@@ -1112,3 +1114,16 @@ pX509KeyName = optionalField $ simpleField "x509_key_name" [t| UncheckedList |]
-- | Destination X509 CA (remote export only).
pX509DestCA :: Field
pX509DestCA = optionalNEStringField "destination_x509_ca"
-- | Search pattern (regular expression). FIXME: this should be
-- compiled at load time?
pTagSearchPattern :: Field
pTagSearchPattern =
renameField "TagSearchPattern" $ simpleField "pattern" [t| NonEmptyString |]
-- | Repeat parameter for OpTestDelay.
pDelayRepeat :: Field
pDelayRepeat =
renameField "DelayRepeat" .
defaultField [| forceNonNeg (0::Int) |] $
simpleField "repeat" [t| NonNegative Int |]
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