ganeti

Safe HaskellNone

Ganeti.Objects

Contents

Description

Implementation of the Ganeti config objects.

Some object fields are not implemented yet, and as such they are commented out below.

Synopsis

Generic definitions

fillDict :: Ord k => Map k v -> Map k v -> [k] -> Map k vSource

Fills one map with keys from the other map, if not already existing. Mirrors objects.py:FillDict.

data VType Source

The VTYPES, a mini-type system in Python.

Instances

Bounded VType 
Enum VType 
Eq VType 
Ord VType 
Show VType 
JSON VType 

vTypeFromRaw :: forall m. Monad m => String -> m VTypeSource

vTypeToRaw :: VType -> StringSource

type HvParams = Container JSValueSource

The hypervisor parameter type. This is currently a simple map, without type checking on key/value pairs.

type OsParams = Container StringSource

The OS parameters type. This is, and will remain, a string container, since the keys are dynamically declared by the OSes, and the values are always strings.

class TimeStampObject a whereSource

Class of objects that have timestamps.

Methods

cTimeOf :: a -> DoubleSource

mTimeOf :: a -> DoubleSource

class UuidObject a whereSource

Class of objects that have an UUID.

Methods

uuidOf :: a -> StringSource

class TagsObject a whereSource

Class of objects that have tags.

Methods

tagsOf :: a -> Set StringSource

Node role object

data NodeRole Source

Instances

Bounded NodeRole 
Enum NodeRole 
Eq NodeRole 
Ord NodeRole 
Show NodeRole 
JSON NodeRole 

nodeRoleFromRaw :: forall m. Monad m => String -> m NodeRoleSource

roleDescription :: NodeRole -> StringSource

The description of the node role.

Network definitions

data Network Source

Constructors

Network 

Fields

networkName :: NonEmptyString
 
networkMacPrefix :: Maybe String
 
networkNetwork :: NonEmptyString
 
networkNetwork6 :: Maybe String
 
networkGateway :: Maybe String
 
networkGateway6 :: Maybe String
 
networkReservations :: Maybe String
 
networkExtReservations :: Maybe String
 
networkCtime :: Double
 
networkMtime :: Double
 
networkSerial :: Int
 
networkTags :: TagSet
 

loadNetwork :: JSValue -> Result NetworkSource

toDictNetwork :: Network -> [(String, JSValue)]Source

NIC definitions

data PartialNicParams Source

Constructors

PartialNicParams 

Fields

nicpModeP :: Maybe NICMode
 
nicpLinkP :: Maybe String
 

data PartialNic Source

Constructors

PartialNic 

Fields

nicMac :: String
 
nicIp :: Maybe String
 
nicNicparams :: PartialNicParams
 
nicNetwork :: Maybe String
 

Instances

Eq PartialNic 
Show PartialNic 
Arbitrary PartialNic 
JSON PartialNic 

loadPartialNic :: JSValue -> Result PartialNicSource

toDictPartialNic :: PartialNic -> [(String, JSValue)]Source

Disk definitions

data DiskMode Source

Constructors

DiskRdOnly 
DiskRdWr 

Instances

Bounded DiskMode 
Enum DiskMode 
Eq DiskMode 
Ord DiskMode 
Show DiskMode 
Arbitrary DiskMode 
JSON DiskMode 

diskModeFromRaw :: forall m. Monad m => String -> m DiskModeSource

data DiskType Source

Instances

Bounded DiskType 
Enum DiskType 
Eq DiskType 
Ord DiskType 
Show DiskType 
JSON DiskType 

diskTypeFromRaw :: forall m. Monad m => String -> m DiskTypeSource

data BlockDriver Source

The persistent block driver type. Currently only one type is allowed.

Constructors

BlockDrvManual 

Instances

Bounded BlockDriver 
Enum BlockDriver 
Eq BlockDriver 
Ord BlockDriver 
Show BlockDriver 
Arbitrary BlockDriver 
JSON BlockDriver 

blockDriverFromRaw :: forall m. Monad m => String -> m BlockDriverSource

devType :: StringSource

data DiskLogicalId Source

The disk configuration type. This includes the disk type itself, for a more complete consistency. Note that since in the Python code-base there's no authoritative place where we document the logical id, this is probably a good reference point.

Constructors

LIDPlain String String

Volume group, logical volume

LIDDrbd8 String String Int Int Int String

NodeA, NodeB, Port, MinorA, MinorB, Secret

LIDFile FileDriver String

Driver, path

LIDBlockDev BlockDriver String

Driver, path (must be under /dev)

LIDRados String String

Unused, path

LIDExt String String

ExtProvider, unique name

Instances

lidEncodeType :: DiskLogicalId -> [(String, JSValue)]Source

encodeFullDLId :: DiskLogicalId -> (JSValue, [(String, JSValue)])Source

decodeDLId :: [(String, JSValue)] -> JSValue -> Result DiskLogicalIdSource

data Disk Source

Disk data structure.

This is declared manually as it's a recursive structure, and our TH code currently can't build it.

Constructors

Disk 

Instances

Eq Disk 
Show Disk 
Arbitrary Disk

