ganeti

Safe HaskellNone

Ganeti.OpParams

Contents

Description

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.

Synopsis

Helper functions and types

Type aliases

type UncheckedValue = JSValueSource

type UncheckedDict = JSObject JSValueSource

type UncheckedList = [JSValue]Source

forceNonNeg :: (Num a, Ord a, Show a) => a -> NonNegative aSource

Tags

data TagType Source

Data type representing what items do the tag operations apply to.

Instances

Bounded TagType 
Enum TagType 
Eq TagType 
Ord TagType 
Show TagType 
JSON TagType 

tagTypeFromRaw :: forall m. Monad m => String -> m TagTypeSource

data TagObject Source

Data type holding a tag object (type and object name).

Constructors

TagInstance String 
TagNode String 
TagGroup String 
TagNetwork String 
TagCluster 

Instances

Eq TagObject 
Show TagObject 
Arbitrary TagObject 

tagNameOf :: TagObject -> Maybe StringSource

Gets the potential tag object name.

tagObjectFrom :: Monad m => TagType -> JSValue -> m TagObjectSource

Builds a TagObject from a tag type and name.

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

replaceDisksModeFromRaw :: forall m. Monad m => String -> m ReplaceDisksModeSource

newtype DiskIndex Source

Disk index type (embedding constraints on the index value via a smart constructor).

Constructors

DiskIndex 

Fields

unDiskIndex :: Int
 

Instances

Eq DiskIndex 
Ord DiskIndex 
Show DiskIndex 
Arbitrary DiskIndex 
JSON DiskIndex 

mkDiskIndex :: Monad m => Int -> m DiskIndexSource

Smart constructor for DiskIndex.

I* param types

data DiskAccess Source

Type holding disk access modes.

Instances

Bounded DiskAccess 
Enum DiskAccess 
Eq DiskAccess 
Ord DiskAccess 
Show DiskAccess 
Arbitrary DiskAccess 
JSON DiskAccess 

diskAccessFromRaw :: forall m. Monad m => String -> m DiskAccessSource

data INicParams Source

NIC modification definition.

Constructors

INicParams 

Fields

inicMac :: Maybe NonEmptyString
 
inicIp :: Maybe String
 
inicMode :: Maybe NonEmptyString
 
inicLink :: Maybe NonEmptyString
 
inicName :: Maybe NonEmptyString
 

Instances

Eq INicParams 
Show INicParams 
Arbitrary INicParams 
JSON INicParams 

loadINicParams :: JSValue -> Result INicParamsSource

toDictINicParams :: INicParams -> [(String, JSValue)]Source

data IDiskParams Source

Disk modification definition. FIXME: disksize should be VTYPE_UNIT.

Constructors

IDiskParams 

Fields

idiskSize :: Maybe Int
 
idiskMode :: Maybe DiskAccess
 
idiskAdopt :: Maybe NonEmptyString
 
idiskVg :: Maybe NonEmptyString
 
idiskMetavg :: Maybe NonEmptyString
 
idiskName :: Maybe NonEmptyString
 

Instances

Eq IDiskParams 
Show IDiskParams 
Arbitrary IDiskParams 
JSON IDiskParams 

loadIDiskParams :: JSValue -> Result IDiskParamsSource

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.

data DdmOldChanges Source

Simple type for old-style ddm changes.

Instances

data SetParamsMods a Source

Instance disk or nic modifications.

Instances

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.

Instances

Parameters

pInstanceName :: FieldSource

A required instance name (for single-instance LUs).

pInstanceUuid :: FieldSource

An instance UUID (for single-instance LUs).

pInstances :: FieldSource

A list of instances.

pName :: FieldSource

A generic name.

pTagsList :: FieldSource

Tags list.

pTagsObject :: FieldSource

Tags object.

pOutputFields :: FieldSource

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.

pForce :: FieldSource

Whether to force the operation.

pIgnoreOfflineNodes :: FieldSource

Whether to ignore offline nodes.

pNodeName :: FieldSource

A required node name (for single-node LUs).

pNodeUuid :: FieldSource

A node UUID (for single-node LUs).

pNodeNames :: FieldSource

List of nodes.

pNodeUuids :: FieldSource

List of node UUIDs.

pGroupName :: FieldSource

A required node group name (for single-group LUs).

pMigrationMode :: FieldSource

Migration type (live/non-live).

pMigrationLive :: FieldSource

Obsolete 'live' migration mode (boolean).

pMigrationCleanup :: FieldSource

Migration cleanup parameter.

pForceVariant :: FieldSource

Whether to force an unknown OS variant.

pWaitForSync :: FieldSource

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

pStorageName :: FieldSource

Storage name.

pUseLocking :: FieldSource

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).

pNameCheck :: FieldSource

Whether to check name.

pNodeGroupAllocPolicy :: FieldSource

Instance allocation policy.

pGroupNodeParams :: FieldSource

Default node parameters for group.

pQueryWhat :: FieldSource

Resource(s) to query for.

pEarlyRelease :: FieldSource

