Commit 7d421386 authored by Iustin Pop's avatar Iustin Pop
Browse files

Remove remaining in-line parameters



… except one, and replace them with separately-defined ones in
OpParams.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 3131adc7
......@@ -105,8 +105,8 @@ instance Arbitrary OpCodes.OpCode where
op_id <- elements OpCodes.allOpIDs
case op_id of
"OP_TEST_DELAY" ->
OpCodes.OpTestDelay <$> arbitrary <*> arbitrary
<*> genNodeNames <*> arbitrary
OpCodes.OpTestDelay <$> arbitrary <*> arbitrary <*>
genNodeNamesNE <*> arbitrary
"OP_INSTANCE_REPLACE_DISKS" ->
OpCodes.OpInstanceReplaceDisks <$> genFQDN <*>
genMaybe genNodeNameNE <*> arbitrary <*> genDiskIndices <*>
......
......@@ -51,28 +51,28 @@ import Ganeti.OpParams
-- in the htools codebase.
$(genOpCode "OpCode"
[ ("OpTestDelay",
[ simpleField "duration" [t| Double |]
, simpleField "on_master" [t| Bool |]
, simpleField "on_nodes" [t| [String] |]
[ pDelayDuration
, pDelayOnMaster
, pDelayOnNodes
, pDelayRepeat
])
, ("OpInstanceReplaceDisks",
[ pInstanceName
, pRemoteNode
, simpleField "mode" [t| ReplaceDisksMode |]
, simpleField "disks" [t| [DiskIndex] |]
, pReplaceDisksMode
, pReplaceDisksList
, pIallocator
])
, ("OpInstanceFailover",
[ pInstanceName
, simpleField "ignore_consistency" [t| Bool |]
, pIgnoreConsistency
, pMigrationTargetNode
])
, ("OpInstanceMigrate",
[ pInstanceName
, simpleField "live" [t| Bool |]
, simpleField "cleanup" [t| Bool |]
, defaultField [| False |] $ simpleField "allow_failover" [t| Bool |]
, pMigrationCleanup
, pAllowFailover
, pMigrationTargetNode
])
, ("OpTagsGet",
......
......@@ -63,6 +63,7 @@ module Ganeti.OpParams
, pGroupName
, pMigrationMode
, pMigrationLive
, pMigrationCleanup
, pForceVariant
, pWaitForSync
, pWaitForSyncFalse
......@@ -189,6 +190,12 @@ module Ganeti.OpParams
, pX509DestCA
, pTagSearchPattern
, pRestrictedCommand
, pReplaceDisksMode
, pReplaceDisksList
, pAllowFailover
, pDelayDuration
, pDelayOnMaster
, pDelayOnNodes
, pDelayRepeat
, pIAllocatorDirection
, pIAllocatorMode
......@@ -560,6 +567,10 @@ pMigrationLive :: Field
pMigrationLive =
renameField "OldLiveMode" . optionalField $ booleanField "live"
-- | Migration cleanup parameter.
pMigrationCleanup :: Field
pMigrationCleanup = renameField "MigrationCleanup" $ defaultFalse "cleanup"
-- | Whether to force an unknown OS variant.
pForceVariant :: Field
pForceVariant = defaultFalse "force_variant"
......@@ -1161,8 +1172,38 @@ pRestrictedCommand =
renameField "RestrictedCommand" $
simpleField "command" [t| NonEmptyString |]
-- | Replace disks mode.
pReplaceDisksMode :: Field
pReplaceDisksMode =
renameField "ReplaceDisksMode" $ simpleField "mode" [t| ReplaceDisksMode |]
-- | List of disk indices.
pReplaceDisksList :: Field
pReplaceDisksList =
renameField "ReplaceDisksList" $ simpleField "disks" [t| [DiskIndex] |]
-- | Whether do allow failover in migrations.
pAllowFailover :: Field
pAllowFailover = defaultFalse "allow_failover"
-- * Test opcode parameters
-- | Duration parameter for 'OpTestDelay'.
pDelayDuration :: Field
pDelayDuration =
renameField "DelayDuration "$ simpleField "duration" [t| Double |]
-- | on_master field for 'OpTestDelay'.
pDelayOnMaster :: Field
pDelayOnMaster = renameField "DelayOnMaster" $ defaultTrue "on_master"
-- | on_nodes field for 'OpTestDelay'.
pDelayOnNodes :: Field
pDelayOnNodes =
renameField "DelayOnNodes" .
defaultField [| [] |] $
simpleField "on_nodes" [t| [NonEmptyString] |]
-- | Repeat parameter for OpTestDelay.
pDelayRepeat :: Field
pDelayRepeat =
......
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