Disk arbitrary instance. Since we don't test disk hierarchy properties, we only generate disks with no children (FIXME), as generating recursive datastructures is a bit more work.

JSON Disk 

loadDisk :: JSValue -> Result DiskSource

saveDisk :: Disk -> JSValueSource

toDictDisk :: Disk -> [(String, JSValue)]Source

Instance definitions

data AdminState Source

Instances

Bounded AdminState 
Enum AdminState 
Eq AdminState 
Ord AdminState 
Show AdminState 
Arbitrary AdminState 
JSON AdminState 

adminStateFromRaw :: forall m. Monad m => String -> m AdminStateSource

data FilledBeParams Source

Constructors

FilledBeParams 

Fields

bepMinmem :: Int
 
bepMaxmem :: Int
 
bepVcpus :: Int
 
bepAutoBalance :: Bool
 

data PartialBeParams Source

Constructors

PartialBeParams 

Fields

bepMinmemP :: Maybe Int
 
bepMaxmemP :: Maybe Int
 
bepVcpusP :: Maybe Int
 
bepAutoBalanceP :: Maybe Bool
 

Instances

toDictFilledBeParams :: FilledBeParams -> [(String, JSValue)]Source

loadInstance :: JSValue -> Result InstanceSource

toDictInstance :: Instance -> [(String, JSValue)]Source

IPolicy definitions

data PartialISpecParams Source

Constructors

PartialISpecParams 

Fields

ispecMemorySizeP :: Maybe Int
 
ispecDiskSizeP :: Maybe Int
 
ispecDiskCountP :: Maybe Int
 
ispecCpuCountP :: Maybe Int
 
ispecNicCountP :: Maybe Int
 
ispecSpindleUseP :: Maybe Int
 

Instances

Eq PartialISpecParams 
Show PartialISpecParams 
Arbitrary PartialISpecParams

FIXME: This generates completely random data, without normal validation rules.

JSON PartialISpecParams 

data PartialIPolicy Source

Custom partial ipolicy. This is not built via buildParam since it has a special 2-level inheritance mode.

Instances

Eq PartialIPolicy 
Show PartialIPolicy 
Arbitrary PartialIPolicy

FIXME: This generates completely random data, without normal validation rules.

JSON PartialIPolicy 

toDictPartialIPolicy :: PartialIPolicy -> [(String, JSValue)]Source

data FilledIPolicy Source

Custom filled ipolicy. This is not built via buildParam since it has a special 2-level inheritance mode.

Instances

toDictFilledIPolicy :: FilledIPolicy -> [(String, JSValue)]Source

fillIPolicy :: FilledIPolicy -> PartialIPolicy -> FilledIPolicySource

Custom filler for the ipolicy types.

Node definitions

data PartialNDParams Source

Constructors

PartialNDParams 

Fields

ndpOobProgramP :: Maybe String
 
ndpSpindleCountP :: Maybe Int
 
ndpExclusiveStorageP :: Maybe Bool
 

Instances

toDictFilledNDParams :: FilledNDParams -> [(String, JSValue)]Source

data Node Source

Constructors

Node 

Fields

nodeName :: String
 
nodePrimaryIp :: String
 
nodeSecondaryIp :: String
 
nodeMasterCandidate :: Bool
 
nodeOffline :: Bool
 
nodeDrained :: Bool
 
nodeGroup :: String
 
nodeMasterCapable :: Bool
 
nodeVmCapable :: Bool
 
nodeNdparams :: PartialNDParams
 
nodePowered :: Bool
 
nodeCtime :: Double
 
nodeMtime :: Double
 
nodeUuid :: String
 
nodeSerial :: Int
 
nodeTags :: TagSet
 

loadNode :: JSValue -> Result NodeSource

saveNode :: Node -> JSValueSource

toDictNode :: Node -> [(String, JSValue)]Source

NodeGroup definitions

type DiskParams = Container (Container JSValue)Source

The disk parameters type.

loadNodeGroup :: JSValue -> Result NodeGroupSource

toDictNodeGroup :: NodeGroup -> [(String, JSValue)]Source

data IpFamily Source

IP family type

Constructors

IpFamilyV4 
IpFamilyV6 

Instances

Bounded IpFamily 
Enum IpFamily 
Eq IpFamily 
Ord IpFamily 
Show IpFamily 
Arbitrary IpFamily 
JSON IpFamily 

ipFamilyFromRaw :: forall m. Monad m => Int -> m IpFamilySource

ipFamilyToVersion :: IpFamily -> IntSource

Conversion from IP family to IP version. This is needed because Python uses both, depending on context.

type ClusterHvParams = Container HvParamsSource

Cluster HvParams (hvtype to hvparams mapping).

type OsHvParams = Container ClusterHvParamsSource

Cluster Os-HvParams (os to hvparams mapping).

type ClusterOsParams = Container OsParamsSource

Cluster OsParams.

type UidPool = [(Int, Int)]Source

Cluster definitions

loadCluster :: JSValue -> Result ClusterSource

toDictCluster :: Cluster -> [(String, JSValue)]Source

ConfigData definitions

loadConfigData :: JSValue -> Result ConfigDataSource

toDictConfigData :: ConfigData -> [(String, JSValue)]Source