Whether to release locks as soon as possible.

pIpCheck :: FieldSource

Whether to ensure instance's IP address is inactive.

pIpConflictsCheck :: FieldSource

Check for conflicting IPs.

pNoRemember :: FieldSource

Do not remember instance state changes.

pMigrationTargetNode :: FieldSource

Target node for instance migration/failover.

pMigrationTargetNodeUuid :: FieldSource

Target node UUID for instance migration/failover.

pMoveTargetNode :: FieldSource

Target node for instance move (required).

pMoveTargetNodeUuid :: FieldSource

Target node UUID for instance move.

pStartupPaused :: FieldSource

Pause instance at startup.

pVerbose :: FieldSource

Verbose mode.

Parameters for cluster verification

pDebugSimulateErrors :: FieldSource

Whether to simulate errors (useful for debugging).

pErrorCodes :: FieldSource

Error codes.

pSkipChecks :: FieldSource

Which checks to skip.

pIgnoreErrors :: FieldSource

List of error codes that should be treated as warnings.

pOptGroupName :: FieldSource

Optional group name.

pDiskParams :: FieldSource

Disk templates' parameter defaults.

Parameters for node resource model

pHvState :: FieldSource

Set hypervisor states.

pDiskState :: FieldSource

Set disk states.

pIgnoreIpolicy :: FieldSource

Whether to ignore ipolicy violations.

pAllowRuntimeChgs :: FieldSource

Allow runtime changes while migrating.

pInstDisks :: FieldSource

List of instance disks.

pDiskTemplate :: FieldSource

Instance disk template.

pOptDiskTemplate :: FieldSource

Instance disk template.

pFileDriver :: FieldSource

File driver.

pFileStorageDir :: FieldSource

Directory for storing file-backed disks.

pGlobalFileStorageDir :: FieldSource

Global directory for storing file-backed disks.

pGlobalSharedFileStorageDir :: FieldSource

Global directory for storing shared-file-backed disks.

pVgName :: FieldSource

Volume group name.

pEnabledHypervisors :: FieldSource

List of enabled hypervisors.

pEnabledDiskTemplates :: FieldSource

List of enabled disk templates.

pHypervisor :: FieldSource

Selected hypervisor for an instance.

pClusterHvParams :: FieldSource

Cluster-wide hypervisor parameters, hypervisor-dependent.

pInstHvParams :: FieldSource

Instance hypervisor parameters.

pClusterBeParams :: FieldSource

Cluster-wide beparams.

pInstBeParams :: FieldSource

Instance beparams.

pResetDefaults :: FieldSource

Reset instance parameters to default if equal.

pOsHvp :: FieldSource

Cluster-wide per-OS hypervisor parameter defaults.

pClusterOsParams :: FieldSource

Cluster-wide OS parameter defaults.

pInstOsParams :: FieldSource

Instance OS parameters.

pTempOsParams :: FieldSource

Temporary OS parameters (currently only in reinstall, might be added to install as well).

pTempHvParams :: FieldSource

Temporary hypervisor parameters, hypervisor-dependent.

pTempBeParams :: FieldSource

Temporary backend parameters.

pCandidatePoolSize :: FieldSource

Candidate pool size.

pUidPool :: FieldSource

