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