Revision 7d421386

b/htest/Test/Ganeti/OpCodes.hs
105 105
    op_id <- elements OpCodes.allOpIDs
106 106
    case op_id of
107 107
      "OP_TEST_DELAY" ->
108
        OpCodes.OpTestDelay <$> arbitrary <*> arbitrary
109
                 <*> genNodeNames <*> arbitrary
108
        OpCodes.OpTestDelay <$> arbitrary <*> arbitrary <*>
109
          genNodeNamesNE <*> arbitrary
110 110
      "OP_INSTANCE_REPLACE_DISKS" ->
111 111
        OpCodes.OpInstanceReplaceDisks <$> genFQDN <*>
112 112
          genMaybe genNodeNameNE <*> arbitrary <*> genDiskIndices <*>
b/htools/Ganeti/OpCodes.hs
51 51
-- in the htools codebase.
52 52
$(genOpCode "OpCode"
53 53
  [ ("OpTestDelay",
54
     [ simpleField "duration"  [t| Double   |]
55
     , simpleField "on_master" [t| Bool     |]
56
     , simpleField "on_nodes"  [t| [String] |]
54
     [ pDelayDuration
55
     , pDelayOnMaster
56
     , pDelayOnNodes
57 57
     , pDelayRepeat
58 58
     ])
59 59
  , ("OpInstanceReplaceDisks",
60 60
     [ pInstanceName
61 61
     , pRemoteNode
62
     , simpleField "mode"  [t| ReplaceDisksMode |]
63
     , simpleField "disks" [t| [DiskIndex] |]
62
     , pReplaceDisksMode
63
     , pReplaceDisksList
64 64
     , pIallocator
65 65
     ])
66 66
  , ("OpInstanceFailover",
67 67
     [ pInstanceName
68
     , simpleField "ignore_consistency" [t| Bool   |]
68
     , pIgnoreConsistency
69 69
     , pMigrationTargetNode
70 70
     ])
71 71
  , ("OpInstanceMigrate",
72 72
     [ pInstanceName
73 73
     , simpleField "live"           [t| Bool   |]
74
     , simpleField "cleanup"        [t| Bool   |]
75
     , defaultField [| False |] $ simpleField "allow_failover" [t| Bool |]
74
     , pMigrationCleanup
75
     , pAllowFailover
76 76
     , pMigrationTargetNode
77 77
     ])
78 78
  , ("OpTagsGet",
b/htools/Ganeti/OpParams.hs
63 63
  , pGroupName
64 64
  , pMigrationMode
65 65
  , pMigrationLive
66
  , pMigrationCleanup
66 67
  , pForceVariant
67 68
  , pWaitForSync
68 69
  , pWaitForSyncFalse
......
189 190
  , pX509DestCA
190 191
  , pTagSearchPattern
191 192
  , pRestrictedCommand
193
  , pReplaceDisksMode
194
  , pReplaceDisksList
195
  , pAllowFailover
196
  , pDelayDuration
197
  , pDelayOnMaster
198
  , pDelayOnNodes
192 199
  , pDelayRepeat
193 200
  , pIAllocatorDirection
194 201
  , pIAllocatorMode
......
560 567
pMigrationLive =
561 568
  renameField "OldLiveMode" . optionalField $ booleanField "live"
562 569

  
570
-- | Migration cleanup parameter.
571
pMigrationCleanup :: Field
572
pMigrationCleanup = renameField "MigrationCleanup" $ defaultFalse "cleanup"
573

  
563 574
-- | Whether to force an unknown OS variant.
564 575
pForceVariant :: Field
565 576
pForceVariant = defaultFalse "force_variant"
......
1161 1172
  renameField "RestrictedCommand" $
1162 1173
  simpleField "command" [t| NonEmptyString |]
1163 1174

  
1175
-- | Replace disks mode.
1176
pReplaceDisksMode :: Field
1177
pReplaceDisksMode =
1178
  renameField "ReplaceDisksMode" $ simpleField "mode" [t| ReplaceDisksMode |]
1179

  
1180
-- | List of disk indices.
1181
pReplaceDisksList :: Field
1182
pReplaceDisksList =
1183
  renameField "ReplaceDisksList" $ simpleField "disks" [t| [DiskIndex] |]
1184

  
1185
-- | Whether do allow failover in migrations.
1186
pAllowFailover :: Field
1187
pAllowFailover = defaultFalse "allow_failover"
1188

  
1164 1189
-- * Test opcode parameters
1165 1190

  
1191
-- | Duration parameter for 'OpTestDelay'.
1192
pDelayDuration :: Field
1193
pDelayDuration =
1194
  renameField "DelayDuration "$ simpleField "duration" [t| Double |]
1195

  
1196
-- | on_master field for 'OpTestDelay'.
1197
pDelayOnMaster :: Field
1198
pDelayOnMaster = renameField "DelayOnMaster" $ defaultTrue "on_master"
1199

  
1200
-- | on_nodes field for 'OpTestDelay'.
1201
pDelayOnNodes :: Field
1202
pDelayOnNodes =
1203
  renameField "DelayOnNodes" .
1204
  defaultField [| [] |] $
1205
  simpleField "on_nodes" [t| [NonEmptyString] |]
1206

  
1166 1207
-- | Repeat parameter for OpTestDelay.
1167 1208
pDelayRepeat :: Field
1168 1209
pDelayRepeat =

Also available in: Unified diff