Statistics
| Branch: | Tag: | Revision:

root / src / Ganeti / OpParams.hs @ 1ecc03c1

History | View | Annotate | Download (46.5 kB)

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