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

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

Disks

newtype DiskIndex Source

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

Constructors

DiskIndex 

Fields

unDiskIndex :: Int
 

Instances

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
 
inicVlan :: Maybe String
 
inicBridge :: Maybe NonEmptyString
 
inicNetwork :: Maybe NonEmptyString
 

Instances

loadINicParams :: JSValue -> Result INicParamsSource

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

data IDiskParams Source

Disk modification definition.

Constructors

IDiskParams 

Fields

idiskSize :: Maybe Int
 
idiskMode :: Maybe DiskAccess
 
idiskAdopt :: Maybe NonEmptyString
 
idiskVg :: Maybe NonEmptyString
 
idiskMetavg :: Maybe NonEmptyString
 
idiskName :: Maybe NonEmptyString
 
idiskProvider :: Maybe NonEmptyString
 
idiskSpindles :: Maybe Int
 
idiskOpaque :: Map String JSValue
 

Instances

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) 
PyValue a => PyValue (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 [JSValue] 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

Common opcode parameters

Parameters

pHotplug :: FieldSource

Whether to hotplug device.

pClusterFileStorageDir :: FieldSource

Cluster-wide default directory for storing file-backed disks.

pClusterSharedFileStorageDir :: FieldSource

Cluster-wide default directory for storing shared-file-backed disks.

pClusterGlusterStorageDir :: FieldSource

Cluster-wide default directory for storing Gluster-backed disks.

pVgName :: FieldSource

Volume group name.

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.

pShutdownTimeout' :: FieldSource

Another name for the shutdown timeout, because we like to be inconsistent.