ganeti
Safe HaskellNone

Ganeti.OpParams

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

booleanField :: String -> Field Source #

Build a boolean field.

defaultFalse :: String -> Field Source #

Default a field to False.

defaultTrue :: String -> Field Source #

Default a field to True.

stringField :: String -> Field Source #

An alias for a String field.

optionalStringField :: String -> Field Source #

An alias for an optional string field.

optionalNEStringField :: String -> Field Source #

An alias for an optional non-empty string field.

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

Function to force a non-negative value, without returning via a monad. This is needed for, and should be used only in the case of forcing constants. In case the constant is wrong (< 0), this will become a runtime error.

Disks

newtype DiskIndex Source #

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

Constructors

DiskIndex 

Fields

Instances

Instances details
Eq DiskIndex # 
Instance details

Defined in Ganeti.OpParams

Methods

(==) :: DiskIndex -> DiskIndex -> Bool

(/=) :: DiskIndex -> DiskIndex -> Bool

Ord DiskIndex # 
Instance details

Defined in Ganeti.OpParams

Methods

compare :: DiskIndex -> DiskIndex -> Ordering

(<) :: DiskIndex -> DiskIndex -> Bool

(<=) :: DiskIndex -> DiskIndex -> Bool

(>) :: DiskIndex -> DiskIndex -> Bool

(>=) :: DiskIndex -> DiskIndex -> Bool

max :: DiskIndex -> DiskIndex -> DiskIndex

min :: DiskIndex -> DiskIndex -> DiskIndex

Show DiskIndex # 
Instance details

Defined in Ganeti.OpParams

Methods

showsPrec :: Int -> DiskIndex -> ShowS

show :: DiskIndex -> String

showList :: [DiskIndex] -> ShowS

JSON DiskIndex # 
Instance details

Defined in Ganeti.OpParams

Methods

readJSON :: JSValue -> Result DiskIndex

showJSON :: DiskIndex -> JSValue

readJSONs :: JSValue -> Result [DiskIndex]

showJSONs :: [DiskIndex] -> JSValue

PyValue DiskIndex # 
Instance details

Defined in Ganeti.OpCodes

Methods

showValue :: DiskIndex -> String Source #

showValueList :: [DiskIndex] -> String Source #

Arbitrary DiskIndex 
Instance details

Defined in Test.Ganeti.OpCodes

mkDiskIndex :: MonadFail m => Int -> m DiskIndex Source #

Smart constructor for DiskIndex.

I* param types

data DiskAccess Source #

Type holding disk access modes.

Instances

Instances details
Bounded DiskAccess # 
Instance details

Defined in Ganeti.OpParams

Enum DiskAccess # 
Instance details

Defined in Ganeti.OpParams

Eq DiskAccess # 
Instance details

Defined in Ganeti.OpParams

Methods

(==) :: DiskAccess -> DiskAccess -> Bool

(/=) :: DiskAccess -> DiskAccess -> Bool

Ord DiskAccess # 
Instance details

Defined in Ganeti.OpParams

Show DiskAccess # 
Instance details

Defined in Ganeti.OpParams

Methods

showsPrec :: Int -> DiskAccess -> ShowS

show :: DiskAccess -> String

showList :: [DiskAccess] -> ShowS

JSON DiskAccess # 
Instance details

Defined in Ganeti.OpParams

Methods

readJSON :: JSValue -> Result DiskAccess

showJSON :: DiskAccess -> JSValue

readJSONs :: JSValue -> Result [DiskAccess]

showJSONs :: [DiskAccess] -> JSValue

Arbitrary DiskAccess 
Instance details

Defined in Test.Ganeti.OpCodes

diskAccessFromRaw :: forall m. (Monad m, MonadFail m) => String -> m DiskAccess Source #

data INicParams Source #

NIC modification definition.

Constructors

INicParams 

Fields

Instances

Instances details
Eq INicParams # 
Instance details

Defined in Ganeti.OpParams

Methods

(==) :: INicParams -> INicParams -> Bool

(/=) :: INicParams -> INicParams -> Bool

Ord INicParams # 
Instance details

Defined in Ganeti.OpParams

Show INicParams # 
Instance details

