Revision a3f02317 htools/Ganeti/OpParams.hs
b/htools/Ganeti/OpParams.hs | ||
---|---|---|
189 | 189 |
, pX509DestCA |
190 | 190 |
, pTagSearchPattern |
191 | 191 |
, pDelayRepeat |
192 |
, pIAllocatorDirection |
|
193 |
, pIAllocatorMode |
|
194 |
, pIAllocatorReqName |
|
195 |
, pIAllocatorNics |
|
196 |
, pIAllocatorDisks |
|
197 |
, pIAllocatorMemory |
|
198 |
, pIAllocatorVCpus |
|
199 |
, pIAllocatorOs |
|
200 |
, pIAllocatorInstances |
|
201 |
, pIAllocatorEvacMode |
|
202 |
, pIAllocatorSpindleUse |
|
203 |
, pIAllocatorCount |
|
204 |
, pJQueueNotifyWaitLock |
|
205 |
, pJQueueNotifyExec |
|
206 |
, pJQueueLogMessages |
|
207 |
, pJQueueFail |
|
208 |
, pTestDummyResult |
|
209 |
, pTestDummyMessages |
|
210 |
, pTestDummyFail |
|
211 |
, pTestDummySubmitJobs |
|
192 | 212 |
) where |
193 | 213 |
|
194 | 214 |
import Control.Monad (liftM) |
... | ... | |
233 | 253 |
optionalNEStringField :: String -> Field |
234 | 254 |
optionalNEStringField = optionalField . flip simpleField [t| NonEmptyString |] |
235 | 255 |
|
236 |
--- | Unchecked value, should be replaced by a better definition.
|
|
237 |
--- type UncheckedValue = JSValue
|
|
256 |
-- | Unchecked value, should be replaced by a better definition. |
|
257 |
type UncheckedValue = JSValue |
|
238 | 258 |
|
239 | 259 |
-- | Unchecked dict, should be replaced by a better definition. |
240 | 260 |
type UncheckedDict = JSObject JSValue |
... | ... | |
1121 | 1141 |
pTagSearchPattern = |
1122 | 1142 |
renameField "TagSearchPattern" $ simpleField "pattern" [t| NonEmptyString |] |
1123 | 1143 |
|
1144 |
-- * Test opcode parameters |
|
1145 |
|
|
1124 | 1146 |
-- | Repeat parameter for OpTestDelay. |
1125 | 1147 |
pDelayRepeat :: Field |
1126 | 1148 |
pDelayRepeat = |
1127 | 1149 |
renameField "DelayRepeat" . |
1128 | 1150 |
defaultField [| forceNonNeg (0::Int) |] $ |
1129 | 1151 |
simpleField "repeat" [t| NonNegative Int |] |
1152 |
|
|
1153 |
-- | IAllocator test direction. |
|
1154 |
pIAllocatorDirection :: Field |
|
1155 |
pIAllocatorDirection = |
|
1156 |
renameField "IAllocatorDirection" $ |
|
1157 |
simpleField "direction" [t| IAllocatorTestDir |] |
|
1158 |
|
|
1159 |
-- | IAllocator test mode. |
|
1160 |
pIAllocatorMode :: Field |
|
1161 |
pIAllocatorMode = |
|
1162 |
renameField "IAllocatorMode" $ |
|
1163 |
simpleField "mode" [t| IAllocatorMode |] |
|
1164 |
|
|
1165 |
-- | IAllocator target name (new instance, node to evac, etc.). |
|
1166 |
pIAllocatorReqName :: Field |
|
1167 |
pIAllocatorReqName = |
|
1168 |
renameField "IAllocatorReqName" $ simpleField "name" [t| NonEmptyString |] |
|
1169 |
|
|
1170 |
-- | Custom OpTestIAllocator nics. |
|
1171 |
pIAllocatorNics :: Field |
|
1172 |
pIAllocatorNics = |
|
1173 |
renameField "IAllocatorNics" $ simpleField "nics" [t| [UncheckedDict] |] |
|
1174 |
|
|
1175 |
-- | Custom OpTestAllocator disks. |
|
1176 |
pIAllocatorDisks :: Field |
|
1177 |
pIAllocatorDisks = |
|
1178 |
renameField "IAllocatorDisks" $ simpleField "disks" [t| UncheckedList |] |
|
1179 |
|
|
1180 |
-- | IAllocator memory field. |
|
1181 |
pIAllocatorMemory :: Field |
|
1182 |
pIAllocatorMemory = |
|
1183 |
renameField "IAllocatorMem" . |
|
1184 |
optionalField $ |
|
1185 |
simpleField "memory" [t| NonNegative Int |] |
|
1186 |
|
|
1187 |
-- | IAllocator vcpus field. |
|
1188 |
pIAllocatorVCpus :: Field |
|
1189 |
pIAllocatorVCpus = |
|
1190 |
renameField "IAllocatorVCpus" . |
|
1191 |
optionalField $ |
|
1192 |
simpleField "vcpus" [t| NonNegative Int |] |
|
1193 |
|
|
1194 |
-- | IAllocator os field. |
|
1195 |
pIAllocatorOs :: Field |
|
1196 |
pIAllocatorOs = renameField "IAllocatorOs" $ optionalNEStringField "os" |
|
1197 |
|
|
1198 |
-- | IAllocator instances field. |
|
1199 |
pIAllocatorInstances :: Field |
|
1200 |
pIAllocatorInstances = |
|
1201 |
renameField "IAllocatorInstances " . |
|
1202 |
optionalField $ |
|
1203 |
simpleField "instances" [t| [NonEmptyString] |] |
|
1204 |
|
|
1205 |
-- | IAllocator evac mode. |
|
1206 |
pIAllocatorEvacMode :: Field |
|
1207 |
pIAllocatorEvacMode = |
|
1208 |
renameField "IAllocatorEvacMode" . |
|
1209 |
optionalField $ |
|
1210 |
simpleField "evac_mode" [t| NodeEvacMode |] |
|
1211 |
|
|
1212 |
-- | IAllocator spindle use. |
|
1213 |
pIAllocatorSpindleUse :: Field |
|
1214 |
pIAllocatorSpindleUse = |
|
1215 |
renameField "IAllocatorSpindleUse" . |
|
1216 |
defaultField [| forceNonNeg (1::Int) |] $ |
|
1217 |
simpleField "spindle_use" [t| NonNegative Int |] |
|
1218 |
|
|
1219 |
-- | IAllocator count field. |
|
1220 |
pIAllocatorCount :: Field |
|
1221 |
pIAllocatorCount = |
|
1222 |
renameField "IAllocatorCount" . |
|
1223 |
defaultField [| forceNonNeg (1::Int) |] $ |
|
1224 |
simpleField "count" [t| NonNegative Int |] |
|
1225 |
|
|
1226 |
-- | 'OpTestJqueue' notify_waitlock. |
|
1227 |
pJQueueNotifyWaitLock :: Field |
|
1228 |
pJQueueNotifyWaitLock = defaultFalse "notify_waitlock" |
|
1229 |
|
|
1230 |
-- | 'OpTestJQueue' notify_exec. |
|
1231 |
pJQueueNotifyExec :: Field |
|
1232 |
pJQueueNotifyExec = defaultFalse "notify_exec" |
|
1233 |
|
|
1234 |
-- | 'OpTestJQueue' log_messages. |
|
1235 |
pJQueueLogMessages :: Field |
|
1236 |
pJQueueLogMessages = |
|
1237 |
defaultField [| [] |] $ simpleField "log_messages" [t| [String] |] |
|
1238 |
|
|
1239 |
-- | 'OpTestJQueue' fail attribute. |
|
1240 |
pJQueueFail :: Field |
|
1241 |
pJQueueFail = |
|
1242 |
renameField "JQueueFail" $ defaultFalse "fail" |
|
1243 |
|
|
1244 |
-- | 'OpTestDummy' result field. |
|
1245 |
pTestDummyResult :: Field |
|
1246 |
pTestDummyResult = |
|
1247 |
renameField "TestDummyResult" $ simpleField "result" [t| UncheckedValue |] |
|
1248 |
|
|
1249 |
-- | 'OpTestDummy' messages field. |
|
1250 |
pTestDummyMessages :: Field |
|
1251 |
pTestDummyMessages = |
|
1252 |
renameField "TestDummyMessages" $ |
|
1253 |
simpleField "messages" [t| UncheckedValue |] |
|
1254 |
|
|
1255 |
-- | 'OpTestDummy' fail field. |
|
1256 |
pTestDummyFail :: Field |
|
1257 |
pTestDummyFail = |
|
1258 |
renameField "TestDummyFail" $ simpleField "fail" [t| UncheckedValue |] |
|
1259 |
|
|
1260 |
-- | 'OpTestDummy' submit_jobs field. |
|
1261 |
pTestDummySubmitJobs :: Field |
|
1262 |
pTestDummySubmitJobs = |
|
1263 |
renameField "TestDummySubmitJobs" $ |
|
1264 |
simpleField "submit_jobs" [t| UncheckedValue |] |
Also available in: Unified diff