Safe Haskell | None |
---|
Implementation of opcodes parameters.
These are defined in a separate module only due to TemplateHaskell stage restrictions - expressions defined in the current module can't be passed to splices. So we have to either parameters/repeat each parameter definition multiple times, or separate them into this module.
- booleanField :: String -> Field
- defaultFalse :: String -> Field
- defaultTrue :: String -> Field
- stringField :: String -> Field
- optionalStringField :: String -> Field
- optionalNEStringField :: String -> Field
- type UncheckedValue = JSValue
- type UncheckedDict = JSObject JSValue
- type UncheckedList = [JSValue]
- forceNonNeg :: (Num a, Ord a, Show a) => a -> NonNegative a
- data TagType
- tagTypeFromRaw :: forall m. Monad m => String -> m TagType
- tagTypeToRaw :: TagType -> String
- data TagObject
- = TagInstance String
- | TagNode String
- | TagGroup String
- | TagNetwork String
- | TagCluster
- tagTypeOf :: TagObject -> TagType
- tagNameOf :: TagObject -> Maybe String
- tagObjectFrom :: Monad m => TagType -> JSValue -> m TagObject
- tagNameField :: String
- encodeTagObject :: TagObject -> (JSValue, [(String, JSValue)])
- decodeTagObject :: Monad m => [(String, JSValue)] -> JSValue -> m TagObject
- data ReplaceDisksMode
- replaceDisksModeFromRaw :: forall m. Monad m => String -> m ReplaceDisksMode
- replaceDisksModeToRaw :: ReplaceDisksMode -> String
- newtype DiskIndex = DiskIndex {
- unDiskIndex :: Int
- mkDiskIndex :: Monad m => Int -> m DiskIndex
- data DiskAccess
- diskAccessFromRaw :: forall m. Monad m => String -> m DiskAccess
- diskAccessToRaw :: DiskAccess -> String
- data INicParams = INicParams {
- inicMac :: Maybe NonEmptyString
- inicIp :: Maybe String
- inicMode :: Maybe NonEmptyString
- inicLink :: Maybe NonEmptyString
- inicName :: Maybe NonEmptyString
- loadINicParams :: JSValue -> Result INicParams
- saveINicParams :: INicParams -> JSValue
- toDictINicParams :: INicParams -> [(String, JSValue)]
- data IDiskParams = IDiskParams {
- idiskSize :: Maybe Int
- idiskMode :: Maybe DiskAccess
- idiskAdopt :: Maybe NonEmptyString
- idiskVg :: Maybe NonEmptyString
- idiskMetavg :: Maybe NonEmptyString
- idiskName :: Maybe NonEmptyString
- loadIDiskParams :: JSValue -> Result IDiskParams
- saveIDiskParams :: IDiskParams -> JSValue
- toDictIDiskParams :: IDiskParams -> [(String, JSValue)]
- data RecreateDisksInfo
- readRecreateDisks :: JSValue -> Result RecreateDisksInfo
- data DdmOldChanges
- = DdmOldIndex (NonNegative Int)
- | DdmOldMod DdmSimple
- readDdmOldChanges :: JSValue -> Result DdmOldChanges
- data SetParamsMods a
- = SetParamsEmpty
- | SetParamsDeprecated (NonEmpty (DdmOldChanges, a))
- | SetParamsNew (NonEmpty (DdmFull, Int, a))
- readSetParams :: JSON a => JSValue -> Result (SetParamsMods a)
- data ExportTarget
- readExportTarget :: JSValue -> Result ExportTarget
- pInstanceName :: Field
- pInstances :: Field
- pName :: Field
- pTagsList :: Field
- pTagsObject :: Field
- pOutputFields :: Field
- pShutdownTimeout :: Field
- pShutdownTimeout' :: Field
- pShutdownInstance :: Field
- pForce :: Field
- pIgnoreOfflineNodes :: Field
- pNodeName :: Field
- pNodeNames :: Field
- pGroupName :: Field
- pMigrationMode :: Field
- pMigrationLive :: Field
- pMigrationCleanup :: Field
- pForceVariant :: Field
- pWaitForSync :: Field
- pWaitForSyncFalse :: Field
- pIgnoreConsistency :: Field
- pStorageName :: Field
- pUseLocking :: Field
- pOpportunisticLocking :: Field
- pNameCheck :: Field
- pNodeGroupAllocPolicy :: Field
- pGroupNodeParams :: Field
- pQueryWhat :: Field
- pEarlyRelease :: Field
- pIpCheck :: Field
- pIpConflictsCheck :: Field
- pNoRemember :: Field
- pMigrationTargetNode :: Field
- pMoveTargetNode :: Field
- pStartupPaused :: Field
- pVerbose :: Field
- pDebugSimulateErrors :: Field
- pErrorCodes :: Field
- pSkipChecks :: Field
- pIgnoreErrors :: Field
- pOptGroupName :: Field
- pDiskParams :: Field
- pHvState :: Field
- pDiskState :: Field
- pIgnoreIpolicy :: Field
- pAllowRuntimeChgs :: Field
- type TestClusterOsListItem = (DdmSimple, NonEmptyString)
- type TestClusterOsList = [TestClusterOsListItem]
- pInstDisks :: Field
- pDiskTemplate :: Field
- pOptDiskTemplate :: Field
- pFileDriver :: Field
- pFileStorageDir :: Field
- pVgName :: Field
- pEnabledHypervisors :: Field
- pEnabledDiskTemplates :: Field
- pHypervisor :: Field
- pClusterHvParams :: Field
- pInstHvParams :: Field
- pClusterBeParams :: Field
- pInstBeParams :: Field
- pResetDefaults :: Field
- pOsHvp :: Field
- pClusterOsParams :: Field
- pInstOsParams :: Field
- pTempOsParams :: Field
- pTempHvParams :: Field
- pTempBeParams :: Field
- pCandidatePoolSize :: Field
- pUidPool :: Field
- pAddUids :: Field
- pRemoveUids :: Field
- pMaintainNodeHealth :: Field
- pModifyEtcHosts :: Field
- pPreallocWipeDisks :: Field
- pNicParams :: Field
- pInstNics :: Field
- pNdParams :: Field
- pIpolicy :: Field
- pDrbdHelper :: Field
- pDefaultIAllocator :: Field
- pMasterNetdev :: Field
- pMasterNetmask :: Field
- pReservedLvs :: Field
- pHiddenOs :: Field
- pBlacklistedOs :: Field
- pUseExternalMipScript :: Field
- pQueryFields :: Field
- pQueryFilter :: Field
- pOobCommand :: Field
- pOobTimeout :: Field
- pIgnoreStatus :: Field
- pPowerDelay :: Field
- pPrimaryIp :: Field
- pSecondaryIp :: Field
- pReadd :: Field
- pNodeGroup :: Field
- pMasterCapable :: Field
- pVmCapable :: Field
- pNames :: Field
- pNodes :: Field
- pRequiredNodes :: Field
- pStorageType :: Field
- pStorageChanges :: Field
- pMasterCandidate :: Field
- pOffline :: Field
- pDrained :: Field
- pAutoPromote :: Field
- pPowered :: Field
- pIallocator :: Field
- pRemoteNode :: Field
- pEvacMode :: Field
- pInstCreateMode :: Field
- pNoInstall :: Field
- pInstOs :: Field
- pPrimaryNode :: Field
- pSecondaryNode :: Field
- pSourceHandshake :: Field
- pSourceInstance :: Field
- pSourceShutdownTimeout :: Field
- pSourceX509Ca :: Field
- pSrcNode :: Field
- pSrcPath :: Field
- pStartInstance :: Field
- pInstTags :: Field
- pMultiAllocInstances :: Field
- pIgnoreFailures :: Field
- pNewName :: Field
- pIgnoreSecondaries :: Field
- pRebootType :: Field
- pIgnoreDiskSize :: Field
- pRecreateDisksInfo :: Field
- pStatic :: Field
- pInstParamsNicChanges :: Field
- pInstParamsDiskChanges :: Field
- pRuntimeMem :: Field
- pOsNameChange :: Field
- pDiskIndex :: Field
- pDiskChgAmount :: Field
- pDiskChgAbsolute :: Field
- pTargetGroups :: Field
- pExportMode :: Field
- pExportTargetNode :: Field
- pRemoveInstance :: Field
- pIgnoreRemoveFailures :: Field
- pX509KeyName :: Field
- pX509DestCA :: Field
- pTagSearchPattern :: Field
- pRestrictedCommand :: Field
- pReplaceDisksMode :: Field
- pReplaceDisksList :: Field
- pAllowFailover :: Field
- pDelayDuration :: Field
- pDelayOnMaster :: Field
- pDelayOnNodes :: Field
- pDelayRepeat :: Field
- pIAllocatorDirection :: Field
- pIAllocatorMode :: Field
- pIAllocatorReqName :: Field
- pIAllocatorNics :: Field
- pIAllocatorDisks :: Field
- pIAllocatorMemory :: Field
- pIAllocatorVCpus :: Field
- pIAllocatorOs :: Field
- pIAllocatorInstances :: Field
- pIAllocatorEvacMode :: Field
- pIAllocatorSpindleUse :: Field
- pIAllocatorCount :: Field
- pJQueueNotifyWaitLock :: Field
- pJQueueNotifyExec :: Field
- pJQueueLogMessages :: Field
- pJQueueFail :: Field
- pTestDummyResult :: Field
- pTestDummyMessages :: Field
- pTestDummyFail :: Field
- pTestDummySubmitJobs :: Field
- pNetworkName :: Field
- pNetworkAddress4 :: Field
- pNetworkGateway4 :: Field
- pNetworkAddress6 :: Field
- pNetworkGateway6 :: Field
- pNetworkMacPrefix :: Field
- pNetworkAddRsvdIps :: Field
- pNetworkRemoveRsvdIps :: Field
- pNetworkMode :: Field
- pNetworkLink :: Field
- pDryRun :: Field
- pDebugLevel :: Field
- pOpPriority :: Field
- pDependencies :: Field
- pComment :: Field
- pReason :: Field
- dOldQuery :: [Field]
- dOldQueryNoLocking :: [Field]
Helper functions and types
Type aliases
booleanField :: String -> FieldSource
defaultFalse :: String -> FieldSource
defaultTrue :: String -> FieldSource
stringField :: String -> FieldSource
optionalStringField :: String -> FieldSource
optionalNEStringField :: String -> FieldSource
type UncheckedValue = JSValueSource
type UncheckedDict = JSObject JSValueSource
type UncheckedList = [JSValue]Source
forceNonNeg :: (Num a, Ord a, Show a) => a -> NonNegative aSource
Tags
Data type representing what items do the tag operations apply to.
tagTypeFromRaw :: forall m. Monad m => String -> m TagTypeSource
tagTypeToRaw :: TagType -> StringSource
Data type holding a tag object (type and object name).
TagInstance String | |
TagNode String | |
TagGroup String | |
TagNetwork String | |
TagCluster |
tagObjectFrom :: Monad m => TagType -> JSValue -> m TagObjectSource
Builds a TagObject
from a tag type and name.
tagNameField :: StringSource
encodeTagObject :: TagObject -> (JSValue, [(String, JSValue)])Source
Custom encoder for TagObject
as represented in an opcode.
decodeTagObject :: Monad m => [(String, JSValue)] -> JSValue -> m TagObjectSource
Custom decoder for TagObject
as represented in an opcode.
Disks
data ReplaceDisksMode Source
Replace disks type.
Bounded ReplaceDisksMode | |
Enum ReplaceDisksMode | |
Eq ReplaceDisksMode | |
Ord ReplaceDisksMode | |
Show ReplaceDisksMode | |
Arbitrary ReplaceDisksMode | |
JSON ReplaceDisksMode |
replaceDisksModeFromRaw :: forall m. Monad m => String -> m ReplaceDisksModeSource
replaceDisksModeToRaw :: ReplaceDisksMode -> StringSource
Disk index type (embedding constraints on the index value via a smart constructor).
DiskIndex | |
|
mkDiskIndex :: Monad m => Int -> m DiskIndexSource
Smart constructor for DiskIndex
.
I* param types
data DiskAccess Source
Type holding disk access modes.
Bounded DiskAccess | |
Enum DiskAccess | |
Eq DiskAccess | |
Ord DiskAccess | |
Show DiskAccess | |
Arbitrary DiskAccess | |
JSON DiskAccess |
diskAccessFromRaw :: forall m. Monad m => String -> m DiskAccessSource
diskAccessToRaw :: DiskAccess -> StringSource
data INicParams Source
NIC modification definition.
INicParams | |
|
Eq INicParams | |
Show INicParams | |
Arbitrary INicParams | |
JSON INicParams |
loadINicParams :: JSValue -> Result INicParamsSource
saveINicParams :: INicParams -> JSValueSource
toDictINicParams :: INicParams -> [(String, JSValue)]Source
data IDiskParams Source
Disk modification definition. FIXME: disksize should be VTYPE_UNIT.
IDiskParams | |
|
Eq IDiskParams | |
Show IDiskParams | |
Arbitrary IDiskParams | |
JSON IDiskParams |
loadIDiskParams :: JSValue -> Result IDiskParamsSource
saveIDiskParams :: IDiskParams -> JSValueSource
toDictIDiskParams :: IDiskParams -> [(String, JSValue)]Source
data RecreateDisksInfo Source
Disk changes type for OpInstanceRecreateDisks. This is a bit strange, because the type in Python is something like Either [DiskIndex] [DiskChanges], but we can't represent the type of an empty list in JSON, so we have to add a custom case for the empty list.
RecreateDisksAll | |
RecreateDisksIndices (NonEmpty DiskIndex) | |
RecreateDisksParams (NonEmpty (DiskIndex, IDiskParams)) |
Eq RecreateDisksInfo | |
Show RecreateDisksInfo | |
Arbitrary RecreateDisksInfo | |
JSON RecreateDisksInfo |
readRecreateDisks :: JSValue -> Result RecreateDisksInfoSource
data DdmOldChanges Source
Simple type for old-style ddm changes.
Eq DdmOldChanges | |
Show DdmOldChanges | |
Arbitrary DdmOldChanges | |
JSON DdmOldChanges |
readDdmOldChanges :: JSValue -> Result DdmOldChangesSource
data SetParamsMods a Source
Instance disk or nic modifications.
SetParamsEmpty | |
SetParamsDeprecated (NonEmpty (DdmOldChanges, a)) | |
SetParamsNew (NonEmpty (DdmFull, Int, a)) |
Eq a => Eq (SetParamsMods a) | |
Show a => Show (SetParamsMods a) | |
Arbitrary a => Arbitrary (SetParamsMods a) | |
JSON a => JSON (SetParamsMods a) |
readSetParams :: JSON a => JSValue -> Result (SetParamsMods a)Source
data ExportTarget Source
Custom type for target_node parameter of OpBackupExport, which varies depending on mode. FIXME: this uses an UncheckedList since we don't care about individual rows (just like the Python code tests). But the proper type could be parsed if we wanted.
Eq ExportTarget | |
Show ExportTarget | |
Arbitrary ExportTarget | |
JSON ExportTarget |
readExportTarget :: JSValue -> Result ExportTargetSource
Parameters
A required instance name (for single-instance LUs).
A list of instances.
Tags object.
Selected output fields.
pShutdownTimeout :: FieldSource
How long to wait for instance to shut down.
pShutdownTimeout' :: FieldSource
Another name for the shutdown timeout, because we like to be inconsistent.
pShutdownInstance :: FieldSource
Whether to shutdown the instance in backup-export.
pIgnoreOfflineNodes :: FieldSource
Whether to ignore offline nodes.
List of nodes.
A required node group name (for single-group LUs).
Migration type (live/non-live).
Obsolete 'live' migration mode (boolean).
pMigrationCleanup :: FieldSource
Migration cleanup parameter.
Whether to force an unknown OS variant.
Whether to wait for the disk to synchronize.
pWaitForSyncFalse :: FieldSource
Whether to wait for the disk to synchronize (defaults to false).
pIgnoreConsistency :: FieldSource
Whether to ignore disk consistency
Storage name.
Whether to use synchronization.
pOpportunisticLocking :: FieldSource
Whether to employ opportunistic locking for nodes, meaning nodes already locked by another opcode won't be considered for instance allocation (only when an iallocator is used).
Whether to check name.
pNodeGroupAllocPolicy :: FieldSource
Instance allocation policy.
pGroupNodeParams :: FieldSource
Default node parameters for group.
Resource(s) to query for.
Whether to release locks as soon as possible.
pIpConflictsCheck :: FieldSource
Check for conflicting IPs.
Do not remember instance state changes.
pMigrationTargetNode :: FieldSource
Target node for instance migration/failover.
pMoveTargetNode :: FieldSource
Target node for instance move (required).
Pause instance at startup.
Parameters for cluster verification
pDebugSimulateErrors :: FieldSource
Whether to simulate errors (useful for debugging).
Error codes.
Which checks to skip.
List of error codes that should be treated as warnings.
Optional group name.
Disk templates' parameter defaults.
Parameters for node resource model
Set disk states.
Whether to ignore ipolicy violations.
pAllowRuntimeChgs :: FieldSource
Allow runtime changes while migrating.
List of instance disks.
Instance disk template.
pOptDiskTemplate :: FieldSource
Instance disk template.
File driver.
pFileStorageDir :: FieldSource
Directory for storing file-backed disks.
pEnabledHypervisors :: FieldSource
List of enabled hypervisors.
pEnabledDiskTemplates :: FieldSource
List of enabled disk templates.
Selected hypervisor for an instance.
pClusterHvParams :: FieldSource
Cluster-wide hypervisor parameters, hypervisor-dependent.
Instance hypervisor parameters.
pClusterBeParams :: FieldSource
Cluster-wide beparams.
Instance beparams.
Reset instance parameters to default if equal.
pClusterOsParams :: FieldSource
Cluster-wide OS parameter defaults.
Instance OS parameters.
Temporary OS parameters (currently only in reinstall, might be added to install as well).
Temporary hypervisor parameters, hypervisor-dependent.
Temporary backend parameters.
pCandidatePoolSize :: FieldSource
Candidate pool size.
Set UID pool, must be list of lists describing UID ranges (two items, start and end inclusive.
Extend UID pool, must be list of lists describing UID ranges (two items, start and end inclusive.
Shrink UID pool, must be list of lists describing UID ranges (two items, start and end inclusive) to be removed.
pMaintainNodeHealth :: FieldSource
Whether to automatically maintain node health.
pModifyEtcHosts :: FieldSource
Whether to modify and keep in sync the etchosts
files of nodes.
pPreallocWipeDisks :: FieldSource
Whether to wipe disks before allocating them to instances.
Cluster-wide NIC parameter defaults.
DRBD helper program.
pDefaultIAllocator :: FieldSource
Default iallocator for cluster.
Master network device.
Netmask of the master IP.
List of reserved LVs.
Modify list of hidden operating systems: each modification must have two items, the operation and the OS name; the operation can be add or remove.
Modify list of blacklisted operating systems: each modification must have two items, the operation and the OS name; the operation can be add or remove.
pUseExternalMipScript :: FieldSource
Whether to use an external master IP address setup script.
Requested fields.
Query filter.
OOB command to run.
Timeout before the OOB helper will be terminated.
Ignores the node offline status for power off.
Time in seconds to wait between powering on nodes.
Primary IP address.
Secondary IP address.
Initial node group.
Whether node can become master or master candidate.
Whether node can host instances.
Required list of node names.
Storage type.
pStorageChanges :: FieldSource
Storage changes (unchecked).
pMasterCandidate :: FieldSource
Whether the node should become a master candidate.
Whether node(s) should be promoted to master candidate if necessary.
Iallocator for deciding the target node for shared-storage instances during migrate and failover.
New secondary node.
pInstCreateMode :: FieldSource
Instance creation mode.
Do not install the OS (will disable automatic start).
Primary node for an instance.
Secondary node for an instance.
pSourceHandshake :: FieldSource
Signed handshake from source (remote import only).
pSourceInstance :: FieldSource
Source instance name (remote import only).
pSourceShutdownTimeout :: FieldSource
How long source instance was given to shut down (remote import only). FIXME: non-negative int, whereas the constant is a plain int.
Source X509 CA in PEM format (remote import only).
Whether to start instance after creation.
Instance tags. FIXME: unify/simplify with pTags, once that migrates to NonEmpty String.
pMultiAllocInstances :: FieldSource
Unchecked list of OpInstanceCreate, used in OpInstanceMultiAlloc.
pIgnoreFailures :: FieldSource
Ignore failures parameter.
pIgnoreSecondaries :: FieldSource
Whether to start the instance even if secondary disks are failing.
How to reboot the instance.
pIgnoreDiskSize :: FieldSource
Whether to ignore recorded disk size.
pRecreateDisksInfo :: FieldSource
Disk list for recreate disks.
pInstParamsNicChanges :: FieldSource
InstanceSetParams NIC changes.
pInstParamsDiskChanges :: FieldSource
InstanceSetParams Disk changes.
New runtime memory.
Change the instance's OS without reinstalling the instance
Disk index for e.g. grow disk.
Disk amount to add or grow to.
pDiskChgAbsolute :: FieldSource
Whether the amount parameter is an absolute target or a relative one.
Destination group names or UUIDs (defaults to "all but current group".
Export mode field.
pExportTargetNode :: FieldSource
Export target_node field, depends on mode.
pRemoveInstance :: FieldSource
Whether to remove instance after export.
pIgnoreRemoveFailures :: FieldSource
Whether to ignore failures while removing instances.
Name of X509 key (remote export only).
Destination X509 CA (remote export only).
pTagSearchPattern :: FieldSource
Search pattern (regular expression). FIXME: this should be compiled at load time?
pRestrictedCommand :: FieldSource
Restricted command name.
pReplaceDisksMode :: FieldSource
Replace disks mode.
pReplaceDisksList :: FieldSource
List of disk indices.
Whether do allow failover in migrations.
Test opcode parameters
Duration parameter for OpTestDelay
.
on_master field for OpTestDelay
.
on_nodes field for OpTestDelay
.
Repeat parameter for OpTestDelay.
pIAllocatorDirection :: FieldSource
IAllocator test direction.
pIAllocatorMode :: FieldSource
IAllocator test mode.
pIAllocatorReqName :: FieldSource
IAllocator target name (new instance, node to evac, etc.).
pIAllocatorNics :: FieldSource
Custom OpTestIAllocator nics.
pIAllocatorDisks :: FieldSource
Custom OpTestAllocator disks.
pIAllocatorMemory :: FieldSource
IAllocator memory field.
pIAllocatorVCpus :: FieldSource
IAllocator vcpus field.
IAllocator os field.
pIAllocatorInstances :: FieldSource
IAllocator instances field.
pIAllocatorEvacMode :: FieldSource
IAllocator evac mode.
pIAllocatorSpindleUse :: FieldSource
IAllocator spindle use.
pIAllocatorCount :: FieldSource
IAllocator count field.
pJQueueNotifyWaitLock :: FieldSource
OpTestJqueue
notify_waitlock.
pJQueueNotifyExec :: FieldSource
OpTestJQueue
notify_exec.
pJQueueLogMessages :: FieldSource
OpTestJQueue
log_messages.
OpTestJQueue
fail attribute.
pTestDummyResult :: FieldSource
OpTestDummy
result field.
pTestDummyMessages :: FieldSource
OpTestDummy
messages field.
OpTestDummy
fail field.
pTestDummySubmitJobs :: FieldSource
OpTestDummy
submit_jobs field.
Network parameters
Network name.
pNetworkAddress4 :: FieldSource
Network address (IPv4 subnet). FIXME: no real type for this.
pNetworkGateway4 :: FieldSource
Network gateway (IPv4 address). FIXME: no real type for this.
pNetworkAddress6 :: FieldSource
Network address (IPv6 subnet). FIXME: no real type for this.
pNetworkGateway6 :: FieldSource
Network gateway (IPv6 address). FIXME: no real type for this.
pNetworkMacPrefix :: FieldSource
Network specific mac prefix (that overrides the cluster one).
pNetworkAddRsvdIps :: FieldSource
Network add reserved IPs.
pNetworkRemoveRsvdIps :: FieldSource
Network remove reserved IPs.
Network mode when connecting to a group.
Network link when connecting to a group.
Common opcode parameters
Debug level.
Opcode priority. Note: python uses a separate constant, we're using the actual value we know it's the default.
Job dependencies.
Entire opcode parameter list
dOldQueryNoLocking :: [Field]Source
Old-style query opcode, without locking.