root / src / Ganeti / OpParams.hs @ 34af39e8
History | View | Annotate | Download (46.6 kB)
1 |
{-# LANGUAGE TemplateHaskell #-} |
---|---|
2 |
|
3 |
{-| Implementation of opcodes parameters. |
4 |
|
5 |
These are defined in a separate module only due to TemplateHaskell |
6 |
stage restrictions - expressions defined in the current module can't |
7 |
be passed to splices. So we have to either parameters/repeat each |
8 |
parameter definition multiple times, or separate them into this |
9 |
module. |
10 |
|
11 |
-} |
12 |
|
13 |
{- |
14 |
|
15 |
Copyright (C) 2012 Google Inc. |
16 |
|
17 |
This program is free software; you can redistribute it and/or modify |
18 |
it under the terms of the GNU General Public License as published by |
19 |
the Free Software Foundation; either version 2 of the License, or |
20 |
(at your option) any later version. |
21 |
|
22 |
This program is distributed in the hope that it will be useful, but |
23 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
24 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
25 |
General Public License for more details. |
26 |
|
27 |
You should have received a copy of the GNU General Public License |
28 |
along with this program; if not, write to the Free Software |
29 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
30 |
02110-1301, USA. |
31 |
|
32 |
-} |
33 |
|
34 |
module Ganeti.OpParams |
35 |
( TagType(..) |
36 |
, TagObject(..) |
37 |
, tagObjectFrom |
38 |
, tagNameOf |
39 |
, decodeTagObject |
40 |
, encodeTagObject |
41 |
, ReplaceDisksMode(..) |
42 |
, DiskIndex |
43 |
, mkDiskIndex |
44 |
, unDiskIndex |
45 |
, DiskAccess(..) |
46 |
, INicParams(..) |
47 |
, IDiskParams(..) |
48 |
, RecreateDisksInfo(..) |
49 |
, DdmOldChanges(..) |
50 |
, SetParamsMods(..) |
51 |
, ExportTarget(..) |
52 |
, pInstanceName |
53 |
, pInstanceUuid |
54 |
, pInstances |
55 |
, pName |
56 |
, pTagsList |
57 |
, pTagsObject |
58 |
, pTagsName |
59 |
, pOutputFields |
60 |
, pShutdownTimeout |
61 |
, pShutdownInstance |
62 |
, pForce |
63 |
, pIgnoreOfflineNodes |
64 |
, pNodeName |
65 |
, pNodeUuid |
66 |
, pNodeNames |
67 |
, pNodeUuids |
68 |
, pGroupName |
69 |
, pMigrationMode |
70 |
, pMigrationLive |
71 |
, pMigrationCleanup |
72 |
, pForceVariant |
73 |
, pWaitForSync |
74 |
, pWaitForSyncFalse |
75 |
, pIgnoreConsistency |
76 |
, pStorageName |
77 |
, pUseLocking |
78 |
, pOpportunisticLocking |
79 |
, pNameCheck |
80 |
, pNodeGroupAllocPolicy |
81 |
, pGroupNodeParams |
82 |
, pQueryWhat |
83 |
, pEarlyRelease |
84 |
, pIpCheck |
85 |
, pIpConflictsCheck |
86 |
, pNoRemember |
87 |
, pMigrationTargetNode |
88 |
, pMigrationTargetNodeUuid |
89 |
, pMoveTargetNode |
90 |
, pMoveTargetNodeUuid |
91 |
, pStartupPaused |
92 |
, pVerbose |
93 |
, pDebugSimulateErrors |
94 |
, pErrorCodes |
95 |
, pSkipChecks |
96 |
, pIgnoreErrors |
97 |
, pOptGroupName |
98 |
, pDiskParams |
99 |
, pHvState |
100 |
, pDiskState |
101 |
, pIgnoreIpolicy |
102 |
, pAllowRuntimeChgs |
103 |
, pInstDisks |
104 |
, pDiskTemplate |
105 |
, pOptDiskTemplate |
106 |
, pFileDriver |
107 |
, pFileStorageDir |
108 |
, pGlobalFileStorageDir |
109 |
, pVgName |
110 |
, pEnabledHypervisors |
111 |
, pHypervisor |
112 |
, pClusterHvParams |
113 |
, pInstHvParams |
114 |
, pClusterBeParams |
115 |
, pInstBeParams |
116 |
, pResetDefaults |
117 |
, pOsHvp |
118 |
, pClusterOsParams |
119 |
, pInstOsParams |
120 |
, pCandidatePoolSize |
121 |
, pUidPool |
122 |
, pAddUids |
123 |
, pRemoveUids |
124 |
, pMaintainNodeHealth |
125 |
, pModifyEtcHosts |
126 |
, pPreallocWipeDisks |
127 |
, pNicParams |
128 |
, pInstNics |
129 |
, pNdParams |
130 |
, pIpolicy |
131 |
, pDrbdHelper |
132 |
, pDefaultIAllocator |
133 |
, pMasterNetdev |
134 |
, pMasterNetmask |
135 |
, pReservedLvs |
136 |
, pHiddenOs |
137 |
, pBlacklistedOs |
138 |
, pUseExternalMipScript |
139 |
, pQueryFields |
140 |
, pQueryFilter |
141 |
, pQueryFieldsFields |
142 |
, pOobCommand |
143 |
, pOobTimeout |
144 |
, pIgnoreStatus |
145 |
, pPowerDelay |
146 |
, pPrimaryIp |
147 |
, pSecondaryIp |
148 |
, pReadd |
149 |
, pNodeGroup |
150 |
, pMasterCapable |
151 |
, pVmCapable |
152 |
, pNames |
153 |
, pNodes |
154 |
, pRequiredNodes |
155 |
, pRequiredNodeUuids |
156 |
, pStorageType |
157 |
, pStorageChanges |
158 |
, pMasterCandidate |
159 |
, pOffline |
160 |
, pDrained |
161 |
, pAutoPromote |
162 |
, pPowered |
163 |
, pIallocator |
164 |
, pRemoteNode |
165 |
, pRemoteNodeUuid |
166 |
, pEvacMode |
167 |
, pInstCreateMode |
168 |
, pNoInstall |
169 |
, pInstOs |
170 |
, pPrimaryNode |
171 |
, pPrimaryNodeUuid |
172 |
, pSecondaryNode |
173 |
, pSecondaryNodeUuid |
174 |
, pSourceHandshake |
175 |
, pSourceInstance |
176 |
, pSourceShutdownTimeout |
177 |
, pSourceX509Ca |
178 |
, pSrcNode |
179 |
, pSrcNodeUuid |
180 |
, pSrcPath |
181 |
, pStartInstance |
182 |
, pInstTags |
183 |
, pMultiAllocInstances |
184 |
, pTempOsParams |
185 |
, pTempHvParams |
186 |
, pTempBeParams |
187 |
, pIgnoreFailures |
188 |
, pNewName |
189 |
, pIgnoreSecondaries |
190 |
, pRebootType |
191 |
, pIgnoreDiskSize |
192 |
, pRecreateDisksInfo |
193 |
, pStatic |
194 |
, pInstParamsNicChanges |
195 |
, pInstParamsDiskChanges |
196 |
, pRuntimeMem |
197 |
, pOsNameChange |
198 |
, pDiskIndex |
199 |
, pDiskChgAmount |
200 |
, pDiskChgAbsolute |
201 |
, pTargetGroups |
202 |
, pExportMode |
203 |
, pExportTargetNode |
204 |
, pExportTargetNodeUuid |
205 |
, pRemoveInstance |
206 |
, pIgnoreRemoveFailures |
207 |
, pX509KeyName |
208 |
, pX509DestCA |
209 |
, pTagSearchPattern |
210 |
, pRestrictedCommand |
211 |
, pReplaceDisksMode |
212 |
, pReplaceDisksList |
213 |
, pAllowFailover |
214 |
, pDelayDuration |
215 |
, pDelayOnMaster |
216 |
, pDelayOnNodes |
217 |
, pDelayOnNodeUuids |
218 |
, pDelayRepeat |
219 |
, pIAllocatorDirection |
220 |
, pIAllocatorMode |
221 |
, pIAllocatorReqName |
222 |
, pIAllocatorNics |
223 |
, pIAllocatorDisks |
224 |
, pIAllocatorMemory |
225 |
, pIAllocatorVCpus |
226 |
, pIAllocatorOs |
227 |
, pIAllocatorInstances |
228 |
, pIAllocatorEvacMode |
229 |
, pIAllocatorSpindleUse |
230 |
, pIAllocatorCount |
231 |
, pJQueueNotifyWaitLock |
232 |
, pJQueueNotifyExec |
233 |
, pJQueueLogMessages |
234 |
, pJQueueFail |
235 |
, pTestDummyResult |
236 |
, pTestDummyMessages |
237 |
, pTestDummyFail |
238 |
, pTestDummySubmitJobs |
239 |
, pNetworkName |
240 |
, pNetworkAddress4 |
241 |
, pNetworkGateway4 |
242 |
, pNetworkAddress6 |
243 |
, pNetworkGateway6 |
244 |
, pNetworkMacPrefix |
245 |
, pNetworkAddRsvdIps |
246 |
, pNetworkRemoveRsvdIps |
247 |
, pNetworkMode |
248 |
, pNetworkLink |
249 |
, pDryRun |
250 |
, pDebugLevel |
251 |
, pOpPriority |
252 |
, pDependencies |
253 |
, pComment |
254 |
, pReason |
255 |
, pEnabledDiskTemplates |
256 |
) where |
257 |
|
258 |
import Control.Monad (liftM) |
259 |
import Data.Set (Set) |
260 |
import qualified Data.Set as Set |
261 |
import Text.JSON (JSON, JSValue(..), JSObject (..), readJSON, showJSON, |
262 |
fromJSString, toJSObject) |
263 |
import qualified Text.JSON |
264 |
import Text.JSON.Pretty (pp_value) |
265 |
|
266 |
import Ganeti.BasicTypes |
267 |
import qualified Ganeti.Constants as C |
268 |
import Ganeti.THH |
269 |
import Ganeti.JSON |
270 |
import Ganeti.Types |
271 |
import qualified Ganeti.Query.Language as Qlang |
272 |
|
273 |
|
274 |
-- * Helper functions and types |
275 |
|
276 |
-- | Build a boolean field. |
277 |
booleanField :: String -> Field |
278 |
booleanField = flip simpleField [t| Bool |] |
279 |
|
280 |
-- | Default a field to 'False'. |
281 |
defaultFalse :: String -> Field |
282 |
defaultFalse = defaultField [| False |] . booleanField |
283 |
|
284 |
-- | Default a field to 'True'. |
285 |
defaultTrue :: String -> Field |
286 |
defaultTrue = defaultField [| True |] . booleanField |
287 |
|
288 |
-- | An alias for a 'String' field. |
289 |
stringField :: String -> Field |
290 |
stringField = flip simpleField [t| String |] |
291 |
|
292 |
-- | An alias for an optional string field. |
293 |
optionalStringField :: String -> Field |
294 |
optionalStringField = optionalField . stringField |
295 |
|
296 |
-- | An alias for an optional non-empty string field. |
297 |
optionalNEStringField :: String -> Field |
298 |
optionalNEStringField = optionalField . flip simpleField [t| NonEmptyString |] |
299 |
|
300 |
-- | Function to force a non-negative value, without returning via a |
301 |
-- monad. This is needed for, and should be used /only/ in the case of |
302 |
-- forcing constants. In case the constant is wrong (< 0), this will |
303 |
-- become a runtime error. |
304 |
forceNonNeg :: (Num a, Ord a, Show a) => a -> NonNegative a |
305 |
forceNonNeg i = case mkNonNegative i of |
306 |
Ok n -> n |
307 |
Bad msg -> error msg |
308 |
|
309 |
-- ** Tags |
310 |
|
311 |
-- | Data type representing what items do the tag operations apply to. |
312 |
$(declareSADT "TagType" |
313 |
[ ("TagTypeInstance", 'C.tagInstance) |
314 |
, ("TagTypeNode", 'C.tagNode) |
315 |
, ("TagTypeGroup", 'C.tagNodegroup) |
316 |
, ("TagTypeCluster", 'C.tagCluster) |
317 |
]) |
318 |
$(makeJSONInstance ''TagType) |
319 |
|
320 |
-- | Data type holding a tag object (type and object name). |
321 |
data TagObject = TagInstance String |
322 |
| TagNode String |
323 |
| TagGroup String |
324 |
| TagCluster |
325 |
deriving (Show, Eq) |
326 |
|
327 |
-- | Tag type for a given tag object. |
328 |
tagTypeOf :: TagObject -> TagType |
329 |
tagTypeOf (TagInstance {}) = TagTypeInstance |
330 |
tagTypeOf (TagNode {}) = TagTypeNode |
331 |
tagTypeOf (TagGroup {}) = TagTypeGroup |
332 |
tagTypeOf (TagCluster {}) = TagTypeCluster |
333 |
|
334 |
-- | Gets the potential tag object name. |
335 |
tagNameOf :: TagObject -> Maybe String |
336 |
tagNameOf (TagInstance s) = Just s |
337 |
tagNameOf (TagNode s) = Just s |
338 |
tagNameOf (TagGroup s) = Just s |
339 |
tagNameOf TagCluster = Nothing |
340 |
|
341 |
-- | Builds a 'TagObject' from a tag type and name. |
342 |
tagObjectFrom :: (Monad m) => TagType -> JSValue -> m TagObject |
343 |
tagObjectFrom TagTypeInstance (JSString s) = |
344 |
return . TagInstance $ fromJSString s |
345 |
tagObjectFrom TagTypeNode (JSString s) = return . TagNode $ fromJSString s |
346 |
tagObjectFrom TagTypeGroup (JSString s) = return . TagGroup $ fromJSString s |
347 |
tagObjectFrom TagTypeCluster JSNull = return TagCluster |
348 |
tagObjectFrom t v = |
349 |
fail $ "Invalid tag type/name combination: " ++ show t ++ "/" ++ |
350 |
show (pp_value v) |
351 |
|
352 |
-- | Name of the tag \"name\" field. |
353 |
tagNameField :: String |
354 |
tagNameField = "name" |
355 |
|
356 |
-- | Custom encoder for 'TagObject' as represented in an opcode. |
357 |
encodeTagObject :: TagObject -> (JSValue, [(String, JSValue)]) |
358 |
encodeTagObject t = ( showJSON (tagTypeOf t) |
359 |
, [(tagNameField, maybe JSNull showJSON (tagNameOf t))] ) |
360 |
|
361 |
-- | Custom decoder for 'TagObject' as represented in an opcode. |
362 |
decodeTagObject :: (Monad m) => [(String, JSValue)] -> JSValue -> m TagObject |
363 |
decodeTagObject obj kind = do |
364 |
ttype <- fromJVal kind |
365 |
tname <- fromObj obj tagNameField |
366 |
tagObjectFrom ttype tname |
367 |
|
368 |
-- ** Disks |
369 |
|
370 |
-- | Replace disks type. |
371 |
$(declareSADT "ReplaceDisksMode" |
372 |
[ ("ReplaceOnPrimary", 'C.replaceDiskPri) |
373 |
, ("ReplaceOnSecondary", 'C.replaceDiskSec) |
374 |
, ("ReplaceNewSecondary", 'C.replaceDiskChg) |
375 |
, ("ReplaceAuto", 'C.replaceDiskAuto) |
376 |
]) |
377 |
$(makeJSONInstance ''ReplaceDisksMode) |
378 |
|
379 |
-- | Disk index type (embedding constraints on the index value via a |
380 |
-- smart constructor). |
381 |
newtype DiskIndex = DiskIndex { unDiskIndex :: Int } |
382 |
deriving (Show, Eq, Ord) |
383 |
|
384 |
-- | Smart constructor for 'DiskIndex'. |
385 |
mkDiskIndex :: (Monad m) => Int -> m DiskIndex |
386 |
mkDiskIndex i | i >= 0 && i < C.maxDisks = return (DiskIndex i) |
387 |
| otherwise = fail $ "Invalid value for disk index '" ++ |
388 |
show i ++ "', required between 0 and " ++ |
389 |
show C.maxDisks |
390 |
|
391 |
instance JSON DiskIndex where |
392 |
readJSON v = readJSON v >>= mkDiskIndex |
393 |
showJSON = showJSON . unDiskIndex |
394 |
|
395 |
-- ** I* param types |
396 |
|
397 |
-- | Type holding disk access modes. |
398 |
$(declareSADT "DiskAccess" |
399 |
[ ("DiskReadOnly", 'C.diskRdonly) |
400 |
, ("DiskReadWrite", 'C.diskRdwr) |
401 |
]) |
402 |
$(makeJSONInstance ''DiskAccess) |
403 |
|
404 |
-- | NIC modification definition. |
405 |
$(buildObject "INicParams" "inic" |
406 |
[ optionalField $ simpleField C.inicMac [t| NonEmptyString |] |
407 |
, optionalField $ simpleField C.inicIp [t| String |] |
408 |
, optionalField $ simpleField C.inicMode [t| NonEmptyString |] |
409 |
, optionalField $ simpleField C.inicLink [t| NonEmptyString |] |
410 |
, optionalField $ simpleField C.inicName [t| NonEmptyString |] |
411 |
, optionalField $ simpleField C.inicVlan [t| NonEmptyString |] |
412 |
, optionalField $ simpleField C.inicBridge [t| NonEmptyString |] |
413 |
]) |
414 |
|
415 |
-- | Disk modification definition. FIXME: disksize should be VTYPE_UNIT. |
416 |
$(buildObject "IDiskParams" "idisk" |
417 |
[ optionalField $ simpleField C.idiskSize [t| Int |] |
418 |
, optionalField $ simpleField C.idiskMode [t| DiskAccess |] |
419 |
, optionalField $ simpleField C.idiskAdopt [t| NonEmptyString |] |
420 |
, optionalField $ simpleField C.idiskVg [t| NonEmptyString |] |
421 |
, optionalField $ simpleField C.idiskMetavg [t| NonEmptyString |] |
422 |
, optionalField $ simpleField C.idiskName [t| NonEmptyString |] |
423 |
]) |
424 |
|
425 |
-- | Disk changes type for OpInstanceRecreateDisks. This is a bit |
426 |
-- strange, because the type in Python is something like Either |
427 |
-- [DiskIndex] [DiskChanges], but we can't represent the type of an |
428 |
-- empty list in JSON, so we have to add a custom case for the empty |
429 |
-- list. |
430 |
data RecreateDisksInfo |
431 |
= RecreateDisksAll |
432 |
| RecreateDisksIndices (NonEmpty DiskIndex) |
433 |
| RecreateDisksParams (NonEmpty (DiskIndex, IDiskParams)) |
434 |
deriving (Eq, Show) |
435 |
|
436 |
readRecreateDisks :: JSValue -> Text.JSON.Result RecreateDisksInfo |
437 |
readRecreateDisks (JSArray []) = return RecreateDisksAll |
438 |
readRecreateDisks v = |
439 |
case readJSON v::Text.JSON.Result [DiskIndex] of |
440 |
Text.JSON.Ok indices -> liftM RecreateDisksIndices (mkNonEmpty indices) |
441 |
_ -> case readJSON v::Text.JSON.Result [(DiskIndex, IDiskParams)] of |
442 |
Text.JSON.Ok params -> liftM RecreateDisksParams (mkNonEmpty params) |
443 |
_ -> fail $ "Can't parse disk information as either list of disk" |
444 |
++ " indices or list of disk parameters; value received:" |
445 |
++ show (pp_value v) |
446 |
|
447 |
instance JSON RecreateDisksInfo where |
448 |
readJSON = readRecreateDisks |
449 |
showJSON RecreateDisksAll = showJSON () |
450 |
showJSON (RecreateDisksIndices idx) = showJSON idx |
451 |
showJSON (RecreateDisksParams params) = showJSON params |
452 |
|
453 |
-- | Simple type for old-style ddm changes. |
454 |
data DdmOldChanges = DdmOldIndex (NonNegative Int) |
455 |
| DdmOldMod DdmSimple |
456 |
deriving (Eq, Show) |
457 |
|
458 |
readDdmOldChanges :: JSValue -> Text.JSON.Result DdmOldChanges |
459 |
readDdmOldChanges v = |
460 |
case readJSON v::Text.JSON.Result (NonNegative Int) of |
461 |
Text.JSON.Ok nn -> return $ DdmOldIndex nn |
462 |
_ -> case readJSON v::Text.JSON.Result DdmSimple of |
463 |
Text.JSON.Ok ddms -> return $ DdmOldMod ddms |
464 |
_ -> fail $ "Can't parse value '" ++ show (pp_value v) ++ "' as" |
465 |
++ " either index or modification" |
466 |
|
467 |
instance JSON DdmOldChanges where |
468 |
showJSON (DdmOldIndex i) = showJSON i |
469 |
showJSON (DdmOldMod m) = showJSON m |
470 |
readJSON = readDdmOldChanges |
471 |
|
472 |
-- | Instance disk or nic modifications. |
473 |
data SetParamsMods a |
474 |
= SetParamsEmpty |
475 |
| SetParamsDeprecated (NonEmpty (DdmOldChanges, a)) |
476 |
| SetParamsNew (NonEmpty (DdmFull, Int, a)) |
477 |
deriving (Eq, Show) |
478 |
|
479 |
-- | Custom deserialiser for 'SetParamsMods'. |
480 |
readSetParams :: (JSON a) => JSValue -> Text.JSON.Result (SetParamsMods a) |
481 |
readSetParams (JSArray []) = return SetParamsEmpty |
482 |
readSetParams v = |
483 |
case readJSON v::Text.JSON.Result [(DdmOldChanges, JSValue)] of |
484 |
Text.JSON.Ok _ -> liftM SetParamsDeprecated $ readJSON v |
485 |
_ -> liftM SetParamsNew $ readJSON v |
486 |
|
487 |
instance (JSON a) => JSON (SetParamsMods a) where |
488 |
showJSON SetParamsEmpty = showJSON () |
489 |
showJSON (SetParamsDeprecated v) = showJSON v |
490 |
showJSON (SetParamsNew v) = showJSON v |
491 |
readJSON = readSetParams |
492 |
|
493 |
-- | Custom type for target_node parameter of OpBackupExport, which |
494 |
-- varies depending on mode. FIXME: this uses an [JSValue] since |
495 |
-- we don't care about individual rows (just like the Python code |
496 |
-- tests). But the proper type could be parsed if we wanted. |
497 |
data ExportTarget = ExportTargetLocal NonEmptyString |
498 |
| ExportTargetRemote [JSValue] |
499 |
deriving (Eq, Show) |
500 |
|
501 |
-- | Custom reader for 'ExportTarget'. |
502 |
readExportTarget :: JSValue -> Text.JSON.Result ExportTarget |
503 |
readExportTarget (JSString s) = liftM ExportTargetLocal $ |
504 |
mkNonEmpty (fromJSString s) |
505 |
readExportTarget (JSArray arr) = return $ ExportTargetRemote arr |
506 |
readExportTarget v = fail $ "Invalid value received for 'target_node': " ++ |
507 |
show (pp_value v) |
508 |
|
509 |
instance JSON ExportTarget where |
510 |
showJSON (ExportTargetLocal s) = showJSON s |
511 |
showJSON (ExportTargetRemote l) = showJSON l |
512 |
readJSON = readExportTarget |
513 |
|
514 |
|
515 |
-- * Common opcode parameters |
516 |
|
517 |
pDryRun :: Field |
518 |
pDryRun = |
519 |
withDoc "Run checks only, don't execute" . |
520 |
optionalField $ booleanField "dry_run" |
521 |
|
522 |
pDebugLevel :: Field |
523 |
pDebugLevel = |
524 |
withDoc "Debug level" . |
525 |
optionalField $ simpleField "debug_level" [t| NonNegative Int |] |
526 |
|
527 |
pOpPriority :: Field |
528 |
pOpPriority = |
529 |
withDoc "Opcode priority. Note: python uses a separate constant,\ |
530 |
\ we're using the actual value we know it's the default" . |
531 |
defaultField [| OpPrioNormal |] $ |
532 |
simpleField "priority" [t| OpSubmitPriority |] |
533 |
|
534 |
pDependencies :: Field |
535 |
pDependencies = |
536 |
withDoc "Job dependencies" . |
537 |
optionalNullSerField $ simpleField "depends" [t| [JobDependency] |] |
538 |
|
539 |
pComment :: Field |
540 |
pComment = |
541 |
withDoc "Comment field" . |
542 |
optionalNullSerField $ stringField "comment" |
543 |
|
544 |
pReason :: Field |
545 |
pReason = |
546 |
withDoc "Reason trail field" $ |
547 |
simpleField C.opcodeReason [t| ReasonTrail |] |
548 |
|
549 |
|
550 |
-- * Parameters |
551 |
|
552 |
pDebugSimulateErrors :: Field |
553 |
pDebugSimulateErrors = |
554 |
withDoc "Whether to simulate errors (useful for debugging)" $ |
555 |
defaultFalse "debug_simulate_errors" |
556 |
|
557 |
pErrorCodes :: Field |
558 |
pErrorCodes = |
559 |
withDoc "Error codes" $ |
560 |
defaultFalse "error_codes" |
561 |
|
562 |
pSkipChecks :: Field |
563 |
pSkipChecks = |
564 |
withDoc "Which checks to skip" . |
565 |
defaultField [| Set.empty |] $ |
566 |
simpleField "skip_checks" [t| Set VerifyOptionalChecks |] |
567 |
|
568 |
pIgnoreErrors :: Field |
569 |
pIgnoreErrors = |
570 |
withDoc "List of error codes that should be treated as warnings" . |
571 |
defaultField [| Set.empty |] $ |
572 |
simpleField "ignore_errors" [t| Set CVErrorCode |] |
573 |
|
574 |
pVerbose :: Field |
575 |
pVerbose = |
576 |
withDoc "Verbose mode" $ |
577 |
defaultFalse "verbose" |
578 |
|
579 |
pOptGroupName :: Field |
580 |
pOptGroupName = |
581 |
withDoc "Optional group name" . |
582 |
renameField "OptGroupName" . |
583 |
optionalField $ simpleField "group_name" [t| NonEmptyString |] |
584 |
|
585 |
pGroupName :: Field |
586 |
pGroupName = |
587 |
withDoc "Group name" $ |
588 |
simpleField "group_name" [t| NonEmptyString |] |
589 |
|
590 |
pInstances :: Field |
591 |
pInstances = |
592 |
withDoc "List of instances" . |
593 |
defaultField [| [] |] $ |
594 |
simpleField "instances" [t| [NonEmptyString] |] |
595 |
|
596 |
pOutputFields :: Field |
597 |
pOutputFields = |
598 |
withDoc "Selected output fields" $ |
599 |
simpleField "output_fields" [t| [NonEmptyString] |] |
600 |
|
601 |
pName :: Field |
602 |
pName = |
603 |
withDoc "A generic name" $ |
604 |
simpleField "name" [t| NonEmptyString |] |
605 |
|
606 |
pForce :: Field |
607 |
pForce = |
608 |
withDoc "Whether to force the operation" $ |
609 |
defaultFalse "force" |
610 |
|
611 |
pHvState :: Field |
612 |
pHvState = |
613 |
withDoc "Set hypervisor states" . |
614 |
optionalField $ simpleField "hv_state" [t| JSObject JSValue |] |
615 |
|
616 |
pDiskState :: Field |
617 |
pDiskState = |
618 |
withDoc "Set disk states" . |
619 |
optionalField $ simpleField "disk_state" [t| JSObject JSValue |] |
620 |
|
621 |
-- | Global directory for storing file-backed disks. |
622 |
pGlobalFileStorageDir :: Field |
623 |
pGlobalFileStorageDir = optionalNEStringField "file_storage_dir" |
624 |
|
625 |
-- | Volume group name. |
626 |
pVgName :: Field |
627 |
pVgName = |
628 |
withDoc "Volume group name" $ |
629 |
optionalStringField "vg_name" |
630 |
|
631 |
pEnabledHypervisors :: Field |
632 |
pEnabledHypervisors = |
633 |
withDoc "List of enabled hypervisors" . |
634 |
optionalField $ |
635 |
simpleField "enabled_hypervisors" [t| Hypervisor |] |
636 |
|
637 |
pClusterHvParams :: Field |
638 |
pClusterHvParams = |
639 |
withDoc "Cluster-wide hypervisor parameters, hypervisor-dependent" . |
640 |
renameField "ClusterHvParams" . |
641 |
optionalField $ |
642 |
simpleField "hvparams" [t| GenericContainer String (JSObject JSValue) |] |
643 |
|
644 |
pClusterBeParams :: Field |
645 |
pClusterBeParams = |
646 |
withDoc "Cluster-wide backend parameter defaults" . |
647 |
renameField "ClusterBeParams" . |
648 |
optionalField $ simpleField "beparams" [t| JSObject JSValue |] |
649 |
|
650 |
pOsHvp :: Field |
651 |
pOsHvp = |
652 |
withDoc "Cluster-wide per-OS hypervisor parameter defaults" . |
653 |
optionalField $ |
654 |
simpleField "os_hvp" [t| GenericContainer String (JSObject JSValue) |] |
655 |
|
656 |
pClusterOsParams :: Field |
657 |
pClusterOsParams = |
658 |
withDoc "Cluster-wide OS parameter defaults" . |
659 |
renameField "ClusterOsParams" . |
660 |
optionalField $ |
661 |
simpleField "osparams" [t| GenericContainer String (JSObject JSValue) |] |
662 |
|
663 |
pDiskParams :: Field |
664 |
pDiskParams = |
665 |
withDoc "Disk templates' parameter defaults" . |
666 |
optionalField $ |
667 |
simpleField "diskparams" |
668 |
[t| GenericContainer DiskTemplate (JSObject JSValue) |] |
669 |
|
670 |
pCandidatePoolSize :: Field |
671 |
pCandidatePoolSize = |
672 |
withDoc "Master candidate pool size" . |
673 |
optionalField $ simpleField "candidate_pool_size" [t| Positive Int |] |
674 |
|
675 |
pUidPool :: Field |
676 |
pUidPool = |
677 |
withDoc "Set UID pool, must be list of lists describing UID ranges\ |
678 |
\ (two items, start and end inclusive)" . |
679 |
optionalField $ simpleField "uid_pool" [t| [[(Int, Int)]] |] |
680 |
|
681 |
pAddUids :: Field |
682 |
pAddUids = |
683 |
withDoc "Extend UID pool, must be list of lists describing UID\ |
684 |
\ ranges (two items, start and end inclusive)" . |
685 |
optionalField $ simpleField "add_uids" [t| [[(Int, Int)]] |] |
686 |
|
687 |
pRemoveUids :: Field |
688 |
pRemoveUids = |
689 |
withDoc "Shrink UID pool, must be list of lists describing UID\ |
690 |
\ ranges (two items, start and end inclusive) to be removed" . |
691 |
optionalField $ simpleField "remove_uids" [t| [[(Int, Int)]] |] |
692 |
|
693 |
pMaintainNodeHealth :: Field |
694 |
pMaintainNodeHealth = |
695 |
withDoc "Whether to automatically maintain node health" . |
696 |
optionalField $ booleanField "maintain_node_health" |
697 |
|
698 |
-- | Whether to modify and keep in sync the @/etc/hosts@ files of nodes. |
699 |
pModifyEtcHosts :: Field |
700 |
pModifyEtcHosts = optionalField $ booleanField "modify_etc_hosts" |
701 |
|
702 |
-- | Whether to wipe disks before allocating them to instances. |
703 |
pPreallocWipeDisks :: Field |
704 |
pPreallocWipeDisks = |
705 |
withDoc "Whether to wipe disks before allocating them to instances" . |
706 |
optionalField $ booleanField "prealloc_wipe_disks" |
707 |
|
708 |
pNicParams :: Field |
709 |
pNicParams = |
710 |
withDoc "Cluster-wide NIC parameter defaults" . |
711 |
optionalField $ simpleField "nicparams" [t| INicParams |] |
712 |
|
713 |
pIpolicy :: Field |
714 |
pIpolicy = |
715 |
withDoc "Ipolicy specs" . |
716 |
optionalField $ simpleField "ipolicy" [t| JSObject JSValue |] |
717 |
|
718 |
pDrbdHelper :: Field |
719 |
pDrbdHelper = |
720 |
withDoc "DRBD helper program" $ |
721 |
optionalStringField "drbd_helper" |
722 |
|
723 |
pDefaultIAllocator :: Field |
724 |
pDefaultIAllocator = |
725 |
withDoc "Default iallocator for cluster" $ |
726 |
optionalStringField "default_iallocator" |
727 |
|
728 |
pMasterNetdev :: Field |
729 |
pMasterNetdev = |
730 |
withDoc "Master network device" $ |
731 |
optionalStringField "master_netdev" |
732 |
|
733 |
pMasterNetmask :: Field |
734 |
pMasterNetmask = |
735 |
withDoc "Netmask of the master IP" . |
736 |
optionalField $ simpleField "master_netmask" [t| NonNegative Int |] |
737 |
|
738 |
pReservedLvs :: Field |
739 |
pReservedLvs = |
740 |
withDoc "List of reserved LVs" . |
741 |
optionalField $ simpleField "reserved_lvs" [t| [NonEmptyString] |] |
742 |
|
743 |
pHiddenOs :: Field |
744 |
pHiddenOs = |
745 |
withDoc "Modify list of hidden operating systems: each modification\ |
746 |
\ must have two items, the operation and the OS name; the operation\ |
747 |
\ can be add or remove" . |
748 |
optionalField $ simpleField "hidden_os" [t| [(DdmSimple, NonEmptyString)] |] |
749 |
|
750 |
pBlacklistedOs :: Field |
751 |
pBlacklistedOs = |
752 |
withDoc "Modify list of blacklisted operating systems: each\ |
753 |
\ modification must have two items, the operation and the OS name;\ |
754 |
\ the operation can be add or remove" . |
755 |
optionalField $ |
756 |
simpleField "blacklisted_os" [t| [(DdmSimple, NonEmptyString)] |] |
757 |
|
758 |
pUseExternalMipScript :: Field |
759 |
pUseExternalMipScript = |
760 |
withDoc "Whether to use an external master IP address setup script" . |
761 |
optionalField $ booleanField "use_external_mip_script" |
762 |
|
763 |
pEnabledDiskTemplates :: Field |
764 |
pEnabledDiskTemplates = |
765 |
withDoc "List of enabled disk templates" . |
766 |
optionalField $ |
767 |
simpleField "enabled_disk_templates" [t| DiskTemplate |] |
768 |
|
769 |
pQueryWhat :: Field |
770 |
pQueryWhat = |
771 |
withDoc "Resource(s) to query for" $ |
772 |
simpleField "what" [t| Qlang.QueryTypeOp |] |
773 |
|
774 |
pUseLocking :: Field |
775 |
pUseLocking = |
776 |
withDoc "Whether to use synchronization" $ |
777 |
defaultFalse "use_locking" |
778 |
|
779 |
pQueryFields :: Field |
780 |
pQueryFields = |
781 |
withDoc "Requested fields" $ |
782 |
simpleField "fields" [t| [NonEmptyString] |] |
783 |
|
784 |
pQueryFilter :: Field |
785 |
pQueryFilter = |
786 |
withDoc "Query filter" . |
787 |
optionalField $ simpleField "qfilter" [t| [JSValue] |] |
788 |
|
789 |
pQueryFieldsFields :: Field |
790 |
pQueryFieldsFields = |
791 |
withDoc "Requested fields; if not given, all are returned" . |
792 |
renameField "QueryFieldsFields" $ |
793 |
optionalField pQueryFields |
794 |
|
795 |
pNodeNames :: Field |
796 |
pNodeNames = |
797 |
withDoc "List of node names to run the OOB command against" . |
798 |
defaultField [| [] |] $ simpleField "node_names" [t| [NonEmptyString] |] |
799 |
|
800 |
pNodeUuids :: Field |
801 |
pNodeUuids = |
802 |
withDoc "List of node UUIDs" . |
803 |
optionalField $ simpleField "node_uuids" [t| [NonEmptyString] |] |
804 |
|
805 |
pOobCommand :: Field |
806 |
pOobCommand = |
807 |
withDoc "OOB command to run" $ |
808 |
simpleField "command" [t| OobCommand |] |
809 |
|
810 |
pOobTimeout :: Field |
811 |
pOobTimeout = |
812 |
withDoc "Timeout before the OOB helper will be terminated" . |
813 |
defaultField [| C.oobTimeout |] $ |
814 |
simpleField "timeout" [t| Int |] |
815 |
|
816 |
pIgnoreStatus :: Field |
817 |
pIgnoreStatus = |
818 |
withDoc "Ignores the node offline status for power off" $ |
819 |
defaultFalse "ignore_status" |
820 |
|
821 |
pPowerDelay :: Field |
822 |
pPowerDelay = |
823 |
-- FIXME: we can't use the proper type "NonNegative Double", since |
824 |
-- the default constant is a plain Double, not a non-negative one. |
825 |
-- And trying to fix the constant introduces a cyclic import. |
826 |
withDoc "Time in seconds to wait between powering on nodes" . |
827 |
defaultField [| C.oobPowerDelay |] $ |
828 |
simpleField "power_delay" [t| Double |] |
829 |
|
830 |
pRequiredNodes :: Field |
831 |
pRequiredNodes = |
832 |
withDoc "Required list of node names" . |
833 |
renameField "ReqNodes " $ simpleField "nodes" [t| [NonEmptyString] |] |
834 |
|
835 |
pRequiredNodeUuids :: Field |
836 |
pRequiredNodeUuids = |
837 |
withDoc "Required list of node UUIDs" . |
838 |
renameField "ReqNodeUuids " . optionalField $ |
839 |
simpleField "node_uuids" [t| [NonEmptyString] |] |
840 |
|
841 |
pRestrictedCommand :: Field |
842 |
pRestrictedCommand = |
843 |
withDoc "Restricted command name" . |
844 |
renameField "RestrictedCommand" $ |
845 |
simpleField "command" [t| NonEmptyString |] |
846 |
|
847 |
pNodeName :: Field |
848 |
pNodeName = |
849 |
withDoc "A required node name (for single-node LUs)" $ |
850 |
simpleField "node_name" [t| NonEmptyString |] |
851 |
|
852 |
pNodeUuid :: Field |
853 |
pNodeUuid = |
854 |
withDoc "A node UUID (for single-node LUs)" . |
855 |
optionalField $ simpleField "node_uuid" [t| NonEmptyString |] |
856 |
|
857 |
pPrimaryIp :: Field |
858 |
pPrimaryIp = |
859 |
withDoc "Primary IP address" $ |
860 |
simpleField "primary_ip" [t| NonEmptyString |] |
861 |
|
862 |
pSecondaryIp :: Field |
863 |
pSecondaryIp = |
864 |
withDoc "Secondary IP address" $ |
865 |
optionalNEStringField "secondary_ip" |
866 |
|
867 |
pReadd :: Field |
868 |
pReadd = |
869 |
withDoc "Whether node is re-added to cluster" $ |
870 |
defaultFalse "readd" |
871 |
|
872 |
pNodeGroup :: Field |
873 |
pNodeGroup = |
874 |
withDoc "Initial node group" $ |
875 |
optionalNEStringField "group" |
876 |
|
877 |
pMasterCapable :: Field |
878 |
pMasterCapable = |
879 |
withDoc "Whether node can become master or master candidate" . |
880 |
optionalField $ booleanField "master_capable" |
881 |
|
882 |
pVmCapable :: Field |
883 |
pVmCapable = |
884 |
withDoc "Whether node can host instances" . |
885 |
optionalField $ booleanField "vm_capable" |
886 |
|
887 |
pNdParams :: Field |
888 |
pNdParams = |
889 |
withDoc "Node parameters" . |
890 |
renameField "genericNdParams" . |
891 |
optionalField $ simpleField "ndparams" [t| JSObject JSValue |] |
892 |
|
893 |
pNames :: Field |
894 |
pNames = |
895 |
withDoc "List of names" . |
896 |
defaultField [| [] |] $ simpleField "names" [t| [NonEmptyString] |] |
897 |
|
898 |
pNodes :: Field |
899 |
pNodes = |
900 |
withDoc "List of nodes" . |
901 |
defaultField [| [] |] $ simpleField "nodes" [t| [NonEmptyString] |] |
902 |
|
903 |
pStorageType :: Field |
904 |
pStorageType = |
905 |
withDoc "Storage type" $ |
906 |
simpleField "storage_type" [t| StorageType |] |
907 |
|
908 |
pStorageName :: Field |
909 |
pStorageName = |
910 |
withDoc "Storage name" . |
911 |
renameField "StorageName" . |
912 |
optionalField $ simpleField "name" [t| NonEmptyString |] |
913 |
|
914 |
pStorageChanges :: Field |
915 |
pStorageChanges = |
916 |
withDoc "Requested storage changes" $ |
917 |
simpleField "changes" [t| JSObject JSValue |] |
918 |
|
919 |
pIgnoreConsistency :: Field |
920 |
pIgnoreConsistency = |
921 |
withDoc "Whether to ignore disk consistency" $ |
922 |
defaultFalse "ignore_consistency" |
923 |
|
924 |
pMasterCandidate :: Field |
925 |
pMasterCandidate = |
926 |
withDoc "Whether the node should become a master candidate" . |
927 |
optionalField $ booleanField "master_candidate" |
928 |
|
929 |
pOffline :: Field |
930 |
pOffline = |
931 |
withDoc "Whether to mark the node or instance offline" . |
932 |
optionalField $ booleanField "offline" |
933 |
|
934 |
pDrained ::Field |
935 |
pDrained = |
936 |
withDoc "Whether to mark the node as drained" . |
937 |
optionalField $ booleanField "drained" |
938 |
|
939 |
pAutoPromote :: Field |
940 |
pAutoPromote = |
941 |
withDoc "Whether node(s) should be promoted to master candidate if\ |
942 |
\ necessary" $ |
943 |
defaultFalse "auto_promote" |
944 |
|
945 |
pPowered :: Field |
946 |
pPowered = |
947 |
withDoc "Whether the node should be marked as powered" . |
948 |
optionalField $ booleanField "powered" |
949 |
|
950 |
pMigrationMode :: Field |
951 |
pMigrationMode = |
952 |
withDoc "Migration type (live/non-live)" . |
953 |
renameField "MigrationMode" . |
954 |
optionalField $ |
955 |
simpleField "mode" [t| MigrationMode |] |
956 |
|
957 |
pMigrationLive :: Field |
958 |
pMigrationLive = |
959 |
withDoc "Obsolete \'live\' migration mode (do not use)" . |
960 |
renameField "OldLiveMode" . optionalField $ booleanField "live" |
961 |
|
962 |
pMigrationTargetNode :: Field |
963 |
pMigrationTargetNode = |
964 |
withDoc "Target node for instance migration/failover" $ |
965 |
optionalNEStringField "target_node" |
966 |
|
967 |
pMigrationTargetNodeUuid :: Field |
968 |
pMigrationTargetNodeUuid = |
969 |
withDoc "Target node UUID for instance migration/failover" $ |
970 |
optionalNEStringField "target_node_uuid" |
971 |
|
972 |
pAllowRuntimeChgs :: Field |
973 |
pAllowRuntimeChgs = |
974 |
withDoc "Whether to allow runtime changes while migrating" $ |
975 |
defaultTrue "allow_runtime_changes" |
976 |
|
977 |
pIgnoreIpolicy :: Field |
978 |
pIgnoreIpolicy = |
979 |
withDoc "Whether to ignore ipolicy violations" $ |
980 |
defaultFalse "ignore_ipolicy" |
981 |
|
982 |
pIallocator :: Field |
983 |
pIallocator = |
984 |
withDoc "Iallocator for deciding the target node for shared-storage\ |
985 |
\ instances" $ |
986 |
optionalNEStringField "iallocator" |
987 |
|
988 |
pEarlyRelease :: Field |
989 |
pEarlyRelease = |
990 |
withDoc "Whether to release locks as soon as possible" $ |
991 |
defaultFalse "early_release" |
992 |
|
993 |
pRemoteNode :: Field |
994 |
pRemoteNode = |
995 |
withDoc "New secondary node" $ |
996 |
optionalNEStringField "remote_node" |
997 |
|
998 |
pRemoteNodeUuid :: Field |
999 |
pRemoteNodeUuid = |
1000 |
withDoc "New secondary node UUID" $ |
1001 |
optionalNEStringField "remote_node_uuid" |
1002 |
|
1003 |
pEvacMode :: Field |
1004 |
pEvacMode = |
1005 |
withDoc "Node evacuation mode" . |
1006 |
renameField "EvacMode" $ simpleField "mode" [t| NodeEvacMode |] |
1007 |
|
1008 |
pInstanceName :: Field |
1009 |
pInstanceName = |
1010 |
withDoc "A required instance name (for single-instance LUs)" $ |
1011 |
simpleField "instance_name" [t| String |] |
1012 |
|
1013 |
pForceVariant :: Field |
1014 |
pForceVariant = |
1015 |
withDoc "Whether to force an unknown OS variant" $ |
1016 |
defaultFalse "force_variant" |
1017 |
|
1018 |
pWaitForSync :: Field |
1019 |
pWaitForSync = |
1020 |
withDoc "Whether to wait for the disk to synchronize" $ |
1021 |
defaultTrue "wait_for_sync" |
1022 |
|
1023 |
pNameCheck :: Field |
1024 |
pNameCheck = |
1025 |
withDoc "Whether to check name" $ |
1026 |
defaultTrue "name_check" |
1027 |
|
1028 |
pInstBeParams :: Field |
1029 |
pInstBeParams = |
1030 |
withDoc "Backend parameters for instance" . |
1031 |
renameField "InstBeParams" . |
1032 |
defaultField [| toJSObject [] |] $ |
1033 |
simpleField "beparams" [t| JSObject JSValue |] |
1034 |
|
1035 |
pInstDisks :: Field |
1036 |
pInstDisks = |
1037 |
withDoc "List of instance disks" . |
1038 |
renameField "instDisks" $ simpleField "disks" [t| [IDiskParams] |] |
1039 |
|
1040 |
pDiskTemplate :: Field |
1041 |
pDiskTemplate = |
1042 |
withDoc "List of instance disks" $ |
1043 |
simpleField "disk_template" [t| DiskTemplate |] |
1044 |
|
1045 |
pFileDriver :: Field |
1046 |
pFileDriver = |
1047 |
withDoc "Driver for file-backed disks" . |
1048 |
optionalField $ simpleField "file_driver" [t| FileDriver |] |
1049 |
|
1050 |
pFileStorageDir :: Field |
1051 |
pFileStorageDir = |
1052 |
withDoc "Directory for storing file-backed disks" $ |
1053 |
optionalNEStringField "file_storage_dir" |
1054 |
|
1055 |
pInstHvParams :: Field |
1056 |
pInstHvParams = |
1057 |
withDoc "Hypervisor parameters for instance, hypervisor-dependent" . |
1058 |
renameField "InstHvParams" . |
1059 |
defaultField [| toJSObject [] |] $ |
1060 |
simpleField "hvparams" [t| JSObject JSValue |] |
1061 |
|
1062 |
pHypervisor :: Field |
1063 |
pHypervisor = |
1064 |
withDoc "Selected hypervisor for an instance" . |
1065 |
optionalField $ |
1066 |
simpleField "hypervisor" [t| Hypervisor |] |
1067 |
|
1068 |
pResetDefaults :: Field |
1069 |
pResetDefaults = |
1070 |
withDoc "Reset instance parameters to default if equal" $ |
1071 |
defaultFalse "identify_defaults" |
1072 |
|
1073 |
pIpCheck :: Field |
1074 |
pIpCheck = |
1075 |
withDoc "Whether to ensure instance's IP address is inactive" $ |
1076 |
defaultTrue "ip_check" |
1077 |
|
1078 |
pIpConflictsCheck :: Field |
1079 |
pIpConflictsCheck = |
1080 |
withDoc "Whether to check for conflicting IP addresses" $ |
1081 |
defaultTrue "conflicts_check" |
1082 |
|
1083 |
pInstCreateMode :: Field |
1084 |
pInstCreateMode = |
1085 |
withDoc "Instance creation mode" . |
1086 |
renameField "InstCreateMode" $ simpleField "mode" [t| InstCreateMode |] |
1087 |
|
1088 |
pInstNics :: Field |
1089 |
pInstNics = |
1090 |
withDoc "List of NIC (network interface) definitions" $ |
1091 |
simpleField "nics" [t| [INicParams] |] |
1092 |
|
1093 |
pNoInstall :: Field |
1094 |
pNoInstall = |
1095 |
withDoc "Do not install the OS (will disable automatic start)" . |
1096 |
optionalField $ booleanField "no_install" |
1097 |
|
1098 |
pInstOs :: Field |
1099 |
pInstOs = |
1100 |
withDoc "OS type for instance installation" $ |
1101 |
optionalNEStringField "os_type" |
1102 |
|
1103 |
pInstOsParams :: Field |
1104 |
pInstOsParams = |
1105 |
withDoc "OS parameters for instance" . |
1106 |
renameField "InstOsParams" . |
1107 |
defaultField [| toJSObject [] |] $ |
1108 |
simpleField "osparams" [t| JSObject JSValue |] |
1109 |
|
1110 |
pPrimaryNode :: Field |
1111 |
pPrimaryNode = |
1112 |
withDoc "Primary node for an instance" $ |
1113 |
optionalNEStringField "pnode" |
1114 |
|
1115 |
pPrimaryNodeUuid :: Field |
1116 |
pPrimaryNodeUuid = |
1117 |
withDoc "Primary node UUID for an instance" $ |
1118 |
optionalNEStringField "pnode_uuid" |
1119 |
|
1120 |
pSecondaryNode :: Field |
1121 |
pSecondaryNode = |
1122 |
withDoc "Secondary node for an instance" $ |
1123 |
optionalNEStringField "snode" |
1124 |
|
1125 |
pSecondaryNodeUuid :: Field |
1126 |
pSecondaryNodeUuid = |
1127 |
withDoc "Secondary node UUID for an instance" $ |
1128 |
optionalNEStringField "snode_uuid" |
1129 |
|
1130 |
pSourceHandshake :: Field |
1131 |
pSourceHandshake = |
1132 |
withDoc "Signed handshake from source (remote import only)" . |
1133 |
optionalField $ simpleField "source_handshake" [t| [JSValue] |] |
1134 |
|
1135 |
pSourceInstance :: Field |
1136 |
pSourceInstance = |
1137 |
withDoc "Source instance name (remote import only)" $ |
1138 |
optionalNEStringField "source_instance_name" |
1139 |
|
1140 |
-- FIXME: non-negative int, whereas the constant is a plain int. |
1141 |
pSourceShutdownTimeout :: Field |
1142 |
pSourceShutdownTimeout = |
1143 |
withDoc "How long source instance was given to shut down (remote import\ |
1144 |
\ only)" . |
1145 |
defaultField [| forceNonNeg C.defaultShutdownTimeout |] $ |
1146 |
simpleField "source_shutdown_timeout" [t| NonNegative Int |] |
1147 |
|
1148 |
pSourceX509Ca :: Field |
1149 |
pSourceX509Ca = |
1150 |
withDoc "Source X509 CA in PEM format (remote import only)" $ |
1151 |
optionalNEStringField "source_x509_ca" |
1152 |
|
1153 |
pSrcNode :: Field |
1154 |
pSrcNode = |
1155 |
withDoc "Source node for import" $ |
1156 |
optionalNEStringField "src_node" |
1157 |
|
1158 |
pSrcNodeUuid :: Field |
1159 |
pSrcNodeUuid = |
1160 |
withDoc "Source node UUID for import" $ |
1161 |
optionalNEStringField "src_node_uuid" |
1162 |
|
1163 |
pSrcPath :: Field |
1164 |
pSrcPath = |
1165 |
withDoc "Source directory for import" $ |
1166 |
optionalNEStringField "src_path" |
1167 |
|
1168 |
pStartInstance :: Field |
1169 |
pStartInstance = |
1170 |
withDoc "Whether to start instance after creation" $ |
1171 |
defaultTrue "start" |
1172 |
|
1173 |
-- FIXME: unify/simplify with pTags, once that migrates to NonEmpty String" |
1174 |
pInstTags :: Field |
1175 |
pInstTags = |
1176 |
withDoc "Instance tags" . |
1177 |
renameField "InstTags" . |
1178 |
defaultField [| [] |] $ |
1179 |
simpleField "tags" [t| [NonEmptyString] |] |
1180 |
|
1181 |
pMultiAllocInstances :: Field |
1182 |
pMultiAllocInstances = |
1183 |
withDoc "List of instance create opcodes describing the instances to\ |
1184 |
\ allocate" . |
1185 |
renameField "InstMultiAlloc" . |
1186 |
defaultField [| [] |] $ |
1187 |
simpleField "instances"[t| [JSValue] |] |
1188 |
|
1189 |
pOpportunisticLocking :: Field |
1190 |
pOpportunisticLocking = |
1191 |
withDoc "Whether to employ opportunistic locking for nodes, meaning\ |
1192 |
\ nodes already locked by another opcode won't be considered for\ |
1193 |
\ instance allocation (only when an iallocator is used)" $ |
1194 |
defaultFalse "opportunistic_locking" |
1195 |
|
1196 |
pInstanceUuid :: Field |
1197 |
pInstanceUuid = |
1198 |
withDoc "An instance UUID (for single-instance LUs)" . |
1199 |
optionalField $ simpleField "instance_uuid" [t| NonEmptyString |] |
1200 |
|
1201 |
pTempOsParams :: Field |
1202 |
pTempOsParams = |
1203 |
withDoc "Temporary OS parameters (currently only in reinstall, might be\ |
1204 |
\ added to install as well)" . |
1205 |
renameField "TempOsParams" . |
1206 |
optionalField $ simpleField "osparams" [t| JSObject JSValue |] |
1207 |
|
1208 |
pShutdownTimeout :: Field |
1209 |
pShutdownTimeout = |
1210 |
withDoc "How long to wait for instance to shut down" . |
1211 |
defaultField [| forceNonNeg C.defaultShutdownTimeout |] $ |
1212 |
simpleField "shutdown_timeout" [t| NonNegative Int |] |
1213 |
|
1214 |
pIgnoreFailures :: Field |
1215 |
pIgnoreFailures = |
1216 |
withDoc "Whether to ignore failures during removal" $ |
1217 |
defaultFalse "ignore_failures" |
1218 |
|
1219 |
pNewName :: Field |
1220 |
pNewName = |
1221 |
withDoc "New group or instance name" $ |
1222 |
simpleField "new_name" [t| NonEmptyString |] |
1223 |
|
1224 |
pIgnoreOfflineNodes :: Field |
1225 |
pIgnoreOfflineNodes = |
1226 |
withDoc "Whether to ignore offline nodes" $ |
1227 |
defaultFalse "ignore_offline_nodes" |
1228 |
|
1229 |
pTempHvParams :: Field |
1230 |
pTempHvParams = |
1231 |
withDoc "Temporary hypervisor parameters, hypervisor-dependent" . |
1232 |
renameField "TempHvParams" . |
1233 |
defaultField [| toJSObject [] |] $ |
1234 |
simpleField "hvparams" [t| JSObject JSValue |] |
1235 |
|
1236 |
pTempBeParams :: Field |
1237 |
pTempBeParams = |
1238 |
withDoc "Temporary backend parameters" . |
1239 |
renameField "TempBeParams" . |
1240 |
defaultField [| toJSObject [] |] $ |
1241 |
simpleField "beparams" [t| JSObject JSValue |] |
1242 |
|
1243 |
pNoRemember :: Field |
1244 |
pNoRemember = |
1245 |
withDoc "Do not remember instance state changes" $ |
1246 |
defaultFalse "no_remember" |
1247 |
|
1248 |
pStartupPaused :: Field |
1249 |
pStartupPaused = |
1250 |
withDoc "Pause instance at startup" $ |
1251 |
defaultFalse "startup_paused" |
1252 |
|
1253 |
pIgnoreSecondaries :: Field |
1254 |
pIgnoreSecondaries = |
1255 |
withDoc "Whether to start the instance even if secondary disks are failing" $ |
1256 |
defaultFalse "ignore_secondaries" |
1257 |
|
1258 |
pRebootType :: Field |
1259 |
pRebootType = |
1260 |
withDoc "How to reboot the instance" $ |
1261 |
simpleField "reboot_type" [t| RebootType |] |
1262 |
|
1263 |
pReplaceDisksMode :: Field |
1264 |
pReplaceDisksMode = |
1265 |
withDoc "Replacement mode" . |
1266 |
renameField "ReplaceDisksMode" $ simpleField "mode" [t| ReplaceDisksMode |] |
1267 |
|
1268 |
pReplaceDisksList :: Field |
1269 |
pReplaceDisksList = |
1270 |
withDoc "List of disk indices" . |
1271 |
renameField "ReplaceDisksList" . |
1272 |
defaultField [| [] |] $ |
1273 |
simpleField "disks" [t| [DiskIndex] |] |
1274 |
|
1275 |
pMigrationCleanup :: Field |
1276 |
pMigrationCleanup = |
1277 |
withDoc "Whether a previously failed migration should be cleaned up" . |
1278 |
renameField "MigrationCleanup" $ defaultFalse "cleanup" |
1279 |
|
1280 |
pAllowFailover :: Field |
1281 |
pAllowFailover = |
1282 |
withDoc "Whether we can fallback to failover if migration is not possible" $ |
1283 |
defaultFalse "allow_failover" |
1284 |
|
1285 |
pMoveTargetNode :: Field |
1286 |
pMoveTargetNode = |
1287 |
withDoc "Target node for instance move" . |
1288 |
renameField "MoveTargetNode" $ |
1289 |
simpleField "target_node" [t| NonEmptyString |] |
1290 |
|
1291 |
pMoveTargetNodeUuid :: Field |
1292 |
pMoveTargetNodeUuid = |
1293 |
withDoc "Target node UUID for instance move" . |
1294 |
renameField "MoveTargetNodeUuid" . optionalField $ |
1295 |
simpleField "target_node_uuid" [t| NonEmptyString |] |
1296 |
|
1297 |
pIgnoreDiskSize :: Field |
1298 |
pIgnoreDiskSize = |
1299 |
withDoc "Whether to ignore recorded disk size" $ |
1300 |
defaultFalse "ignore_size" |
1301 |
|
1302 |
pWaitForSyncFalse :: Field |
1303 |
pWaitForSyncFalse = |
1304 |
withDoc "Whether to wait for the disk to synchronize (defaults to false)" $ |
1305 |
defaultField [| False |] pWaitForSync |
1306 |
|
1307 |
pRecreateDisksInfo :: Field |
1308 |
pRecreateDisksInfo = |
1309 |
withDoc "Disk list for recreate disks" . |
1310 |
renameField "RecreateDisksInfo" . |
1311 |
defaultField [| RecreateDisksAll |] $ |
1312 |
simpleField "disks" [t| RecreateDisksInfo |] |
1313 |
|
1314 |
pStatic :: Field |
1315 |
pStatic = |
1316 |
withDoc "Whether to only return configuration data without querying nodes" $ |
1317 |
defaultFalse "static" |
1318 |
|
1319 |
pInstParamsNicChanges :: Field |
1320 |
pInstParamsNicChanges = |
1321 |
withDoc "List of NIC changes" . |
1322 |
renameField "InstNicChanges" . |
1323 |
defaultField [| SetParamsEmpty |] $ |
1324 |
simpleField "nics" [t| SetParamsMods INicParams |] |
1325 |
|
1326 |
pInstParamsDiskChanges :: Field |
1327 |
pInstParamsDiskChanges = |
1328 |
withDoc "List of disk changes" . |
1329 |
renameField "InstDiskChanges" . |
1330 |
defaultField [| SetParamsEmpty |] $ |
1331 |
simpleField "disks" [t| SetParamsMods IDiskParams |] |
1332 |
|
1333 |
pRuntimeMem :: Field |
1334 |
pRuntimeMem = |
1335 |
withDoc "New runtime memory" . |
1336 |
optionalField $ simpleField "runtime_mem" [t| Positive Int |] |
1337 |
|
1338 |
pOptDiskTemplate :: Field |
1339 |
pOptDiskTemplate = |
1340 |
withDoc "Instance disk template" . |
1341 |
optionalField . |
1342 |
renameField "OptDiskTemplate" $ |
1343 |
simpleField "disk_template" [t| DiskTemplate |] |
1344 |
|
1345 |
pOsNameChange :: Field |
1346 |
pOsNameChange = |
1347 |
withDoc "Change the instance's OS without reinstalling the instance" $ |
1348 |
optionalNEStringField "os_name" |
1349 |
|
1350 |
pDiskIndex :: Field |
1351 |
pDiskIndex = |
1352 |
withDoc "Disk index for e.g. grow disk" . |
1353 |
renameField "DiskIndex " $ simpleField "disk" [t| DiskIndex |] |
1354 |
|
1355 |
pDiskChgAmount :: Field |
1356 |
pDiskChgAmount = |
1357 |
withDoc "Disk amount to add or grow to" . |
1358 |
renameField "DiskChgAmount" $ simpleField "amount" [t| NonNegative Int |] |
1359 |
|
1360 |
pDiskChgAbsolute :: Field |
1361 |
pDiskChgAbsolute = |
1362 |
withDoc |
1363 |
"Whether the amount parameter is an absolute target or a relative one" . |
1364 |
renameField "DiskChkAbsolute" $ defaultFalse "absolute" |
1365 |
|
1366 |
pTargetGroups :: Field |
1367 |
pTargetGroups = |
1368 |
withDoc |
1369 |
"Destination group names or UUIDs (defaults to \"all but current group\")" . |
1370 |
optionalField $ simpleField "target_groups" [t| [NonEmptyString] |] |
1371 |
|
1372 |
pNodeGroupAllocPolicy :: Field |
1373 |
pNodeGroupAllocPolicy = |
1374 |
withDoc "Instance allocation policy" . |
1375 |
optionalField $ |
1376 |
simpleField "alloc_policy" [t| AllocPolicy |] |
1377 |
|
1378 |
pGroupNodeParams :: Field |
1379 |
pGroupNodeParams = |
1380 |
withDoc "Default node parameters for group" . |
1381 |
optionalField $ simpleField "ndparams" [t| JSObject JSValue |] |
1382 |
|
1383 |
pExportMode :: Field |
1384 |
pExportMode = |
1385 |
withDoc "Export mode" . |
1386 |
renameField "ExportMode" $ simpleField "mode" [t| ExportMode |] |
1387 |
|
1388 |
-- FIXME: Rename target_node as it changes meaning for different |
1389 |
-- export modes (e.g. "destination") |
1390 |
pExportTargetNode :: Field |
1391 |
pExportTargetNode = |
1392 |
withDoc "Target node (depends on export mode)" . |
1393 |
renameField "ExportTarget" $ |
1394 |
simpleField "target_node" [t| ExportTarget |] |
1395 |
|
1396 |
pExportTargetNodeUuid :: Field |
1397 |
pExportTargetNodeUuid = |
1398 |
withDoc "Target node UUID (if local export)" . |
1399 |
renameField "ExportTargetNodeUuid" . optionalField $ |
1400 |
simpleField "target_node_uuid" [t| NonEmptyString |] |
1401 |
|
1402 |
pShutdownInstance :: Field |
1403 |
pShutdownInstance = |
1404 |
withDoc "Whether to shutdown the instance before export" $ |
1405 |
defaultTrue "shutdown" |
1406 |
|
1407 |
pRemoveInstance :: Field |
1408 |
pRemoveInstance = |
1409 |
withDoc "Whether to remove instance after export" $ |
1410 |
defaultFalse "remove_instance" |
1411 |
|
1412 |
pIgnoreRemoveFailures :: Field |
1413 |
pIgnoreRemoveFailures = |
1414 |
withDoc "Whether to ignore failures while removing instances" $ |
1415 |
defaultFalse "ignore_remove_failures" |
1416 |
|
1417 |
pX509KeyName :: Field |
1418 |
pX509KeyName = |
1419 |
withDoc "Name of X509 key (remote export only)" . |
1420 |
optionalField $ simpleField "x509_key_name" [t| [JSValue] |] |
1421 |
|
1422 |
pX509DestCA :: Field |
1423 |
pX509DestCA = |
1424 |
withDoc "Destination X509 CA (remote export only)" $ |
1425 |
optionalNEStringField "destination_x509_ca" |
1426 |
|
1427 |
pTagsObject :: Field |
1428 |
pTagsObject = |
1429 |
withDoc "Tag kind" $ |
1430 |
simpleField "kind" [t| TagKind |] |
1431 |
|
1432 |
pTagsName :: Field |
1433 |
pTagsName = |
1434 |
withDoc "Name of object" . |
1435 |
renameField "TagsGetName" . |
1436 |
optionalField $ simpleField "name" [t| NonEmptyString |] |
1437 |
|
1438 |
pTagsList :: Field |
1439 |
pTagsList = |
1440 |
withDoc "List of tag names" $ |
1441 |
simpleField "tags" [t| [String] |] |
1442 |
|
1443 |
-- FIXME: this should be compiled at load time? |
1444 |
pTagSearchPattern :: Field |
1445 |
pTagSearchPattern = |
1446 |
withDoc "Search pattern (regular expression)" . |
1447 |
renameField "TagSearchPattern" $ |
1448 |
simpleField "pattern" [t| NonEmptyString |] |
1449 |
|
1450 |
pDelayDuration :: Field |
1451 |
pDelayDuration = |
1452 |
withDoc "Duration parameter for 'OpTestDelay'" . |
1453 |
renameField "DelayDuration" $ |
1454 |
simpleField "duration" [t| Double |] |
1455 |
|
1456 |
pDelayOnMaster :: Field |
1457 |
pDelayOnMaster = |
1458 |
withDoc "on_master field for 'OpTestDelay'" . |
1459 |
renameField "DelayOnMaster" $ |
1460 |
defaultTrue "on_master" |
1461 |
|
1462 |
pDelayOnNodes :: Field |
1463 |
pDelayOnNodes = |
1464 |
withDoc "on_nodes field for 'OpTestDelay'" . |
1465 |
renameField "DelayOnNodes" . |
1466 |
defaultField [| [] |] $ |
1467 |
simpleField "on_nodes" [t| [NonEmptyString] |] |
1468 |
|
1469 |
pDelayOnNodeUuids :: Field |
1470 |
pDelayOnNodeUuids = |
1471 |
withDoc "on_node_uuids field for 'OpTestDelay'" . |
1472 |
renameField "DelayOnNodeUuids" . optionalField $ |
1473 |
simpleField "on_node_uuids" [t| [NonEmptyString] |] |
1474 |
|
1475 |
pDelayRepeat :: Field |
1476 |
pDelayRepeat = |
1477 |
withDoc "Repeat parameter for OpTestDelay" . |
1478 |
renameField "DelayRepeat" . |
1479 |
defaultField [| forceNonNeg (0::Int) |] $ |
1480 |
simpleField "repeat" [t| NonNegative Int |] |
1481 |
|
1482 |
pIAllocatorDirection :: Field |
1483 |
pIAllocatorDirection = |
1484 |
withDoc "IAllocator test direction" . |
1485 |
renameField "IAllocatorDirection" $ |
1486 |
simpleField "direction" [t| IAllocatorTestDir |] |
1487 |
|
1488 |
pIAllocatorMode :: Field |
1489 |
pIAllocatorMode = |
1490 |
withDoc "IAllocator test mode" . |
1491 |
renameField "IAllocatorMode" $ |
1492 |
simpleField "mode" [t| IAllocatorMode |] |
1493 |
|
1494 |
pIAllocatorReqName :: Field |
1495 |
pIAllocatorReqName = |
1496 |
withDoc "IAllocator target name (new instance, node to evac, etc.)" . |
1497 |
renameField "IAllocatorReqName" $ simpleField "name" [t| NonEmptyString |] |
1498 |
|
1499 |
pIAllocatorNics :: Field |
1500 |
pIAllocatorNics = |
1501 |
withDoc "Custom OpTestIAllocator nics" . |
1502 |
renameField "IAllocatorNics" . |
1503 |
optionalField $ simpleField "nics" [t| [INicParams] |] |
1504 |
|
1505 |
pIAllocatorDisks :: Field |
1506 |
pIAllocatorDisks = |
1507 |
withDoc "Custom OpTestAllocator disks" . |
1508 |
renameField "IAllocatorDisks" . |
1509 |
optionalField $ simpleField "disks" [t| [JSValue] |] |
1510 |
|
1511 |
pIAllocatorMemory :: Field |
1512 |
pIAllocatorMemory = |
1513 |
withDoc "IAllocator memory field" . |
1514 |
renameField "IAllocatorMem" . |
1515 |
optionalField $ |
1516 |
simpleField "memory" [t| NonNegative Int |] |
1517 |
|
1518 |
pIAllocatorVCpus :: Field |
1519 |
pIAllocatorVCpus = |
1520 |
withDoc "IAllocator vcpus field" . |
1521 |
renameField "IAllocatorVCpus" . |
1522 |
optionalField $ |
1523 |
simpleField "vcpus" [t| NonNegative Int |] |
1524 |
|
1525 |
pIAllocatorOs :: Field |
1526 |
pIAllocatorOs = |
1527 |
withDoc "IAllocator os field" . |
1528 |
renameField "IAllocatorOs" $ optionalNEStringField "os" |
1529 |
|
1530 |
pIAllocatorInstances :: Field |
1531 |
pIAllocatorInstances = |
1532 |
withDoc "IAllocator instances field" . |
1533 |
renameField "IAllocatorInstances " . |
1534 |
optionalField $ |
1535 |
simpleField "instances" [t| [NonEmptyString] |] |
1536 |
|
1537 |
pIAllocatorEvacMode :: Field |
1538 |
pIAllocatorEvacMode = |
1539 |
withDoc "IAllocator evac mode" . |
1540 |
renameField "IAllocatorEvacMode" . |
1541 |
optionalField $ |
1542 |
simpleField "evac_mode" [t| NodeEvacMode |] |
1543 |
|
1544 |
pIAllocatorSpindleUse :: Field |
1545 |
pIAllocatorSpindleUse = |
1546 |
withDoc "IAllocator spindle use" . |
1547 |
renameField "IAllocatorSpindleUse" . |
1548 |
defaultField [| forceNonNeg (1::Int) |] $ |
1549 |
simpleField "spindle_use" [t| NonNegative Int |] |
1550 |
|
1551 |
pIAllocatorCount :: Field |
1552 |
pIAllocatorCount = |
1553 |
withDoc "IAllocator count field" . |
1554 |
renameField "IAllocatorCount" . |
1555 |
defaultField [| forceNonNeg (1::Int) |] $ |
1556 |
simpleField "count" [t| NonNegative Int |] |
1557 |
|
1558 |
pJQueueNotifyWaitLock :: Field |
1559 |
pJQueueNotifyWaitLock = |
1560 |
withDoc "'OpTestJqueue' notify_waitlock" $ |
1561 |
defaultFalse "notify_waitlock" |
1562 |
|
1563 |
pJQueueNotifyExec :: Field |
1564 |
pJQueueNotifyExec = |
1565 |
withDoc "'OpTestJQueue' notify_exec" $ |
1566 |
defaultFalse "notify_exec" |
1567 |
|
1568 |
pJQueueLogMessages :: Field |
1569 |
pJQueueLogMessages = |
1570 |
withDoc "'OpTestJQueue' log_messages" . |
1571 |
defaultField [| [] |] $ simpleField "log_messages" [t| [String] |] |
1572 |
|
1573 |
pJQueueFail :: Field |
1574 |
pJQueueFail = |
1575 |
withDoc "'OpTestJQueue' fail attribute" . |
1576 |
renameField "JQueueFail" $ defaultFalse "fail" |
1577 |
|
1578 |
pTestDummyResult :: Field |
1579 |
pTestDummyResult = |
1580 |
withDoc "'OpTestDummy' result field" . |
1581 |
renameField "TestDummyResult" $ simpleField "result" [t| JSValue |] |
1582 |
|
1583 |
pTestDummyMessages :: Field |
1584 |
pTestDummyMessages = |
1585 |
withDoc "'OpTestDummy' messages field" . |
1586 |
renameField "TestDummyMessages" $ |
1587 |
simpleField "messages" [t| JSValue |] |
1588 |
|
1589 |
pTestDummyFail :: Field |
1590 |
pTestDummyFail = |
1591 |
withDoc "'OpTestDummy' fail field" . |
1592 |
renameField "TestDummyFail" $ simpleField "fail" [t| JSValue |] |
1593 |
|
1594 |
pTestDummySubmitJobs :: Field |
1595 |
pTestDummySubmitJobs = |
1596 |
withDoc "'OpTestDummy' submit_jobs field" . |
1597 |
renameField "TestDummySubmitJobs" $ |
1598 |
simpleField "submit_jobs" [t| JSValue |] |
1599 |
|
1600 |
pNetworkName :: Field |
1601 |
pNetworkName = |
1602 |
withDoc "Network name" $ |
1603 |
simpleField "network_name" [t| NonEmptyString |] |
1604 |
|
1605 |
pNetworkAddress4 :: Field |
1606 |
pNetworkAddress4 = |
1607 |
withDoc "Network address (IPv4 subnet)" . |
1608 |
renameField "NetworkAddress4" $ |
1609 |
simpleField "network" [t| IPv4Network |] |
1610 |
|
1611 |
pNetworkGateway4 :: Field |
1612 |
pNetworkGateway4 = |
1613 |
withDoc "Network gateway (IPv4 address)" . |
1614 |
renameField "NetworkGateway4" . |
1615 |
optionalField $ simpleField "gateway" [t| IPv4Address |] |
1616 |
|
1617 |
pNetworkAddress6 :: Field |
1618 |
pNetworkAddress6 = |
1619 |
withDoc "Network address (IPv6 subnet)" . |
1620 |
renameField "NetworkAddress6" . |
1621 |
optionalField $ simpleField "network6" [t| IPv6Network |] |
1622 |
|
1623 |
pNetworkGateway6 :: Field |
1624 |
pNetworkGateway6 = |
1625 |
withDoc "Network gateway (IPv6 address)" . |
1626 |
renameField "NetworkGateway6" . |
1627 |
optionalField $ simpleField "gateway6" [t| IPv6Address |] |
1628 |
|
1629 |
pNetworkMacPrefix :: Field |
1630 |
pNetworkMacPrefix = |
1631 |
withDoc "Network specific mac prefix (that overrides the cluster one)" . |
1632 |
renameField "NetMacPrefix" $ |
1633 |
optionalNEStringField "mac_prefix" |
1634 |
|
1635 |
pNetworkAddRsvdIps :: Field |
1636 |
pNetworkAddRsvdIps = |
1637 |
withDoc "Which IP addresses to reserve" . |
1638 |
renameField "NetworkAddRsvdIps" . |
1639 |
optionalField $ |
1640 |
simpleField "add_reserved_ips" [t| [IPv4Address] |] |
1641 |
|
1642 |
pNetworkRemoveRsvdIps :: Field |
1643 |
pNetworkRemoveRsvdIps = |
1644 |
withDoc "Which external IP addresses to release" . |
1645 |
renameField "NetworkRemoveRsvdIps" . |
1646 |
optionalField $ |
1647 |
simpleField "remove_reserved_ips" [t| [IPv4Address] |] |
1648 |
|
1649 |
pNetworkMode :: Field |
1650 |
pNetworkMode = |
1651 |
withDoc "Network mode when connecting to a group" $ |
1652 |
simpleField "network_mode" [t| NICMode |] |
1653 |
|
1654 |
pNetworkLink :: Field |
1655 |
pNetworkLink = |
1656 |
withDoc "Network link when connecting to a group" $ |
1657 |
simpleField "network_link" [t| NonEmptyString |] |