diff --git a/htest/Test/Ganeti/OpCodes.hs b/htest/Test/Ganeti/OpCodes.hs index c690b07d59931d6879ab35696550e00b38b85164..61ffd4abed455f560be05996801e2db7d937c03f 100644 --- a/htest/Test/Ganeti/OpCodes.hs +++ b/htest/Test/Ganeti/OpCodes.hs @@ -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" -> diff --git a/htools/Ganeti/OpCodes.hs b/htools/Ganeti/OpCodes.hs index 8d08632cc3519dd582e9c1f8f8730c5264b20ea7..151b5e93878f87282430204b65e65516c05c3f0f 100644 --- a/htools/Ganeti/OpCodes.hs +++ b/htools/Ganeti/OpCodes.hs @@ -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 diff --git a/htools/Ganeti/OpParams.hs b/htools/Ganeti/OpParams.hs index 955599c26539df43c7d4b101079a81e77dac6dcd..4039c892581d6a14f20260ebab0aff2b95231e82 100644 --- a/htools/Ganeti/OpParams.hs +++ b/htools/Ganeti/OpParams.hs @@ -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 |]