Safe HaskellNone




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.


Helper functions and types

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


newtype DiskIndex Source

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




unDiskIndex :: Int


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

data INicParams Source

NIC modification definition.




inicMac :: Maybe NonEmptyString
inicIp :: Maybe String
inicMode :: Maybe NonEmptyString
inicLink :: Maybe NonEmptyString
inicName :: Maybe NonEmptyString
inicVlan :: Maybe String
inicBridge :: Maybe NonEmptyString
inicNetwork :: Maybe NonEmptyString

loadINicParams :: JSValue -> Result INicParamsSource

data IDiskParams Source

Disk modification definition.




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

loadIDiskParams :: JSValue -> Result IDiskParamsSource

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.


data SetParamsMods a Source

Instance disk or nic modifications.


Eq a => Eq (SetParamsMods a) 
Ord a => Ord (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.


Common opcode 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.

pZeroingImage :: FieldSource

The OS to use when zeroing instance disks.

pCompressionTools :: FieldSource

The additional tools that can be used to compress data in transit

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.