Defined in Ganeti.OpParams

Methods

showsPrec :: Int -> INicParams -> ShowS

show :: INicParams -> String

showList :: [INicParams] -> ShowS

JSON INicParams # 
Instance details

Defined in Ganeti.OpParams

Methods

readJSON :: JSValue -> Result INicParams

showJSON :: INicParams -> JSValue

readJSONs :: JSValue -> Result [INicParams]

showJSONs :: [INicParams] -> JSValue

ArrayObject INicParams # 
Instance details

Defined in Ganeti.OpParams

Methods

toJSArray :: INicParams -> [JSValue] Source #

fromJSArray :: [JSValue] -> Result INicParams Source #

DictObject INicParams # 
Instance details

Defined in Ganeti.OpParams

Methods

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

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result INicParams Source #

fromDict :: [(String, JSValue)] -> Result INicParams Source #

PyValue INicParams # 
Instance details

Defined in Ganeti.OpCodes

Methods

showValue :: INicParams -> String Source #

showValueList :: [INicParams] -> String Source #

Arbitrary INicParams 
Instance details

Defined in Test.Ganeti.OpCodes

loadINicParams :: JSValue -> Result INicParams Source #

data IDiskParams Source #

Disk modification definition.

Constructors

IDiskParams 

Fields

Instances

Instances details
Eq IDiskParams # 
Instance details

Defined in Ganeti.OpParams

Methods

(==) :: IDiskParams -> IDiskParams -> Bool

(/=) :: IDiskParams -> IDiskParams -> Bool

Ord IDiskParams # 
Instance details

Defined in Ganeti.OpParams

Show IDiskParams # 
Instance details

Defined in Ganeti.OpParams

Methods

showsPrec :: Int -> IDiskParams -> ShowS

show :: IDiskParams -> String

showList :: [IDiskParams] -> ShowS

JSON IDiskParams # 
Instance details

Defined in Ganeti.OpParams

Methods

readJSON :: JSValue -> Result IDiskParams

showJSON :: IDiskParams -> JSValue

readJSONs :: JSValue -> Result [IDiskParams]

showJSONs :: [IDiskParams] -> JSValue

ArrayObject IDiskParams # 
Instance details

Defined in Ganeti.OpParams

Methods

toJSArray :: IDiskParams -> [JSValue] Source #

fromJSArray :: [JSValue] -> Result IDiskParams Source #

DictObject IDiskParams # 
Instance details

Defined in Ganeti.OpParams

Methods

toDict :: IDiskParams -> [(String, JSValue)] Source #

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result IDiskParams Source #

fromDict :: [(String, JSValue)] -> Result IDiskParams Source #

PyValue IDiskParams # 
Instance details

Defined in Ganeti.OpCodes

Methods

showValue :: IDiskParams -> String Source #

showValueList :: [IDiskParams] -> String Source #

Arbitrary IDiskParams 
Instance details

Defined in Test.Ganeti.OpCodes

loadIDiskParams :: JSValue -> Result IDiskParams 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.

Instances

Instances details
Eq RecreateDisksInfo # 
Instance details

Defined in Ganeti.OpParams

Ord RecreateDisksInfo # 
Instance details

Defined in Ganeti.OpParams

Show RecreateDisksInfo # 
Instance details

Defined in Ganeti.OpParams

Methods

showsPrec :: Int -> RecreateDisksInfo -> ShowS

show :: RecreateDisksInfo -> String

showList :: [RecreateDisksInfo] -> ShowS

JSON RecreateDisksInfo # 
Instance details

Defined in Ganeti.OpParams

Methods

readJSON :: JSValue -> Result RecreateDisksInfo

showJSON :: RecreateDisksInfo -> JSValue

readJSONs :: JSValue -> Result [RecreateDisksInfo]

showJSONs :: [RecreateDisksInfo] -> JSValue

PyValue RecreateDisksInfo # 
Instance details

Defined in Ganeti.OpCodes

Arbitrary RecreateDisksInfo 
Instance details

Defined in Test.Ganeti.OpCodes

data DdmOldChanges Source #

Simple type for old-style ddm changes.

Instances