Set UID pool, must be list of lists describing UID ranges (two items, start and end inclusive.

pAddUids :: FieldSource

Extend UID pool, must be list of lists describing UID ranges (two items, start and end inclusive.

pRemoveUids :: FieldSource

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.

pNicParams :: FieldSource

Cluster-wide NIC parameter defaults.

pInstNics :: FieldSource

Instance NIC definitions.

pNdParams :: FieldSource

Cluster-wide node parameter defaults.

pIpolicy :: FieldSource

Cluster-wide ipolicy specs.

pDrbdHelper :: FieldSource

DRBD helper program.

pDefaultIAllocator :: FieldSource

Default iallocator for cluster.

pMasterNetdev :: FieldSource

Master network device.

pMasterNetmask :: FieldSource

Netmask of the master IP.

pReservedLvs :: FieldSource

List of reserved LVs.

pHiddenOs :: FieldSource

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.

pBlacklistedOs :: FieldSource

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.

pQueryFields :: FieldSource

Requested fields.

pQueryFilter :: FieldSource

Query filter.

pOobCommand :: FieldSource

OOB command to run.

pOobTimeout :: FieldSource

Timeout before the OOB helper will be terminated.

pIgnoreStatus :: FieldSource

Ignores the node offline status for power off.

pPowerDelay :: FieldSource

Time in seconds to wait between powering on nodes.

pPrimaryIp :: FieldSource

Primary IP address.

pSecondaryIp :: FieldSource

Secondary IP address.

pReadd :: FieldSource

Whether node is re-added to cluster.

pNodeGroup :: FieldSource

Initial node group.

pMasterCapable :: FieldSource

Whether node can become master or master candidate.

pVmCapable :: FieldSource

Whether node can host instances.

pNames :: FieldSource

List of names.

pNodes :: FieldSource

List of node names.

pRequiredNodes :: FieldSource

Required list of node names.

pRequiredNodeUuids :: FieldSource

Required list of node names.

pStorageType :: FieldSource

Storage type.

pStorageChanges :: FieldSource

Storage changes (unchecked).

pMasterCandidate :: FieldSource

Whether the node should become a master candidate.

pOffline :: FieldSource

Whether the node should be marked as offline.

pDrained :: FieldSource

Whether the node should be marked as drained.

pAutoPromote :: FieldSource

Whether node(s) should be promoted to master candidate if necessary.

pPowered :: FieldSource

Whether the node should be marked as powered

pIallocator :: FieldSource

Iallocator for deciding the target node for shared-storage instances during migrate and failover.

pRemoteNode :: FieldSource

New secondary node.

pRemoteNodeUuid :: FieldSource

New secondary node UUID.

pEvacMode :: FieldSource

Node evacuation mode.

pInstCreateMode :: FieldSource

Instance creation mode.

pNoInstall :: FieldSource

Do not install the OS (will disable automatic start).

pInstOs :: FieldSource

OS type for instance installation.

pPrimaryNode :: FieldSource

Primary node for an instance.

pPrimaryNodeUuid :: FieldSource

Primary node UUID for an instance.

pSecondaryNode :: FieldSource

Secondary node for an instance.

pSecondaryNodeUuid :: FieldSource

Secondary node UUID 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.

pSourceX509Ca :: FieldSource

Source X509 CA in PEM format (remote import only).

pSrcNode :: FieldSource

Source node for import.

pSrcNodeUuid :: FieldSource

Source node for import.

pSrcPath :: FieldSource

Source directory for import.

pStartInstance :: FieldSource

Whether to start instance after creation.

pInstTags :: FieldSource

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.

pNewName :: FieldSource

New instance or cluster name.

pIgnoreSecondaries :: FieldSource

Whether to start the instance even if secondary disks are failing.

pRebootType :: FieldSource

How to reboot the instance.

pIgnoreDiskSize :: FieldSource

Whether to ignore recorded disk size.

pRecreateDisksInfo :: FieldSource

Disk list for recreate disks.

pStatic :: FieldSource

Whether to only return configuration data without querying nodes.

pInstParamsNicChanges :: FieldSource

InstanceSetParams NIC changes.

pInstParamsDiskChanges :: FieldSource

InstanceSetParams Disk changes.

pRuntimeMem :: FieldSource

New runtime memory.

pOsNameChange :: FieldSource

Change the instance's OS without reinstalling the instance

pDiskIndex :: FieldSource

Disk index for e.g. grow disk.

pDiskChgAmount :: FieldSource

Disk amount to add or grow to.

pDiskChgAbsolute :: FieldSource

Whether the amount parameter is an absolute target or a relative one.

pTargetGroups :: FieldSource

Destination group names or UUIDs (defaults to "all but current group".

pExportMode :: FieldSource

Export mode field.

pExportTargetNode :: FieldSource

Export target_node field, depends on mode.

pExportTargetNodeUuid :: FieldSource

Export target node UUID field.

pRemoveInstance :: FieldSource

Whether to remove instance after export.

pIgnoreRemoveFailures :: FieldSource

Whether to ignore failures while removing instances.

pX509KeyName :: FieldSource

Name of X509 key (remote export only).

pX509DestCA :: FieldSource

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.

pAllowFailover :: FieldSource

Whether do allow failover in migrations.

Test opcode parameters

pDelayDuration :: FieldSource

Duration parameter for OpTestDelay.

pDelayOnMaster :: FieldSource

on_master field for OpTestDelay.

pDelayOnNodes :: FieldSource

on_nodes field for OpTestDelay.

pDelayOnNodeUuids :: FieldSource

on_node_uuids field for OpTestDelay.

pDelayRepeat :: FieldSource

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.

pIAllocatorOs :: FieldSource

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.

pJQueueFail :: FieldSource

OpTestJQueue fail attribute.

pTestDummyResult :: FieldSource

OpTestDummy result field.

pTestDummyMessages :: FieldSource

OpTestDummy messages field.

pTestDummyFail :: FieldSource

OpTestDummy fail field.

pTestDummySubmitJobs :: FieldSource

OpTestDummy submit_jobs field.

Network parameters

pNetworkName :: FieldSource

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.

pNetworkMode :: FieldSource

Network mode when connecting to a group.

pNetworkLink :: FieldSource

Network link when connecting to a group.

Common opcode parameters

pDryRun :: FieldSource

Run checks only, don't execute.

pDebugLevel :: FieldSource

Debug level.

pOpPriority :: FieldSource

Opcode priority. Note: python uses a separate constant, we're using the actual value we know it's the default.

pDependencies :: FieldSource

Job dependencies.

pComment :: FieldSource

Comment field.

pReason :: FieldSource

Reason trail field.

Entire opcode parameter list

dOldQuery :: [Field]Source

Old-style query opcode, with locking.

dOldQueryNoLocking :: [Field]Source

Old-style query opcode, without locking.