b5a56195399b3a00843d7763b804e1c2182961ab
[ganeti-github.git] / src / Ganeti / OpParams.hs
1 {-# LANGUAGE TemplateHaskell, StandaloneDeriving #-}
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, 2014 Google Inc.
16 All rights reserved.
17
18 Redistribution and use in source and binary forms, with or without
19 modification, are permitted provided that the following conditions are
20 met:
21
22 1. Redistributions of source code must retain the above copyright notice,
23 this list of conditions and the following disclaimer.
24
25 2. Redistributions in binary form must reproduce the above copyright
26 notice, this list of conditions and the following disclaimer in the
27 documentation and/or other materials provided with the distribution.
28
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
30 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
31 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
33 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
34 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
35 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
36 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
41 -}
42
43 module Ganeti.OpParams
44 ( ReplaceDisksMode(..)
45 , DiskIndex
46 , mkDiskIndex
47 , unDiskIndex
48 , DiskAccess(..)
49 , INicParams(..)
50 , IDiskParams(..)
51 , RecreateDisksInfo(..)
52 , DdmOldChanges(..)
53 , SetParamsMods(..)
54 , ExportTarget(..)
55 , pInstanceName
56 , pInstallImage
57 , pInstanceCommunication
58 , pOptInstanceCommunication
59 , pInstanceUuid
60 , pInstances
61 , pName
62 , pTagsList
63 , pTagsObject
64 , pTagsName
65 , pOutputFields
66 , pShutdownTimeout
67 , pShutdownTimeout'
68 , pShutdownInstance
69 , pForce
70 , pIgnoreOfflineNodes
71 , pIgnoreHVVersions
72 , pNodeName
73 , pNodeUuid
74 , pNodeNames
75 , pNodeUuids
76 , pGroupName
77 , pMigrationMode
78 , pMigrationLive
79 , pMigrationCleanup
80 , pForceVariant
81 , pWaitForSync
82 , pWaitForSyncFalse
83 , pIgnoreConsistency
84 , pStorageName
85 , pUseLocking
86 , pOpportunisticLocking
87 , pNameCheck
88 , pNodeGroupAllocPolicy
89 , pGroupNodeParams
90 , pQueryWhat
91 , pEarlyRelease
92 , pIpCheck
93 , pIpConflictsCheck
94 , pNoRemember
95 , pMigrationTargetNode
96 , pMigrationTargetNodeUuid
97 , pMoveTargetNode
98 , pMoveTargetNodeUuid
99 , pMoveCompress
100 , pBackupCompress
101 , pStartupPaused
102 , pVerbose
103 , pDebug
104 , pDebugSimulateErrors
105 , pErrorCodes
106 , pSkipChecks
107 , pIgnoreErrors
108 , pOptGroupName
109 , pGroupDiskParams
110 , pHvState
111 , pDiskState
112 , pIgnoreIpolicy
113 , pHotplug
114 , pHotplugIfPossible
115 , pAllowRuntimeChgs
116 , pInstDisks
117 , pDiskTemplate
118 , pOptDiskTemplate
119 , pExtParams
120 , pFileDriver
121 , pFileStorageDir
122 , pClusterFileStorageDir
123 , pClusterSharedFileStorageDir
124 , pClusterGlusterStorageDir
125 , pInstanceCommunicationNetwork
126 , pZeroingImage
127 , pCompressionTools
128 , pVgName
129 , pEnabledHypervisors
130 , pHypervisor
131 , pClusterHvParams
132 , pInstHvParams
133 , pClusterBeParams
134 , pInstBeParams
135 , pResetDefaults
136 , pOsHvp
137 , pClusterOsParams
138 , pClusterOsParamsPrivate
139 , pInstOsParams
140 , pInstOsParamsPrivate
141 , pInstOsParamsSecret
142 , pInstOsParamsClear
143 , pInstOsParamsPrivateClear
144 , pInstOsParamsRemove
145 , pInstOsParamsPrivateRemove
146 , pCandidatePoolSize
147 , pMaxRunningJobs
148 , pMaxTrackedJobs
149 , pUidPool
150 , pAddUids
151 , pRemoveUids
152 , pMaintainNodeHealth
153 , pModifyEtcHosts
154 , pModifySshSetup
155 , pPreallocWipeDisks
156 , pNicParams
157 , pInstNics
158 , pNdParams
159 , pIpolicy
160 , pDrbdHelper
161 , pDefaultIAllocator
162 , pDefaultIAllocatorParams
163 , pMasterNetdev
164 , pMasterNetmask
165 , pReservedLvs
166 , pHiddenOs
167 , pBlacklistedOs
168 , pUseExternalMipScript
169 , pQueryFields
170 , pQueryFilter
171 , pQueryFieldsFields
172 , pOobCommand
173 , pOobTimeout
174 , pIgnoreStatus
175 , pPowerDelay
176 , pPrimaryIp
177 , pSecondaryIp
178 , pReadd
179 , pNodeGroup
180 , pMasterCapable
181 , pVmCapable
182 , pNames
183 , pNodes
184 , pRequiredNodes
185 , pRequiredNodeUuids
186 , pStorageType
187 , pOptStorageType
188 , pStorageChanges
189 , pMasterCandidate
190 , pOffline
191 , pDrained
192 , pAutoPromote
193 , pPowered
194 , pIallocator
195 , pRemoteNode
196 , pRemoteNodeUuid
197 , pEvacMode
198 , pIgnoreSoftErrors
199 , pInstCreateMode
200 , pNoInstall
201 , pInstOs
202 , pPrimaryNode
203 , pPrimaryNodeUuid
204 , pSecondaryNode
205 , pSecondaryNodeUuid
206 , pSourceHandshake
207 , pSourceInstance
208 , pSourceShutdownTimeout
209 , pSourceX509Ca
210 , pSrcNode
211 , pSrcNodeUuid
212 , pSrcPath
213 , pStartInstance
214 , pForthcoming
215 , pCommit
216 , pInstTags
217 , pMultiAllocInstances
218 , pTempOsParams
219 , pTempOsParamsPrivate
220 , pTempOsParamsSecret
221 , pTempOsParamsClear
222 , pTempOsParamsPrivateClear
223 , pTempOsParamsRemove
224 , pTempOsParamsPrivateRemove
225 , pTempHvParams
226 , pTempBeParams
227 , pIgnoreFailures
228 , pNewName
229 , pIgnoreSecondaries
230 , pRebootType
231 , pIgnoreDiskSize
232 , pRecreateDisksInfo
233 , pStatic
234 , pInstParamsNicChanges
235 , pInstParamsDiskChanges
236 , pRuntimeMem
237 , pOsNameChange
238 , pDiskIndex
239 , pDiskChgAmount
240 , pDiskChgAbsolute
241 , pTargetGroups
242 , pExportMode
243 , pExportTargetNode
244 , pExportTargetNodeUuid
245 , pRemoveInstance
246 , pIgnoreRemoveFailures
247 , pX509KeyName
248 , pX509DestCA
249 , pZeroFreeSpace
250 , pHelperStartupTimeout
251 , pHelperShutdownTimeout
252 , pZeroingTimeoutFixed
253 , pZeroingTimeoutPerMiB
254 , pTagSearchPattern
255 , pRestrictedCommand
256 , pRepairCommand
257 , pInput
258 , pReplaceDisksMode
259 , pReplaceDisksList
260 , pAllowFailover
261 , pForceFailover
262 , pDelayDuration
263 , pDelayOnMaster
264 , pDelayOnNodes
265 , pDelayOnNodeUuids
266 , pDelayRepeat
267 , pDelayInterruptible
268 , pDelayNoLocks
269 , pIAllocatorDirection
270 , pIAllocatorMode
271 , pIAllocatorReqName
272 , pIAllocatorNics
273 , pIAllocatorDisks
274 , pIAllocatorMemory
275 , pIAllocatorVCpus
276 , pIAllocatorOs
277 , pIAllocatorInstances
278 , pIAllocatorEvacMode
279 , pIAllocatorSpindleUse
280 , pIAllocatorCount
281 , pJQueueNotifyWaitLock
282 , pJQueueNotifyExec
283 , pJQueueLogMessages
284 , pJQueueFail
285 , pTestDummyResult
286 , pTestDummyMessages
287 , pTestDummyFail
288 , pTestDummySubmitJobs
289 , pNetworkName
290 , pNetworkAddress4
291 , pNetworkGateway4
292 , pNetworkAddress6
293 , pNetworkGateway6
294 , pNetworkMacPrefix
295 , pNetworkAddRsvdIps
296 , pNetworkRemoveRsvdIps
297 , pNetworkMode
298 , pNetworkLink
299 , pNetworkVlan
300 , pDryRun
301 , pDebugLevel
302 , pOpPriority
303 , pDependencies
304 , pComment
305 , pReason
306 , pSequential
307 , pEnabledDiskTemplates
308 , pEnabledUserShutdown
309 , pAdminStateSource
310 , pEnabledDataCollectors
311 , pMaintdRoundDelay
312 , pMaintdEnableBalancing
313 , pMaintdBalancingThreshold
314 , pDataCollectorInterval
315 , pDiagnoseDataCollectorFilename
316 , pNodeSslCerts
317 , pSshKeyBits
318 , pSshKeyType
319 , pRenewSshKeys
320 , pNodeSetup
321 , pVerifyClutter
322 , pLongSleep
323 , pIsStrict
324 ) where
325
326 import Control.Monad (liftM, mplus)
327 import Text.JSON (JSON, JSValue(..), JSObject (..), readJSON, showJSON,
328 fromJSString, toJSObject)
329 import qualified Text.JSON
330 import Text.JSON.Pretty (pp_value)
331
332 import Ganeti.BasicTypes
333 import qualified Ganeti.Constants as C
334 import Ganeti.THH
335 import Ganeti.THH.Field
336 import Ganeti.Utils
337 import Ganeti.JSON (GenericContainer)
338 import Ganeti.Types
339 import qualified Ganeti.Query.Language as Qlang
340
341 -- * Helper functions and types
342
343 -- | Build a boolean field.
344 booleanField :: String -> Field
345 booleanField = flip simpleField [t| Bool |]
346
347 -- | Default a field to 'False'.
348 defaultFalse :: String -> Field
349 defaultFalse = defaultField [| False |] . booleanField
350
351 -- | Default a field to 'True'.
352 defaultTrue :: String -> Field
353 defaultTrue = defaultField [| True |] . booleanField
354
355 -- | An alias for a 'String' field.
356 stringField :: String -> Field
357 stringField = flip simpleField [t| String |]
358
359 -- | An alias for an optional string field.
360 optionalStringField :: String -> Field
361 optionalStringField = optionalField . stringField
362
363 -- | An alias for an optional non-empty string field.
364 optionalNEStringField :: String -> Field
365 optionalNEStringField = optionalField . flip simpleField [t| NonEmptyString |]
366
367 -- | Function to force a non-negative value, without returning via a
368 -- monad. This is needed for, and should be used /only/ in the case of
369 -- forcing constants. In case the constant is wrong (< 0), this will
370 -- become a runtime error.
371 forceNonNeg :: (Num a, Ord a, Show a) => a -> NonNegative a
372 forceNonNeg i = case mkNonNegative i of
373 Ok n -> n
374 Bad msg -> error msg
375
376 -- ** Disks
377
378 -- | Disk index type (embedding constraints on the index value via a
379 -- smart constructor).
380 newtype DiskIndex = DiskIndex { unDiskIndex :: Int }
381 deriving (Show, Eq, Ord)
382
383 -- | Smart constructor for 'DiskIndex'.
384 mkDiskIndex :: (Monad m) => Int -> m DiskIndex
385 mkDiskIndex i | i >= 0 && i < C.maxDisks = return (DiskIndex i)
386 | otherwise = fail $ "Invalid value for disk index '" ++
387 show i ++ "', required between 0 and " ++
388 show C.maxDisks
389
390 instance JSON DiskIndex where
391 readJSON v = readJSON v >>= mkDiskIndex
392 showJSON = showJSON . unDiskIndex
393
394 -- ** I* param types
395
396 -- | Type holding disk access modes.
397 $(declareSADT "DiskAccess"
398 [ ("DiskReadOnly", 'C.diskRdonly)
399 , ("DiskReadWrite", 'C.diskRdwr)
400 ])
401 $(makeJSONInstance ''DiskAccess)
402
403 -- | NIC modification definition.
404 $(buildObject "INicParams" "inic"
405 [ optionalField $ simpleField C.inicMac [t| NonEmptyString |]
406 , optionalField $ simpleField C.inicIp [t| String |]
407 , optionalField $ simpleField C.inicMode [t| NonEmptyString |]
408 , optionalField $ simpleField C.inicLink [t| NonEmptyString |]
409 , optionalField $ simpleField C.inicName [t| NonEmptyString |]
410 , optionalField $ simpleField C.inicVlan [t| String |]
411 , optionalField $ simpleField C.inicBridge [t| NonEmptyString |]
412 , optionalField $ simpleField C.inicNetwork [t| NonEmptyString |]
413 ])
414
415 deriving instance Ord INicParams
416
417 -- | Disk modification definition.
418 $(buildObject "IDiskParams" "idisk"
419 [ specialNumericalField 'parseUnitAssumeBinary . optionalField
420 $ simpleField C.idiskSize [t| Int |]
421 , optionalField $ simpleField C.idiskMode [t| DiskAccess |]
422 , optionalField $ simpleField C.idiskAdopt [t| NonEmptyString |]
423 , optionalField $ simpleField C.idiskVg [t| NonEmptyString |]
424 , optionalField $ simpleField C.idiskMetavg [t| NonEmptyString |]
425 , optionalField $ simpleField C.idiskName [t| NonEmptyString |]
426 , optionalField $ simpleField C.idiskProvider [t| NonEmptyString |]
427 , optionalField $ simpleField C.idiskSpindles [t| Int |]
428 , optionalField $ simpleField C.idiskAccess [t| NonEmptyString |]
429 , andRestArguments "opaque"
430 ])
431
432 deriving instance Ord IDiskParams
433
434 -- | Disk changes type for OpInstanceRecreateDisks. This is a bit
435 -- strange, because the type in Python is something like Either
436 -- [DiskIndex] [DiskChanges], but we can't represent the type of an
437 -- empty list in JSON, so we have to add a custom case for the empty
438 -- list.
439 data RecreateDisksInfo
440 = RecreateDisksAll
441 | RecreateDisksIndices (NonEmpty DiskIndex)
442 | RecreateDisksParams (NonEmpty (DiskIndex, IDiskParams))
443 deriving (Eq, Show, Ord)
444
445 readRecreateDisks :: JSValue -> Text.JSON.Result RecreateDisksInfo
446 readRecreateDisks (JSArray []) = return RecreateDisksAll
447 readRecreateDisks v =
448 case readJSON v::Text.JSON.Result [DiskIndex] of
449 Text.JSON.Ok indices -> liftM RecreateDisksIndices (mkNonEmpty indices)
450 _ -> case readJSON v::Text.JSON.Result [(DiskIndex, IDiskParams)] of
451 Text.JSON.Ok params -> liftM RecreateDisksParams (mkNonEmpty params)
452 _ -> fail $ "Can't parse disk information as either list of disk"
453 ++ " indices or list of disk parameters; value received:"
454 ++ show (pp_value v)
455
456 instance JSON RecreateDisksInfo where
457 readJSON = readRecreateDisks
458 showJSON RecreateDisksAll = showJSON ()
459 showJSON (RecreateDisksIndices idx) = showJSON idx
460 showJSON (RecreateDisksParams params) = showJSON params
461
462 -- | Simple type for old-style ddm changes.
463 data DdmOldChanges = DdmOldIndex (NonNegative Int)
464 | DdmOldMod DdmSimple
465 deriving (Eq, Show, Ord)
466
467 readDdmOldChanges :: JSValue -> Text.JSON.Result DdmOldChanges
468 readDdmOldChanges v =
469 case readJSON v::Text.JSON.Result (NonNegative Int) of
470 Text.JSON.Ok nn -> return $ DdmOldIndex nn
471 _ -> case readJSON v::Text.JSON.Result DdmSimple of
472 Text.JSON.Ok ddms -> return $ DdmOldMod ddms
473 _ -> fail $ "Can't parse value '" ++ show (pp_value v) ++ "' as"
474 ++ " either index or modification"
475
476 instance JSON DdmOldChanges where
477 showJSON (DdmOldIndex i) = showJSON i
478 showJSON (DdmOldMod m) = showJSON m
479 readJSON = readDdmOldChanges
480
481 -- | Instance disk or nic modifications.
482 data SetParamsMods a
483 = SetParamsEmpty
484 | SetParamsDeprecated (NonEmpty (DdmOldChanges, a))
485 | SetParamsNew (NonEmpty (DdmFull, Int, a))
486 | SetParamsNewName (NonEmpty (DdmFull, String, a))
487 deriving (Eq, Show, Ord)
488
489 -- | Custom deserialiser for 'SetParamsMods'.
490 readSetParams :: (JSON a) => JSValue -> Text.JSON.Result (SetParamsMods a)
491 readSetParams (JSArray []) = return SetParamsEmpty
492 readSetParams v =
493 liftM SetParamsDeprecated (readJSON v)
494 `mplus` liftM SetParamsNew (readJSON v)
495 `mplus` liftM SetParamsNewName (readJSON v)
496
497 instance (JSON a) => JSON (SetParamsMods a) where
498 showJSON SetParamsEmpty = showJSON ()
499 showJSON (SetParamsDeprecated v) = showJSON v
500 showJSON (SetParamsNew v) = showJSON v
501 showJSON (SetParamsNewName v) = showJSON v
502 readJSON = readSetParams
503
504 -- | Custom type for target_node parameter of OpBackupExport, which
505 -- varies depending on mode. FIXME: this uses an [JSValue] since
506 -- we don't care about individual rows (just like the Python code
507 -- tests). But the proper type could be parsed if we wanted.
508 data ExportTarget = ExportTargetLocal NonEmptyString
509 | ExportTargetRemote [JSValue]
510 deriving (Eq, Show, Ord)
511
512 -- | Custom reader for 'ExportTarget'.
513 readExportTarget :: JSValue -> Text.JSON.Result ExportTarget
514 readExportTarget (JSString s) = liftM ExportTargetLocal $
515 mkNonEmpty (fromJSString s)
516 readExportTarget (JSArray arr) = return $ ExportTargetRemote arr
517 readExportTarget v = fail $ "Invalid value received for 'target_node': " ++
518 show (pp_value v)
519
520 instance JSON ExportTarget where
521 showJSON (ExportTargetLocal s) = showJSON s
522 showJSON (ExportTargetRemote l) = showJSON l
523 readJSON = readExportTarget
524
525 -- * Common opcode parameters
526
527 pDryRun :: Field
528 pDryRun =
529 withDoc "Run checks only, don't execute" .
530 optionalField $ booleanField "dry_run"
531
532 pDebugLevel :: Field
533 pDebugLevel =
534 withDoc "Debug level" .
535 optionalField $ simpleField "debug_level" [t| NonNegative Int |]
536
537 pOpPriority :: Field
538 pOpPriority =
539 withDoc "Opcode priority. Note: python uses a separate constant,\
540 \ we're using the actual value we know it's the default" .
541 defaultField [| OpPrioNormal |] $
542 simpleField "priority" [t| OpSubmitPriority |]
543
544 pDependencies :: Field
545 pDependencies =
546 withDoc "Job dependencies" .
547 optionalNullSerField $ simpleField "depends" [t| [JobDependency] |]
548
549 pComment :: Field
550 pComment =
551 withDoc "Comment field" .
552 optionalNullSerField $ stringField "comment"
553
554 pReason :: Field
555 pReason =
556 withDoc "Reason trail field" $
557 simpleField C.opcodeReason [t| ReasonTrail |]
558
559 pSequential :: Field
560 pSequential =
561 withDoc "Sequential job execution" $
562 defaultFalse C.opcodeSequential
563
564 -- * Parameters
565
566 pDebugSimulateErrors :: Field
567 pDebugSimulateErrors =
568 withDoc "Whether to simulate errors (useful for debugging)" $
569 defaultFalse "debug_simulate_errors"
570
571 pErrorCodes :: Field
572 pErrorCodes =
573 withDoc "Error codes" $
574 defaultFalse "error_codes"
575
576 pSkipChecks :: Field
577 pSkipChecks =
578 withDoc "Which checks to skip" .
579 defaultField [| emptyListSet |] $
580 simpleField "skip_checks" [t| ListSet VerifyOptionalChecks |]
581
582 pIgnoreErrors :: Field
583 pIgnoreErrors =
584 withDoc "List of error codes that should be treated as warnings" .
585 defaultField [| emptyListSet |] $
586 simpleField "ignore_errors" [t| ListSet CVErrorCode |]
587
588 pVerbose :: Field
589 pVerbose =
590 withDoc "Verbose mode" $
591 defaultFalse "verbose"
592
593 pDebug :: Field
594 pDebug =
595 withDoc "Debug mode" $
596 defaultFalse "debug"
597
598 pOptGroupName :: Field
599 pOptGroupName =
600 withDoc "Optional group name" .
601 renameField "OptGroupName" .
602 optionalField $ simpleField "group_name" [t| NonEmptyString |]
603
604 pGroupName :: Field
605 pGroupName =
606 withDoc "Group name" $
607 simpleField "group_name" [t| NonEmptyString |]
608
609 -- | Whether to hotplug device.
610 pHotplug :: Field
611 pHotplug = defaultFalse "hotplug"
612
613 pHotplugIfPossible :: Field
614 pHotplugIfPossible = defaultFalse "hotplug_if_possible"
615
616 pInstances :: Field
617 pInstances =
618 withDoc "List of instances" .
619 defaultField [| [] |] $
620 simpleField "instances" [t| [NonEmptyString] |]
621
622 pOutputFields :: Field
623 pOutputFields =
624 withDoc "Selected output fields" $
625 simpleField "output_fields" [t| [NonEmptyString] |]
626
627 pName :: Field
628 pName =
629 withDoc "A generic name" $
630 simpleField "name" [t| NonEmptyString |]
631
632 pForce :: Field
633 pForce =
634 withDoc "Whether to force the operation" $
635 defaultFalse "force"
636
637 pHvState :: Field
638 pHvState =
639 withDoc "Set hypervisor states" .
640 optionalField $ simpleField "hv_state" [t| JSObject JSValue |]
641
642 pDiskState :: Field
643 pDiskState =
644 withDoc "Set disk states" .
645 optionalField $ simpleField "disk_state" [t| JSObject JSValue |]
646
647 -- | Cluster-wide default directory for storing file-backed disks.
648 pClusterFileStorageDir :: Field
649 pClusterFileStorageDir =
650 renameField "ClusterFileStorageDir" $
651 optionalStringField "file_storage_dir"
652
653 -- | Cluster-wide default directory for storing shared-file-backed disks.
654 pClusterSharedFileStorageDir :: Field
655 pClusterSharedFileStorageDir =
656 renameField "ClusterSharedFileStorageDir" $
657 optionalStringField "shared_file_storage_dir"
658
659 -- | Cluster-wide default directory for storing Gluster-backed disks.
660 pClusterGlusterStorageDir :: Field
661 pClusterGlusterStorageDir =
662 renameField "ClusterGlusterStorageDir" $
663 optionalStringField "gluster_storage_dir"
664
665 pInstallImage :: Field
666 pInstallImage =
667 withDoc "OS image for running OS scripts in a safe environment" $
668 optionalStringField "install_image"
669
670 pInstanceCommunicationNetwork :: Field
671 pInstanceCommunicationNetwork =
672 optionalStringField "instance_communication_network"
673
674 -- | The OS to use when zeroing instance disks.
675 pZeroingImage :: Field
676 pZeroingImage =
677 optionalStringField "zeroing_image"
678
679 -- | The additional tools that can be used to compress data in transit
680 pCompressionTools :: Field
681 pCompressionTools =
682 withDoc "List of enabled compression tools" . optionalField $
683 simpleField "compression_tools" [t| [NonEmptyString] |]
684
685 -- | Volume group name.
686 pVgName :: Field
687 pVgName =
688 withDoc "Volume group name" $
689 optionalStringField "vg_name"
690
691 pEnabledHypervisors :: Field
692 pEnabledHypervisors =
693 withDoc "List of enabled hypervisors" .
694 optionalField $
695 simpleField "enabled_hypervisors" [t| [Hypervisor] |]
696
697 pClusterHvParams :: Field
698 pClusterHvParams =
699 withDoc "Cluster-wide hypervisor parameters, hypervisor-dependent" .
700 renameField "ClusterHvParams" .
701 optionalField $
702 simpleField "hvparams" [t| GenericContainer String (JSObject JSValue) |]
703
704 pClusterBeParams :: Field
705 pClusterBeParams =
706 withDoc "Cluster-wide backend parameter defaults" .
707 renameField "ClusterBeParams" .
708 optionalField $ simpleField "beparams" [t| JSObject JSValue |]
709
710 pOsHvp :: Field
711 pOsHvp =
712 withDoc "Cluster-wide per-OS hypervisor parameter defaults" .
713 optionalField $
714 simpleField "os_hvp" [t| GenericContainer String (JSObject JSValue) |]
715
716 pClusterOsParams :: Field
717 pClusterOsParams =
718 withDoc "Cluster-wide OS parameter defaults" .
719 renameField "ClusterOsParams" .
720 optionalField $
721 simpleField "osparams" [t| GenericContainer String (JSObject JSValue) |]
722
723 pClusterOsParamsPrivate :: Field
724 pClusterOsParamsPrivate =
725 withDoc "Cluster-wide private OS parameter defaults" .
726 renameField "ClusterOsParamsPrivate" .
727 optionalField $
728 -- This field needs an unique name to aid Python deserialization
729 simpleField "osparams_private_cluster"
730 [t| GenericContainer String (JSObject (Private JSValue)) |]
731
732 pGroupDiskParams :: Field
733 pGroupDiskParams =
734 withDoc "Disk templates' parameter defaults" .
735 optionalField $
736 simpleField "diskparams"
737 [t| GenericContainer DiskTemplate (JSObject JSValue) |]
738
739 pCandidatePoolSize :: Field
740 pCandidatePoolSize =
741 withDoc "Master candidate pool size" .
742 optionalField $ simpleField "candidate_pool_size" [t| Positive Int |]
743
744 pMaxRunningJobs :: Field
745 pMaxRunningJobs =
746 withDoc "Maximal number of jobs to run simultaneously" .
747 optionalField $ simpleField "max_running_jobs" [t| Positive Int |]
748
749 pMaxTrackedJobs :: Field
750 pMaxTrackedJobs =
751 withDoc "Maximal number of jobs tracked in the job queue" .
752 optionalField $ simpleField "max_tracked_jobs" [t| Positive Int |]
753
754
755 pUidPool :: Field
756 pUidPool =
757 withDoc "Set UID pool, must be list of lists describing UID ranges\
758 \ (two items, start and end inclusive)" .
759 optionalField $ simpleField "uid_pool" [t| [(Int, Int)] |]
760
761 pAddUids :: Field
762 pAddUids =
763 withDoc "Extend UID pool, must be list of lists describing UID\
764 \ ranges (two items, start and end inclusive)" .
765 optionalField $ simpleField "add_uids" [t| [(Int, Int)] |]
766
767 pRemoveUids :: Field
768 pRemoveUids =
769 withDoc "Shrink UID pool, must be list of lists describing UID\
770 \ ranges (two items, start and end inclusive) to be removed" .
771 optionalField $ simpleField "remove_uids" [t| [(Int, Int)] |]
772
773 pMaintainNodeHealth :: Field
774 pMaintainNodeHealth =
775 withDoc "Whether to automatically maintain node health" .
776 optionalField $ booleanField "maintain_node_health"
777
778 -- | Whether to modify and keep in sync the @/etc/hosts@ files of nodes.
779 pModifyEtcHosts :: Field
780 pModifyEtcHosts = optionalField $ booleanField "modify_etc_hosts"
781
782 -- | Whether to modify SSH setup on node add or when renewing crypto
783 pModifySshSetup :: Field
784 pModifySshSetup = optionalField $ booleanField "modify_ssh_setup"
785
786 -- | Whether to wipe disks before allocating them to instances.
787 pPreallocWipeDisks :: Field
788 pPreallocWipeDisks =
789 withDoc "Whether to wipe disks before allocating them to instances" .
790 optionalField $ booleanField "prealloc_wipe_disks"
791
792 pNicParams :: Field
793 pNicParams =
794 withDoc "Cluster-wide NIC parameter defaults" .
795 optionalField $ simpleField "nicparams" [t| INicParams |]
796
797 pIpolicy :: Field
798 pIpolicy =
799 withDoc "Ipolicy specs" .
800 optionalField $ simpleField "ipolicy" [t| JSObject JSValue |]
801
802 pDrbdHelper :: Field
803 pDrbdHelper =
804 withDoc "DRBD helper program" $
805 optionalStringField "drbd_helper"
806
807 pDefaultIAllocator :: Field
808 pDefaultIAllocator =
809 withDoc "Default iallocator for cluster" $
810 optionalStringField "default_iallocator"
811
812 pDefaultIAllocatorParams :: Field
813 pDefaultIAllocatorParams =
814 withDoc "Default iallocator parameters for cluster" . optionalField
815 $ simpleField "default_iallocator_params" [t| JSObject JSValue |]
816
817 pMasterNetdev :: Field
818 pMasterNetdev =
819 withDoc "Master network device" $
820 optionalStringField "master_netdev"
821
822 pMasterNetmask :: Field
823 pMasterNetmask =
824 withDoc "Netmask of the master IP" .
825 optionalField $ simpleField "master_netmask" [t| NonNegative Int |]
826
827 pReservedLvs :: Field
828 pReservedLvs =
829 withDoc "List of reserved LVs" .
830 optionalField $ simpleField "reserved_lvs" [t| [NonEmptyString] |]
831
832 pHiddenOs :: Field
833 pHiddenOs =
834 withDoc "Modify list of hidden operating systems: each modification\
835 \ must have two items, the operation and the OS name; the operation\
836 \ can be add or remove" .
837 optionalField $ simpleField "hidden_os" [t| [(DdmSimple, NonEmptyString)] |]
838
839 pBlacklistedOs :: Field
840 pBlacklistedOs =
841 withDoc "Modify list of blacklisted operating systems: each\
842 \ modification must have two items, the operation and the OS name;\
843 \ the operation can be add or remove" .
844 optionalField $
845 simpleField "blacklisted_os" [t| [(DdmSimple, NonEmptyString)] |]
846
847 pUseExternalMipScript :: Field
848 pUseExternalMipScript =
849 withDoc "Whether to use an external master IP address setup script" .
850 optionalField $ booleanField "use_external_mip_script"
851
852 pEnabledDiskTemplates :: Field
853 pEnabledDiskTemplates =
854 withDoc "List of enabled disk templates" .
855 optionalField $
856 simpleField "enabled_disk_templates" [t| [DiskTemplate] |]
857
858 pEnabledUserShutdown :: Field
859 pEnabledUserShutdown =
860 withDoc "Whether user shutdown is enabled cluster wide" .
861 optionalField $
862 simpleField "enabled_user_shutdown" [t| Bool |]
863
864 pQueryWhat :: Field
865 pQueryWhat =
866 withDoc "Resource(s) to query for" $
867 simpleField "what" [t| Qlang.QueryTypeOp |]
868
869 pUseLocking :: Field
870 pUseLocking =
871 withDoc "Whether to use synchronization" $
872 defaultFalse "use_locking"
873
874 pQueryFields :: Field
875 pQueryFields =
876 withDoc "Requested fields" $
877 simpleField "fields" [t| [NonEmptyString] |]
878
879 pQueryFilter :: Field
880 pQueryFilter =
881 withDoc "Query filter" .
882 optionalField $ simpleField "qfilter" [t| [JSValue] |]
883
884 pQueryFieldsFields :: Field
885 pQueryFieldsFields =
886 withDoc "Requested fields; if not given, all are returned" .
887 renameField "QueryFieldsFields" $
888 optionalField pQueryFields
889
890 pNodeNames :: Field
891 pNodeNames =
892 withDoc "List of node names to run the OOB command against" .
893 defaultField [| [] |] $ simpleField "node_names" [t| [NonEmptyString] |]
894
895 pNodeUuids :: Field
896 pNodeUuids =
897 withDoc "List of node UUIDs" .
898 optionalField $ simpleField "node_uuids" [t| [NonEmptyString] |]
899
900 pOobCommand :: Field
901 pOobCommand =
902 withDoc "OOB command to run" .
903 renameField "OobCommand" $ simpleField "command" [t| OobCommand |]
904
905 pOobTimeout :: Field
906 pOobTimeout =
907 withDoc "Timeout before the OOB helper will be terminated" .
908 defaultField [| C.oobTimeout |] .
909 renameField "OobTimeout" $ simpleField "timeout" [t| Int |]
910
911 pIgnoreStatus :: Field
912 pIgnoreStatus =
913 withDoc "Ignores the node offline status for power off" $
914 defaultFalse "ignore_status"
915
916 pPowerDelay :: Field
917 pPowerDelay =
918 -- FIXME: we can't use the proper type "NonNegative Double", since
919 -- the default constant is a plain Double, not a non-negative one.
920 -- And trying to fix the constant introduces a cyclic import.
921 withDoc "Time in seconds to wait between powering on nodes" .
922 defaultField [| C.oobPowerDelay |] $
923 simpleField "power_delay" [t| Double |]
924
925 pRequiredNodes :: Field
926 pRequiredNodes =
927 withDoc "Required list of node names" .
928 renameField "ReqNodes" $ simpleField "nodes" [t| [NonEmptyString] |]
929
930 pRequiredNodeUuids :: Field
931 pRequiredNodeUuids =
932 withDoc "Required list of node UUIDs" .
933 renameField "ReqNodeUuids" . optionalField $
934 simpleField "node_uuids" [t| [NonEmptyString] |]
935
936 pRestrictedCommand :: Field
937 pRestrictedCommand =
938 withDoc "Restricted command name" .
939 renameField "RestrictedCommand" $
940 simpleField "command" [t| NonEmptyString |]
941
942 pRepairCommand :: Field
943 pRepairCommand =
944 withDoc "Repair command name" .
945 renameField "RepairCommand" $
946 simpleField "command" [t| NonEmptyString |]
947
948 pInput :: Field
949 pInput =
950 withDoc "Input to be redirected to stdin of repair script" .
951 optionalField $ simpleField "input" [t| NonEmptyString |]
952
953 pNodeName :: Field
954 pNodeName =
955 withDoc "A required node name (for single-node LUs)" $
956 simpleField "node_name" [t| NonEmptyString |]
957
958 pNodeUuid :: Field
959 pNodeUuid =
960 withDoc "A node UUID (for single-node LUs)" .
961 optionalField $ simpleField "node_uuid" [t| NonEmptyString |]
962
963 pPrimaryIp :: Field
964 pPrimaryIp =
965 withDoc "Primary IP address" .
966 optionalField $
967 simpleField "primary_ip" [t| NonEmptyString |]
968
969 pSecondaryIp :: Field
970 pSecondaryIp =
971 withDoc "Secondary IP address" $
972 optionalNEStringField "secondary_ip"
973
974 pReadd :: Field
975 pReadd =
976 withDoc "Whether node is re-added to cluster" $
977 defaultFalse "readd"
978
979 pNodeGroup :: Field
980 pNodeGroup =
981 withDoc "Initial node group" $
982 optionalNEStringField "group"
983
984 pMasterCapable :: Field
985 pMasterCapable =
986 withDoc "Whether node can become master or master candidate" .
987 optionalField $ booleanField "master_capable"
988
989 pVmCapable :: Field
990 pVmCapable =
991 withDoc "Whether node can host instances" .
992 optionalField $ booleanField "vm_capable"
993
994 pNdParams :: Field
995 pNdParams =
996 withDoc "Node parameters" .
997 renameField "genericNdParams" .
998 optionalField $ simpleField "ndparams" [t| JSObject JSValue |]
999
1000 pNames :: Field
1001 pNames =
1002 withDoc "List of names" .
1003 defaultField [| [] |] $ simpleField "names" [t| [NonEmptyString] |]
1004
1005 pNodes :: Field
1006 pNodes =
1007 withDoc "List of nodes" .
1008 defaultField [| [] |] $ simpleField "nodes" [t| [NonEmptyString] |]
1009
1010 pStorageType :: Field
1011 pStorageType =
1012 withDoc "Storage type" $ simpleField "storage_type" [t| StorageType |]
1013
1014 pOptStorageType :: Field
1015 pOptStorageType =
1016 withDoc "Storage type" .
1017 renameField "OptStorageType" .
1018 optionalField $ simpleField "storage_type" [t| StorageType |]
1019
1020 pStorageName :: Field
1021 pStorageName =
1022 withDoc "Storage name" .
1023 renameField "StorageName" .
1024 optionalField $ simpleField "name" [t| NonEmptyString |]
1025
1026 pStorageChanges :: Field
1027 pStorageChanges =
1028 withDoc "Requested storage changes" $
1029 simpleField "changes" [t| JSObject JSValue |]
1030
1031 pIgnoreConsistency :: Field
1032 pIgnoreConsistency =
1033 withDoc "Whether to ignore disk consistency" $
1034 defaultFalse "ignore_consistency"
1035
1036 pIgnoreHVVersions :: Field
1037 pIgnoreHVVersions =
1038 withDoc "Whether to ignore incompatible Hypervisor versions" $
1039 defaultFalse "ignore_hvversions"
1040
1041 pMasterCandidate :: Field
1042 pMasterCandidate =
1043 withDoc "Whether the node should become a master candidate" .
1044 optionalField $ booleanField "master_candidate"
1045
1046 pOffline :: Field
1047 pOffline =
1048 withDoc "Whether to mark the node or instance offline" .
1049 optionalField $ booleanField "offline"
1050
1051 pDrained ::Field
1052 pDrained =
1053 withDoc "Whether to mark the node as drained" .
1054 optionalField $ booleanField "drained"
1055
1056 pAutoPromote :: Field
1057 pAutoPromote =
1058 withDoc "Whether node(s) should be promoted to master candidate if\
1059 \ necessary" $
1060 defaultFalse "auto_promote"
1061
1062 pPowered :: Field
1063 pPowered =
1064 withDoc "Whether the node should be marked as powered" .
1065 optionalField $ booleanField "powered"
1066
1067 pMigrationMode :: Field
1068 pMigrationMode =
1069 withDoc "Migration type (live/non-live)" .
1070 renameField "MigrationMode" .
1071 optionalField $
1072 simpleField "mode" [t| MigrationMode |]
1073
1074 pMigrationLive :: Field
1075 pMigrationLive =
1076 withDoc "Obsolete \'live\' migration mode (do not use)" .
1077 renameField "OldLiveMode" . optionalField $ booleanField "live"
1078
1079 pMigrationTargetNode :: Field
1080 pMigrationTargetNode =
1081 withDoc "Target node for instance migration/failover" $
1082 optionalNEStringField "target_node"
1083
1084 pMigrationTargetNodeUuid :: Field
1085 pMigrationTargetNodeUuid =
1086 withDoc "Target node UUID for instance migration/failover" $
1087 optionalNEStringField "target_node_uuid"
1088
1089 pAllowRuntimeChgs :: Field
1090 pAllowRuntimeChgs =
1091 withDoc "Whether to allow runtime changes while migrating" $
1092 defaultTrue "allow_runtime_changes"
1093
1094 pIgnoreIpolicy :: Field
1095 pIgnoreIpolicy =
1096 withDoc "Whether to ignore ipolicy violations" $
1097 defaultFalse "ignore_ipolicy"
1098
1099 pIallocator :: Field
1100 pIallocator =
1101 withDoc "Iallocator for deciding the target node for shared-storage\
1102 \ instances" $
1103 optionalNEStringField "iallocator"
1104
1105 pEarlyRelease :: Field
1106 pEarlyRelease =
1107 withDoc "Whether to release locks as soon as possible" $
1108 defaultFalse "early_release"
1109
1110 pRemoteNode :: Field
1111 pRemoteNode =
1112 withDoc "New secondary node" $
1113 optionalNEStringField "remote_node"
1114
1115 pRemoteNodeUuid :: Field
1116 pRemoteNodeUuid =
1117 withDoc "New secondary node UUID" $
1118 optionalNEStringField "remote_node_uuid"
1119
1120 pEvacMode :: Field
1121 pEvacMode =
1122 withDoc "Node evacuation mode" .
1123 renameField "EvacMode" $ simpleField "mode" [t| EvacMode |]
1124
1125 pIgnoreSoftErrors :: Field
1126 pIgnoreSoftErrors =
1127 withDoc "Ignore soft htools errors" .
1128 optionalField $
1129 booleanField "ignore_soft_errors"
1130
1131 pInstanceName :: Field
1132 pInstanceName =
1133 withDoc "A required instance name (for single-instance LUs)" $
1134 simpleField "instance_name" [t| String |]
1135
1136 pInstanceCommunication :: Field
1137 pInstanceCommunication =
1138 withDoc C.instanceCommunicationDoc $
1139 defaultFalse "instance_communication"
1140
1141 pOptInstanceCommunication :: Field
1142 pOptInstanceCommunication =
1143 withDoc C.instanceCommunicationDoc .
1144 renameField "OptInstanceCommunication" .
1145 optionalField $
1146 booleanField "instance_communication"
1147
1148 pForceVariant :: Field
1149 pForceVariant =
1150 withDoc "Whether to force an unknown OS variant" $
1151 defaultFalse "force_variant"
1152
1153 pWaitForSync :: Field
1154 pWaitForSync =
1155 withDoc "Whether to wait for the disk to synchronize" $
1156 defaultTrue "wait_for_sync"
1157
1158 pNameCheck :: Field
1159 pNameCheck =
1160 withDoc "Whether to check name" $
1161 defaultTrue "name_check"
1162
1163 pInstBeParams :: Field
1164 pInstBeParams =
1165 withDoc "Backend parameters for instance" .
1166 renameField "InstBeParams" .
1167 defaultField [| toJSObject [] |] $
1168 simpleField "beparams" [t| JSObject JSValue |]
1169
1170 pInstDisks :: Field
1171 pInstDisks =
1172 withDoc "List of instance disks" .
1173 renameField "instDisks" $ simpleField "disks" [t| [IDiskParams] |]
1174
1175 pDiskTemplate :: Field
1176 pDiskTemplate =
1177 withDoc "Disk template" $
1178 simpleField "disk_template" [t| DiskTemplate |]
1179
1180 pExtParams :: Field
1181 pExtParams =
1182 withDoc "List of ExtStorage parameters" .
1183 renameField "InstExtParams" .
1184 defaultField [| toJSObject [] |] $
1185 simpleField "ext_params" [t| JSObject JSValue |]
1186
1187 pFileDriver :: Field
1188 pFileDriver =
1189 withDoc "Driver for file-backed disks" .
1190 optionalField $ simpleField "file_driver" [t| FileDriver |]
1191
1192 pFileStorageDir :: Field
1193 pFileStorageDir =
1194 withDoc "Directory for storing file-backed disks" $
1195 optionalNEStringField "file_storage_dir"
1196
1197 pInstHvParams :: Field
1198 pInstHvParams =
1199 withDoc "Hypervisor parameters for instance, hypervisor-dependent" .
1200 renameField "InstHvParams" .
1201 defaultField [| toJSObject [] |] $
1202 simpleField "hvparams" [t| JSObject JSValue |]
1203
1204 pHypervisor :: Field
1205 pHypervisor =
1206 withDoc "Selected hypervisor for an instance" .
1207 optionalField $
1208 simpleField "hypervisor" [t| Hypervisor |]
1209
1210 pResetDefaults :: Field
1211 pResetDefaults =
1212 withDoc "Reset instance parameters to default if equal" $
1213 defaultFalse "identify_defaults"
1214
1215 pIpCheck :: Field
1216 pIpCheck =
1217 withDoc "Whether to ensure instance's IP address is inactive" $
1218 defaultTrue "ip_check"
1219
1220 pIpConflictsCheck :: Field
1221 pIpConflictsCheck =
1222 withDoc "Whether to check for conflicting IP addresses" $
1223 defaultTrue "conflicts_check"
1224
1225 pInstCreateMode :: Field
1226 pInstCreateMode =
1227 withDoc "Instance creation mode" .
1228 renameField "InstCreateMode" $ simpleField "mode" [t| InstCreateMode |]
1229
1230 pInstNics :: Field
1231 pInstNics =
1232 withDoc "List of NIC (network interface) definitions" $
1233 simpleField "nics" [t| [INicParams] |]
1234
1235 pNoInstall :: Field
1236 pNoInstall =
1237 withDoc "Do not install the OS (will disable automatic start)" .
1238 optionalField $ booleanField "no_install"
1239
1240 pInstOs :: Field
1241 pInstOs =
1242 withDoc "OS type for instance installation" $
1243 optionalNEStringField "os_type"
1244
1245 pInstOsParams :: Field
1246 pInstOsParams =
1247 withDoc "OS parameters for instance" .
1248 renameField "InstOsParams" .
1249 defaultField [| toJSObject [] |] $
1250 simpleField "osparams" [t| JSObject JSValue |]
1251
1252 pInstOsParamsPrivate :: Field
1253 pInstOsParamsPrivate =
1254 withDoc "Private OS parameters for instance" .
1255 optionalField $
1256 simpleField "osparams_private" [t| JSObject (Private JSValue) |]
1257
1258 pInstOsParamsSecret :: Field
1259 pInstOsParamsSecret =
1260 withDoc "Secret OS parameters for instance" .
1261 optionalField $
1262 simpleField "osparams_secret" [t| JSObject (Secret JSValue) |]
1263
1264 pInstOsParamsClear :: Field
1265 pInstOsParamsClear =
1266 withDoc "Clear current OS parameters from instance" $
1267 defaultFalse "clear_osparams"
1268
1269 pInstOsParamsPrivateClear :: Field
1270 pInstOsParamsPrivateClear =
1271 withDoc "Clear current private OS parameters from instance" $
1272 defaultFalse "clear_osparams_private"
1273
1274 pInstOsParamsRemove :: Field
1275 pInstOsParamsRemove =
1276 withDoc "Remove OS parameters from instance" .
1277 optionalField $ simpleField "remove_osparams" [t| [String] |]
1278
1279 pInstOsParamsPrivateRemove :: Field
1280 pInstOsParamsPrivateRemove =
1281 withDoc "Remove private OS parameters from instance" .
1282 optionalField $ simpleField "remove_osparams_private" [t| [String] |]
1283
1284 pPrimaryNode :: Field
1285 pPrimaryNode =
1286 withDoc "Primary node for an instance" $
1287 optionalNEStringField "pnode"
1288
1289 pPrimaryNodeUuid :: Field
1290 pPrimaryNodeUuid =
1291 withDoc "Primary node UUID for an instance" $
1292 optionalNEStringField "pnode_uuid"
1293
1294 pSecondaryNode :: Field
1295 pSecondaryNode =
1296 withDoc "Secondary node for an instance" $
1297 optionalNEStringField "snode"
1298
1299 pSecondaryNodeUuid :: Field
1300 pSecondaryNodeUuid =
1301 withDoc "Secondary node UUID for an instance" $
1302 optionalNEStringField "snode_uuid"
1303
1304 pSourceHandshake :: Field
1305 pSourceHandshake =
1306 withDoc "Signed handshake from source (remote import only)" .
1307 optionalField $ simpleField "source_handshake" [t| [JSValue] |]
1308
1309 pSourceInstance :: Field
1310 pSourceInstance =
1311 withDoc "Source instance name (remote import only)" $
1312 optionalNEStringField "source_instance_name"
1313
1314 -- FIXME: non-negative int, whereas the constant is a plain int.
1315 pSourceShutdownTimeout :: Field
1316 pSourceShutdownTimeout =
1317 withDoc "How long source instance was given to shut down (remote import\
1318 \ only)" .
1319 defaultField [| forceNonNeg C.defaultShutdownTimeout |] $
1320 simpleField "source_shutdown_timeout" [t| NonNegative Int |]
1321
1322 pSourceX509Ca :: Field
1323 pSourceX509Ca =
1324 withDoc "Source X509 CA in PEM format (remote import only)" $
1325 optionalNEStringField "source_x509_ca"
1326
1327 pSrcNode :: Field
1328 pSrcNode =
1329 withDoc "Source node for import" $
1330 optionalNEStringField "src_node"
1331
1332 pSrcNodeUuid :: Field
1333 pSrcNodeUuid =
1334 withDoc "Source node UUID for import" $
1335 optionalNEStringField "src_node_uuid"
1336
1337 pSrcPath :: Field
1338 pSrcPath =
1339 withDoc "Source directory for import" $
1340 optionalNEStringField "src_path"
1341
1342 pStartInstance :: Field
1343 pStartInstance =
1344 withDoc "Whether to start instance after creation" $
1345 defaultTrue "start"
1346
1347 pForthcoming :: Field
1348 pForthcoming =
1349 withDoc "Whether to only reserve resources" $
1350 defaultFalse "forthcoming"
1351
1352 pCommit :: Field
1353 pCommit =
1354 withDoc "Commit the already reserved instance" $
1355 defaultFalse "commit"
1356
1357 -- FIXME: unify/simplify with pTags, once that migrates to NonEmpty String"
1358 pInstTags :: Field
1359 pInstTags =
1360 withDoc "Instance tags" .
1361 renameField "InstTags" .
1362 defaultField [| [] |] $
1363 simpleField "tags" [t| [NonEmptyString] |]
1364
1365 pMultiAllocInstances :: Field
1366 pMultiAllocInstances =
1367 withDoc "List of instance create opcodes describing the instances to\
1368 \ allocate" .
1369 renameField "InstMultiAlloc" .
1370 defaultField [| [] |] $
1371 simpleField "instances"[t| [JSValue] |]
1372
1373 pOpportunisticLocking :: Field
1374 pOpportunisticLocking =
1375 withDoc "Whether to employ opportunistic locking for nodes, meaning\
1376 \ nodes already locked by another opcode won't be considered for\
1377 \ instance allocation (only when an iallocator is used)" $
1378 defaultFalse "opportunistic_locking"
1379
1380 pInstanceUuid :: Field
1381 pInstanceUuid =
1382 withDoc "An instance UUID (for single-instance LUs)" .
1383 optionalField $ simpleField "instance_uuid" [t| NonEmptyString |]
1384
1385 pTempOsParams :: Field
1386 pTempOsParams =
1387 withDoc "Temporary OS parameters (currently only in reinstall, might be\
1388 \ added to install as well)" .
1389 renameField "TempOsParams" .
1390 optionalField $ simpleField "osparams" [t| JSObject JSValue |]
1391
1392 pTempOsParamsPrivate :: Field
1393 pTempOsParamsPrivate =
1394 withDoc "Private OS parameters for instance reinstalls" .
1395 optionalField $
1396 simpleField "osparams_private" [t| JSObject (Private JSValue) |]
1397
1398 pTempOsParamsSecret :: Field
1399 pTempOsParamsSecret =
1400 withDoc "Secret OS parameters for instance reinstalls" .
1401 optionalField $
1402 simpleField "osparams_secret" [t| JSObject (Secret JSValue) |]
1403
1404 pTempOsParamsClear :: Field
1405 pTempOsParamsClear =
1406 withDoc "Clear current OS parameters before instance reinstalls" $
1407 defaultFalse "clear_osparams"
1408
1409 pTempOsParamsPrivateClear :: Field
1410 pTempOsParamsPrivateClear =
1411 withDoc "Clear current OS private parameters before instance reinstalls" $
1412 defaultFalse "clear_osparams_private"
1413
1414 pTempOsParamsRemove :: Field
1415 pTempOsParamsRemove =
1416 withDoc "Remove OS parameters before instance reinstalls" .
1417 optionalField $ simpleField "remove_osparams" [t| [String] |]
1418
1419 pTempOsParamsPrivateRemove :: Field
1420 pTempOsParamsPrivateRemove =
1421 withDoc "Remove private OS parameters before instance reinstalls" .
1422 optionalField $ simpleField "remove_osparams_private" [t| [String] |]
1423
1424 pShutdownTimeout :: Field
1425 pShutdownTimeout =
1426 withDoc "How long to wait for instance to shut down" .
1427 defaultField [| forceNonNeg C.defaultShutdownTimeout |] $
1428 simpleField "shutdown_timeout" [t| NonNegative Int |]
1429
1430 -- | Another name for the shutdown timeout, because we like to be
1431 -- inconsistent.
1432 pShutdownTimeout' :: Field
1433 pShutdownTimeout' =
1434 withDoc "How long to wait for instance to shut down" .
1435 renameField "InstShutdownTimeout" .
1436 defaultField [| forceNonNeg C.defaultShutdownTimeout |] $
1437 simpleField "timeout" [t| NonNegative Int |]
1438
1439 pIgnoreFailures :: Field
1440 pIgnoreFailures =
1441 withDoc "Whether to ignore failures during removal" $
1442 defaultFalse "ignore_failures"
1443
1444 pNewName :: Field
1445 pNewName =
1446 withDoc "New group or instance name" $
1447 simpleField "new_name" [t| NonEmptyString |]
1448
1449 pIgnoreOfflineNodes :: Field
1450 pIgnoreOfflineNodes =
1451 withDoc "Whether to ignore offline nodes" $
1452 defaultFalse "ignore_offline_nodes"
1453
1454 pTempHvParams :: Field
1455 pTempHvParams =
1456 withDoc "Temporary hypervisor parameters, hypervisor-dependent" .
1457 renameField "TempHvParams" .
1458 defaultField [| toJSObject [] |] $
1459 simpleField "hvparams" [t| JSObject JSValue |]
1460
1461 pTempBeParams :: Field
1462 pTempBeParams =
1463 withDoc "Temporary backend parameters" .
1464 renameField "TempBeParams" .
1465 defaultField [| toJSObject [] |] $
1466 simpleField "beparams" [t| JSObject JSValue |]
1467
1468 pNoRemember :: Field
1469 pNoRemember =
1470 withDoc "Do not remember instance state changes" $
1471 defaultFalse "no_remember"
1472
1473 pStartupPaused :: Field
1474 pStartupPaused =
1475 withDoc "Pause instance at startup" $
1476 defaultFalse "startup_paused"
1477
1478 pIgnoreSecondaries :: Field
1479 pIgnoreSecondaries =
1480 withDoc "Whether to start the instance even if secondary disks are failing" $
1481 defaultFalse "ignore_secondaries"
1482
1483 pRebootType :: Field
1484 pRebootType =
1485 withDoc "How to reboot the instance" $
1486 simpleField "reboot_type" [t| RebootType |]
1487
1488 pReplaceDisksMode :: Field
1489 pReplaceDisksMode =
1490 withDoc "Replacement mode" .
1491 renameField "ReplaceDisksMode" $ simpleField "mode" [t| ReplaceDisksMode |]
1492
1493 pReplaceDisksList :: Field
1494 pReplaceDisksList =
1495 withDoc "List of disk indices" .
1496 renameField "ReplaceDisksList" .
1497 defaultField [| [] |] $
1498 simpleField "disks" [t| [DiskIndex] |]
1499
1500 pMigrationCleanup :: Field
1501 pMigrationCleanup =
1502 withDoc "Whether a previously failed migration should be cleaned up" .
1503 renameField "MigrationCleanup" $ defaultFalse "cleanup"
1504
1505 pAllowFailover :: Field
1506 pAllowFailover =
1507 withDoc "Whether we can fallback to failover if migration is not possible" $
1508 defaultFalse "allow_failover"
1509
1510 pForceFailover :: Field
1511 pForceFailover =
1512 withDoc "Disallow migration moves and always use failovers" $
1513 defaultFalse "force_failover"
1514
1515 pMoveTargetNode :: Field
1516 pMoveTargetNode =
1517 withDoc "Target node for instance move" .
1518 renameField "MoveTargetNode" $
1519 simpleField "target_node" [t| NonEmptyString |]
1520
1521 pMoveTargetNodeUuid :: Field
1522 pMoveTargetNodeUuid =
1523 withDoc "Target node UUID for instance move" .
1524 renameField "MoveTargetNodeUuid" . optionalField $
1525 simpleField "target_node_uuid" [t| NonEmptyString |]
1526
1527 pMoveCompress :: Field
1528 pMoveCompress =
1529 withDoc "Compression mode to use during instance moves" .
1530 defaultField [| C.iecNone |] $
1531 simpleField "compress" [t| String |]
1532
1533 pBackupCompress :: Field
1534 pBackupCompress =
1535 withDoc "Compression mode to use for moves during backups/imports" .
1536 defaultField [| C.iecNone |] $
1537 simpleField "compress" [t| String |]
1538
1539 pIgnoreDiskSize :: Field
1540 pIgnoreDiskSize =
1541 withDoc "Whether to ignore recorded disk size" $
1542 defaultFalse "ignore_size"
1543
1544 pWaitForSyncFalse :: Field
1545 pWaitForSyncFalse =
1546 withDoc "Whether to wait for the disk to synchronize (defaults to false)" $
1547 defaultField [| False |] pWaitForSync
1548
1549 pRecreateDisksInfo :: Field
1550 pRecreateDisksInfo =
1551 withDoc "Disk list for recreate disks" .
1552 renameField "RecreateDisksInfo" .
1553 defaultField [| RecreateDisksAll |] $
1554 simpleField "disks" [t| RecreateDisksInfo |]
1555
1556 pStatic :: Field
1557 pStatic =
1558 withDoc "Whether to only return configuration data without querying nodes" $
1559 defaultFalse "static"
1560
1561 pInstParamsNicChanges :: Field
1562 pInstParamsNicChanges =
1563 withDoc "List of NIC changes" .
1564 renameField "InstNicChanges" .
1565 defaultField [| SetParamsEmpty |] $
1566 simpleField "nics" [t| SetParamsMods INicParams |]
1567
1568 pInstParamsDiskChanges :: Field
1569 pInstParamsDiskChanges =
1570 withDoc "List of disk changes" .
1571 renameField "InstDiskChanges" .
1572 defaultField [| SetParamsEmpty |] $
1573 simpleField "disks" [t| SetParamsMods IDiskParams |]
1574
1575 pRuntimeMem :: Field
1576 pRuntimeMem =
1577 withDoc "New runtime memory" .
1578 optionalField $ simpleField "runtime_mem" [t| Positive Int |]
1579
1580 pOptDiskTemplate :: Field
1581 pOptDiskTemplate =
1582 withDoc "Instance disk template" .
1583 optionalField .
1584 renameField "OptDiskTemplate" $
1585 simpleField "disk_template" [t| DiskTemplate |]
1586
1587 pOsNameChange :: Field
1588 pOsNameChange =
1589 withDoc "Change the instance's OS without reinstalling the instance" $
1590 optionalNEStringField "os_name"
1591
1592 pDiskIndex :: Field
1593 pDiskIndex =
1594 withDoc "Disk index for e.g. grow disk" .
1595 renameField "DiskIndex" $ simpleField "disk" [t| DiskIndex |]
1596
1597 pDiskChgAmount :: Field
1598 pDiskChgAmount =
1599 withDoc "Disk amount to add or grow to" .
1600 renameField "DiskChgAmount" $ simpleField "amount" [t| NonNegative Int |]
1601
1602 pDiskChgAbsolute :: Field
1603 pDiskChgAbsolute =
1604 withDoc
1605 "Whether the amount parameter is an absolute target or a relative one" .
1606 renameField "DiskChkAbsolute" $ defaultFalse "absolute"
1607
1608 pTargetGroups :: Field
1609 pTargetGroups =
1610 withDoc
1611 "Destination group names or UUIDs (defaults to \"all but current group\")" .
1612 optionalField $ simpleField "target_groups" [t| [NonEmptyString] |]
1613
1614 pNodeGroupAllocPolicy :: Field
1615 pNodeGroupAllocPolicy =
1616 withDoc "Instance allocation policy" .
1617 optionalField $
1618 simpleField "alloc_policy" [t| AllocPolicy |]
1619
1620 pGroupNodeParams :: Field
1621 pGroupNodeParams =
1622 withDoc "Default node parameters for group" .
1623 optionalField $ simpleField "ndparams" [t| JSObject JSValue |]
1624
1625 pExportMode :: Field
1626 pExportMode =
1627 withDoc "Export mode" .
1628 renameField "ExportMode" $ simpleField "mode" [t| ExportMode |]
1629
1630 -- FIXME: Rename target_node as it changes meaning for different
1631 -- export modes (e.g. "destination")
1632 pExportTargetNode :: Field
1633 pExportTargetNode =
1634 withDoc "Target node (depends on export mode)" .
1635 renameField "ExportTarget" $
1636 simpleField "target_node" [t| ExportTarget |]
1637
1638 pExportTargetNodeUuid :: Field
1639 pExportTargetNodeUuid =
1640 withDoc "Target node UUID (if local export)" .
1641 renameField "ExportTargetNodeUuid" . optionalField $
1642 simpleField "target_node_uuid" [t| NonEmptyString |]
1643
1644 pShutdownInstance :: Field
1645 pShutdownInstance =
1646 withDoc "Whether to shutdown the instance before export" $
1647 defaultTrue "shutdown"
1648
1649 pRemoveInstance :: Field
1650 pRemoveInstance =
1651 withDoc "Whether to remove instance after export" $
1652 defaultFalse "remove_instance"
1653
1654 pIgnoreRemoveFailures :: Field
1655 pIgnoreRemoveFailures =
1656 withDoc "Whether to ignore failures while removing instances" $
1657 defaultFalse "ignore_remove_failures"
1658
1659 pX509KeyName :: Field
1660 pX509KeyName =
1661 withDoc "Name of X509 key (remote export only)" .
1662 optionalField $ simpleField "x509_key_name" [t| [JSValue] |]
1663
1664 pX509DestCA :: Field
1665 pX509DestCA =
1666 withDoc "Destination X509 CA (remote export only)" $
1667 optionalNEStringField "destination_x509_ca"
1668
1669 pZeroFreeSpace :: Field
1670 pZeroFreeSpace =
1671 withDoc "Whether to zero the free space on the disks of the instance" $
1672 defaultFalse "zero_free_space"
1673
1674 pHelperStartupTimeout :: Field
1675 pHelperStartupTimeout =
1676 withDoc "Startup timeout for the helper VM" .
1677 optionalField $ simpleField "helper_startup_timeout" [t| Int |]
1678
1679 pHelperShutdownTimeout :: Field
1680 pHelperShutdownTimeout =
1681 withDoc "Shutdown timeout for the helper VM" .
1682 optionalField $ simpleField "helper_shutdown_timeout" [t| Int |]
1683
1684 pZeroingTimeoutFixed :: Field
1685 pZeroingTimeoutFixed =
1686 withDoc "The fixed part of time to wait before declaring the zeroing\
1687 \ operation to have failed" .
1688 optionalField $ simpleField "zeroing_timeout_fixed" [t| Int |]
1689
1690 pZeroingTimeoutPerMiB :: Field
1691 pZeroingTimeoutPerMiB =
1692 withDoc "The variable part of time to wait before declaring the zeroing\
1693 \ operation to have failed, dependent on total size of disks" .
1694 optionalField $ simpleField "zeroing_timeout_per_mib" [t| Double |]
1695
1696 pTagsObject :: Field
1697 pTagsObject =
1698 withDoc "Tag kind" $
1699 simpleField "kind" [t| TagKind |]
1700
1701 pTagsName :: Field
1702 pTagsName =
1703 withDoc "Name of object" .
1704 renameField "TagsGetName" .
1705 optionalField $ simpleField "name" [t| String |]
1706
1707 pTagsList :: Field
1708 pTagsList =
1709 withDoc "List of tag names" .
1710 renameField "TagsList" $
1711 simpleField "tags" [t| [String] |]
1712
1713 -- FIXME: this should be compiled at load time?
1714 pTagSearchPattern :: Field
1715 pTagSearchPattern =
1716 withDoc "Search pattern (regular expression)" .
1717 renameField "TagSearchPattern" $
1718 simpleField "pattern" [t| NonEmptyString |]
1719
1720 pDelayDuration :: Field
1721 pDelayDuration =
1722 withDoc "Duration parameter for 'OpTestDelay'" .
1723 renameField "DelayDuration" $
1724 simpleField "duration" [t| Double |]
1725
1726 pDelayOnMaster :: Field
1727 pDelayOnMaster =
1728 withDoc "on_master field for 'OpTestDelay'" .
1729 renameField "DelayOnMaster" $
1730 defaultTrue "on_master"
1731
1732 pDelayOnNodes :: Field
1733 pDelayOnNodes =
1734 withDoc "on_nodes field for 'OpTestDelay'" .
1735 renameField "DelayOnNodes" .
1736 defaultField [| [] |] $
1737 simpleField "on_nodes" [t| [NonEmptyString] |]
1738
1739 pDelayOnNodeUuids :: Field
1740 pDelayOnNodeUuids =
1741 withDoc "on_node_uuids field for 'OpTestDelay'" .
1742 renameField "DelayOnNodeUuids" . optionalField $
1743 simpleField "on_node_uuids" [t| [NonEmptyString] |]
1744
1745 pDelayRepeat :: Field
1746 pDelayRepeat =
1747 withDoc "Repeat parameter for OpTestDelay" .
1748 renameField "DelayRepeat" .
1749 defaultField [| forceNonNeg (0::Int) |] $
1750 simpleField "repeat" [t| NonNegative Int |]
1751
1752 pDelayInterruptible :: Field
1753 pDelayInterruptible =
1754 withDoc "Allows socket-based interruption of a running OpTestDelay" .
1755 renameField "DelayInterruptible" .
1756 defaultField [| False |] $
1757 simpleField "interruptible" [t| Bool |]
1758
1759 pDelayNoLocks :: Field
1760 pDelayNoLocks =
1761 withDoc "Don't take locks during the delay" .
1762 renameField "DelayNoLocks" $
1763 defaultTrue "no_locks"
1764
1765 pIAllocatorDirection :: Field
1766 pIAllocatorDirection =
1767 withDoc "IAllocator test direction" .
1768 renameField "IAllocatorDirection" $
1769 simpleField "direction" [t| IAllocatorTestDir |]
1770
1771 pIAllocatorMode :: Field
1772 pIAllocatorMode =
1773 withDoc "IAllocator test mode" .
1774 renameField "IAllocatorMode" $
1775 simpleField "mode" [t| IAllocatorMode |]
1776
1777 pIAllocatorReqName :: Field
1778 pIAllocatorReqName =
1779 withDoc "IAllocator target name (new instance, node to evac, etc.)" .
1780 renameField "IAllocatorReqName" $ simpleField "name" [t| NonEmptyString |]
1781
1782 pIAllocatorNics :: Field
1783 pIAllocatorNics =
1784 withDoc "Custom OpTestIAllocator nics" .
1785 renameField "IAllocatorNics" .
1786 optionalField $ simpleField "nics" [t| [INicParams] |]
1787
1788 pIAllocatorDisks :: Field
1789 pIAllocatorDisks =
1790 withDoc "Custom OpTestAllocator disks" .
1791 renameField "IAllocatorDisks" .
1792 optionalField $ simpleField "disks" [t| [JSValue] |]
1793
1794 pIAllocatorMemory :: Field
1795 pIAllocatorMemory =
1796 withDoc "IAllocator memory field" .
1797 renameField "IAllocatorMem" .
1798 optionalField $
1799 simpleField "memory" [t| NonNegative Int |]
1800
1801 pIAllocatorVCpus :: Field
1802 pIAllocatorVCpus =
1803 withDoc "IAllocator vcpus field" .
1804 renameField "IAllocatorVCpus" .
1805 optionalField $
1806 simpleField "vcpus" [t| NonNegative Int |]
1807
1808 pIAllocatorOs :: Field
1809 pIAllocatorOs =
1810 withDoc "IAllocator os field" .
1811 renameField "IAllocatorOs" $ optionalNEStringField "os"
1812
1813 pIAllocatorInstances :: Field
1814 pIAllocatorInstances =
1815 withDoc "IAllocator instances field" .
1816 renameField "IAllocatorInstances" .
1817 optionalField $
1818 simpleField "instances" [t| [NonEmptyString] |]
1819
1820 pIAllocatorEvacMode :: Field
1821 pIAllocatorEvacMode =
1822 withDoc "IAllocator evac mode" .
1823 renameField "IAllocatorEvacMode" .
1824 optionalField $
1825 simpleField "evac_mode" [t| EvacMode |]
1826
1827 pIAllocatorSpindleUse :: Field
1828 pIAllocatorSpindleUse =
1829 withDoc "IAllocator spindle use" .
1830 renameField "IAllocatorSpindleUse" .
1831 defaultField [| forceNonNeg (1::Int) |] $
1832 simpleField "spindle_use" [t| NonNegative Int |]
1833
1834 pIAllocatorCount :: Field
1835 pIAllocatorCount =
1836 withDoc "IAllocator count field" .
1837 renameField "IAllocatorCount" .
1838 defaultField [| forceNonNeg (1::Int) |] $
1839 simpleField "count" [t| NonNegative Int |]
1840
1841 pJQueueNotifyWaitLock :: Field
1842 pJQueueNotifyWaitLock =
1843 withDoc "'OpTestJqueue' notify_waitlock" $
1844 defaultFalse "notify_waitlock"
1845
1846 pJQueueNotifyExec :: Field
1847 pJQueueNotifyExec =
1848 withDoc "'OpTestJQueue' notify_exec" $
1849 defaultFalse "notify_exec"
1850
1851 pJQueueLogMessages :: Field
1852 pJQueueLogMessages =
1853 withDoc "'OpTestJQueue' log_messages" .
1854 defaultField [| [] |] $ simpleField "log_messages" [t| [String] |]
1855
1856 pJQueueFail :: Field
1857 pJQueueFail =
1858 withDoc "'OpTestJQueue' fail attribute" .
1859 renameField "JQueueFail" $ defaultFalse "fail"
1860
1861 pTestDummyResult :: Field
1862 pTestDummyResult =
1863 withDoc "'OpTestDummy' result field" .
1864 renameField "TestDummyResult" $ simpleField "result" [t| JSValue |]
1865
1866 pTestDummyMessages :: Field
1867 pTestDummyMessages =
1868 withDoc "'OpTestDummy' messages field" .
1869 renameField "TestDummyMessages" $
1870 simpleField "messages" [t| JSValue |]
1871
1872 pTestDummyFail :: Field
1873 pTestDummyFail =
1874 withDoc "'OpTestDummy' fail field" .
1875 renameField "TestDummyFail" $ simpleField "fail" [t| JSValue |]
1876
1877 pTestDummySubmitJobs :: Field
1878 pTestDummySubmitJobs =
1879 withDoc "'OpTestDummy' submit_jobs field" .
1880 renameField "TestDummySubmitJobs" $
1881 simpleField "submit_jobs" [t| JSValue |]
1882
1883 pNetworkName :: Field
1884 pNetworkName =
1885 withDoc "Network name" $
1886 simpleField "network_name" [t| NonEmptyString |]
1887
1888 pNetworkAddress4 :: Field
1889 pNetworkAddress4 =
1890 withDoc "Network address (IPv4 subnet)" .
1891 renameField "NetworkAddress4" $
1892 simpleField "network" [t| IPv4Network |]
1893
1894 pNetworkGateway4 :: Field
1895 pNetworkGateway4 =
1896 withDoc "Network gateway (IPv4 address)" .
1897 renameField "NetworkGateway4" .
1898 optionalField $ simpleField "gateway" [t| IPv4Address |]
1899
1900 pNetworkAddress6 :: Field
1901 pNetworkAddress6 =
1902 withDoc "Network address (IPv6 subnet)" .
1903 renameField "NetworkAddress6" .
1904 optionalField $ simpleField "network6" [t| IPv6Network |]
1905
1906 pNetworkGateway6 :: Field
1907 pNetworkGateway6 =
1908 withDoc "Network gateway (IPv6 address)" .
1909 renameField "NetworkGateway6" .
1910 optionalField $ simpleField "gateway6" [t| IPv6Address |]
1911
1912 pNetworkMacPrefix :: Field
1913 pNetworkMacPrefix =
1914 withDoc "Network specific mac prefix (that overrides the cluster one)" .
1915 renameField "NetMacPrefix" $
1916 optionalNEStringField "mac_prefix"
1917
1918 pNetworkAddRsvdIps :: Field
1919 pNetworkAddRsvdIps =
1920 withDoc "Which IP addresses to reserve" .
1921 renameField "NetworkAddRsvdIps" .
1922 optionalField $
1923 simpleField "add_reserved_ips" [t| [IPv4Address] |]
1924
1925 pNetworkRemoveRsvdIps :: Field
1926 pNetworkRemoveRsvdIps =
1927 withDoc "Which external IP addresses to release" .
1928 renameField "NetworkRemoveRsvdIps" .
1929 optionalField $
1930 simpleField "remove_reserved_ips" [t| [IPv4Address] |]
1931
1932 pNetworkMode :: Field
1933 pNetworkMode =
1934 withDoc "Network mode when connecting to a group" $
1935 simpleField "network_mode" [t| NICMode |]
1936
1937 pNetworkLink :: Field
1938 pNetworkLink =
1939 withDoc "Network link when connecting to a group" $
1940 simpleField "network_link" [t| NonEmptyString |]
1941
1942 pAdminStateSource :: Field
1943 pAdminStateSource =
1944 withDoc "Who last changed the instance admin state" .
1945 optionalField $
1946 simpleField "admin_state_source" [t| AdminStateSource |]
1947
1948 pNetworkVlan :: Field
1949 pNetworkVlan =
1950 withDoc "Network vlan when connecting to a group" .
1951 defaultField [| "" |] $ stringField "network_vlan"
1952
1953 pEnabledDataCollectors :: Field
1954 pEnabledDataCollectors =
1955 withDoc "Set the active data collectors" .
1956 optionalField $
1957 simpleField C.dataCollectorsEnabledName [t| GenericContainer String Bool |]
1958
1959 pDataCollectorInterval :: Field
1960 pDataCollectorInterval =
1961 withDoc "Sets the interval in that data collectors are run" .
1962 optionalField $
1963 simpleField C.dataCollectorsIntervalName [t| GenericContainer String Int |]
1964
1965 pDiagnoseDataCollectorFilename :: Field
1966 pDiagnoseDataCollectorFilename =
1967 withDoc "Sets the filename of the script diagnose data collector should run" $
1968 optionalStringField "diagnose_data_collector_filename"
1969
1970 pMaintdRoundDelay :: Field
1971 pMaintdRoundDelay =
1972 withDoc "Minimal delay between rounds of the maintenance daemon"
1973 . optionalField
1974 $ simpleField "maint_round_delay" [t| Int |]
1975
1976 pMaintdEnableBalancing :: Field
1977 pMaintdEnableBalancing =
1978 withDoc "Whether the maintenance daemon should also keep the cluster balanced"
1979 . optionalField
1980 $ simpleField "maint_balance" [t| Bool |]
1981
1982 pMaintdBalancingThreshold :: Field
1983 pMaintdBalancingThreshold =
1984 withDoc "Minimal gain per balancing step by the maintenance daemon"
1985 . optionalField
1986 $ simpleField "maint_balance_threshold" [t| Double |]
1987
1988 pNodeSslCerts :: Field
1989 pNodeSslCerts =
1990 withDoc "Whether to renew node SSL certificates" .
1991 defaultField [| False |] $
1992 simpleField "node_certificates" [t| Bool |]
1993
1994 pSshKeyBits :: Field
1995 pSshKeyBits =
1996 withDoc "The number of bits of the SSH key Ganeti uses" .
1997 optionalField $ simpleField "ssh_key_bits" [t| Positive Int |]
1998
1999 pSshKeyType :: Field
2000 pSshKeyType =
2001 withDoc "The type of the SSH key Ganeti uses" .
2002 optionalField $ simpleField "ssh_key_type" [t| SshKeyType |]
2003
2004 pRenewSshKeys :: Field
2005 pRenewSshKeys =
2006 withDoc "Whether to renew SSH keys" .
2007 defaultField [| False |] $
2008 simpleField "renew_ssh_keys" [t| Bool |]
2009
2010 pNodeSetup :: Field
2011 pNodeSetup =
2012 withDoc "Whether to perform a SSH setup on the new node" .
2013 defaultField [| False |] $
2014 simpleField "node_setup" [t| Bool |]
2015
2016 pVerifyClutter :: Field
2017 pVerifyClutter =
2018 withDoc "Whether to check for clutter in the 'authorized_keys' file." .
2019 defaultField [| False |] $
2020 simpleField "verify_clutter" [t| Bool |]
2021
2022 pLongSleep :: Field
2023 pLongSleep =
2024 withDoc "Whether to allow long instance shutdowns during exports" .
2025 defaultField [| False |] $
2026 simpleField "long_sleep" [t| Bool |]
2027
2028 pIsStrict :: Field
2029 pIsStrict =
2030 withDoc "Whether the operation is in strict mode or not." .
2031 defaultField [| True |] $
2032 simpleField "is_strict" [t| Bool |]