Instances details
Eq DdmOldChanges # 
Instance details

Defined in Ganeti.OpParams

Ord DdmOldChanges # 
Instance details

Defined in Ganeti.OpParams

Show DdmOldChanges # 
Instance details

Defined in Ganeti.OpParams

Methods

showsPrec :: Int -> DdmOldChanges -> ShowS

show :: DdmOldChanges -> String

showList :: [DdmOldChanges] -> ShowS

JSON DdmOldChanges # 
Instance details

Defined in Ganeti.OpParams

Methods

readJSON :: JSValue -> Result DdmOldChanges

showJSON :: DdmOldChanges -> JSValue

readJSONs :: JSValue -> Result [DdmOldChanges]

showJSONs :: [DdmOldChanges] -> JSValue

Arbitrary DdmOldChanges 
Instance details

Defined in Test.Ganeti.OpCodes

data SetParamsMods a Source #

Instance disk or nic modifications.

Instances

Instances details
Eq a => Eq (SetParamsMods a) # 
Instance details

Defined in Ganeti.OpParams

Methods

(==) :: SetParamsMods a -> SetParamsMods a -> Bool

(/=) :: SetParamsMods a -> SetParamsMods a -> Bool

Ord a => Ord (SetParamsMods a) # 
Instance details

Defined in Ganeti.OpParams

Show a => Show (SetParamsMods a) # 
Instance details

Defined in Ganeti.OpParams

Methods

showsPrec :: Int -> SetParamsMods a -> ShowS

show :: SetParamsMods a -> String

showList :: [SetParamsMods a] -> ShowS

JSON a => JSON (SetParamsMods a) # 
Instance details

Defined in Ganeti.OpParams

Methods

readJSON :: JSValue -> Result (SetParamsMods a)

showJSON :: SetParamsMods a -> JSValue

readJSONs :: JSValue -> Result [SetParamsMods a]

showJSONs :: [SetParamsMods a] -> JSValue

PyValue a => PyValue (SetParamsMods a) # 
Instance details

Defined in Ganeti.OpCodes

Methods

showValue :: SetParamsMods a -> String Source #

showValueList :: [SetParamsMods a] -> String Source #

Arbitrary a => Arbitrary (SetParamsMods a) 
Instance details

Defined in Test.Ganeti.OpCodes

readSetParams :: JSON a => JSValue -> Result (SetParamsMods a) Source #

Custom deserialiser for SetParamsMods.

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

Instances details
Eq ExportTarget # 
Instance details

Defined in Ganeti.OpParams

Methods

(==) :: ExportTarget -> ExportTarget -> Bool

(/=) :: ExportTarget -> ExportTarget -> Bool

Ord ExportTarget # 
Instance details

Defined in Ganeti.OpParams

Show ExportTarget # 
Instance details

Defined in Ganeti.OpParams

Methods

showsPrec :: Int -> ExportTarget -> ShowS

show :: ExportTarget -> String

showList :: [ExportTarget] -> ShowS

JSON ExportTarget # 
Instance details

Defined in Ganeti.OpParams

Methods

readJSON :: JSValue -> Result ExportTarget

showJSON :: ExportTarget -> JSValue

readJSONs :: JSValue -> Result [ExportTarget]

showJSONs :: [ExportTarget] -> JSValue

Arbitrary ExportTarget 
Instance details

Defined in Test.Ganeti.OpCodes

readExportTarget :: JSValue -> Result ExportTarget Source #

Custom reader for ExportTarget.

Common opcode parameters

Parameters

pHotplug :: Field Source #

Whether to hotplug device.

pClusterFileStorageDir :: Field Source #

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

pClusterSharedFileStorageDir :: Field Source #

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

pClusterGlusterStorageDir :: Field Source #

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

pZeroingImage :: Field Source #

The OS to use when zeroing instance disks.

pCompressionTools :: Field Source #

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

pVgName :: Field Source #

Volume group name.

pModifyEtcHosts :: Field Source #

Whether to modify and keep in sync the etchosts files of nodes.

pPreallocWipeDisks :: Field Source #

Whether to wipe disks before allocating them to instances.

pShutdownTimeout' :: Field Source #

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