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.

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 -> ClockTimeSource

mTimeOf :: a -> ClockTimeSource

class TagsObject a whereSource

Class of objects that have tags.

Methods

tagsOf :: a -> Set StringSource

Network definitions

Ipv4 types

data Ip4Address Source

Constructors

Ip4Address Word8 Word8 Word8 Word8 

Instances

Eq Ip4Address 
Ord Ip4Address 
Show Ip4Address 
IsString Ip4Address

IsString instance for Ip4Address, to help write the tests.

Arbitrary Ip4Address 
JSON Ip4Address 

mkIp4Address :: (Word8, Word8, Word8, Word8) -> Ip4AddressSource

readIp4Address :: (Applicative m, Monad m) => String -> m Ip4AddressSource

ip4AddressToNumber :: Ip4Address -> IntegerSource

Converts an address into its ordinal number. This is needed for indexing IP adresses in reservation pools.

ip4AddressFromNumber :: Integer -> Ip4AddressSource

Converts a number into an address. This is needed for indexing IP adresses in reservation pools.

data Ip4Network Source

Custom type for an IPv4 network.

Constructors

Ip4Network 

Fields

ip4netAddr :: Ip4Address
 
ip4netMask :: Word8
 

Instances

Eq Ip4Network 
Show Ip4Network 
Arbitrary Ip4Network 
JSON Ip4Network

JSON instance for Ip4Network.

Address pools

newtype AddressPool Source

Currently address pools just wrap a reservation BitArray.

In future, Network might be extended to include several address pools and address pools might include their own ranges of addresses.

Constructors

AddressPool 

Instances

Eq AddressPool 
Ord AddressPool 
Show AddressPool 
Arbitrary AddressPool 
JSON AddressPool 

Ganeti "network" config object.

loadNetwork :: JSValue -> Result NetworkSource

NIC definitions

data PartialNic Source

Constructors

PartialNic 

Fields

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

loadPartialNic :: JSValue -> Result PartialNicSource

type MicroSeconds = IntegerSource

Datacollector definitions

data DataCollectorConfig Source

The configuration regarding a single data collector.

Instances

Disk definitions

devType :: StringSource

type DRBDSecret = StringSource

An alias for DRBD secrets

data LogicalVolume Source

Constructors

LogicalVolume 

Fields

lvGroup :: String
 
lvVolume :: String
 

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 LogicalVolume

Volume group, logical volume

LIDDrbd8 String String Int Int Int (Private DRBDSecret)

NodeA, NodeB, Port, MinorA, MinorB, Secret

LIDFile FileDriver String

Driver, path

LIDSharedFile FileDriver String

Driver, path

LIDGluster 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 

Fields

diskLogicalId :: DiskLogicalId
 
diskChildren :: [Disk]
 
diskIvName :: String
 
diskSize :: Int
 
diskMode :: DiskMode
 
diskName :: Maybe String
 
diskSpindles :: Maybe Int
 
diskParams :: Maybe DiskParams
 
diskUuid :: String
 
diskSerial :: Int
 
diskCtime :: ClockTime
 
diskMtime :: ClockTime
 

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 
ArrayObject Disk 
DictObject Disk 
UuidObject Disk 

loadDisk :: JSValue -> Result DiskSource

saveDisk :: Disk -> JSValueSource

includesLogicalId :: LogicalVolume -> Disk -> BoolSource

Determines whether a disk or one of his children has the given logical id (determined by the volume group name and by the logical volume name). This can be true only for DRBD or LVM disks.

Instance definitions

data PartialBeParams Source

Constructors

PartialBeParams 

Fields

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

loadInstance :: JSValue -> Result InstanceSource

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 
ArrayObject PartialISpecParams 
DictObject 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 
ArrayObject PartialIPolicy 
DictObject PartialIPolicy 

data FilledIPolicy Source

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

fillIPolicy :: FilledIPolicy -> PartialIPolicy -> FilledIPolicySource

Custom filler for the ipolicy types.

Node definitions

data FilledNDParams Source

Constructors

FilledNDParams 

Fields

ndpOobProgram :: String
 
ndpSpindleCount :: Int
 
ndpExclusiveStorage :: Bool
 
ndpOvs :: Bool
 
ndpOvsName :: String
 
ndpOvsLink :: String
 
ndpSshPort :: Int
 
ndpCpuSpeed :: Double
 

data PartialNDParams Source

Constructors

PartialNDParams 

Fields

ndpOobProgramP :: Maybe String
 
ndpSpindleCountP :: Maybe Int
 
ndpExclusiveStorageP :: Maybe Bool
 
ndpOvsP :: Maybe Bool
 
ndpOvsNameP :: Maybe String
 
ndpOvsLinkP :: Maybe String
 
ndpSshPortP :: Maybe Int
 
ndpCpuSpeedP :: Maybe Double
 

type DiskState = Container JSValueSource

loadNode :: JSValue -> Result NodeSource

saveNode :: Node -> JSValueSource

NodeGroup definitions

type GroupDiskParams = Container DiskParamsSource

The cluster/group disk parameters type.

loadNodeGroup :: JSValue -> Result NodeGroupSource

Job scheduler filtering definitions

data FilterAction Source

Actions that can be performed when a filter matches.

Constructors

Accept 
Pause 
Reject 
Continue 
RateLimit Int 

Instances

loadFilterRule :: JSValue -> Result FilterRuleSource

filterRuleOrder :: FilterRule -> FilterRule -> OrderingSource

Order in which filter rules are evaluated, according to `doc/design-optables.rst`. For FilterRule fields not specified as important for the order, we choose an arbitrary ordering effect (after the ones from the spec).

The Ord instance for FilterRule agrees with this function. Yet it is recommended to use this function instead of compare to be explicit that the spec order is used.

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 = GenericContainer Hypervisor 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 UidRange = (Int, Int)Source

A low-high UID ranges.

type UidPool = [UidRange]Source

Cluster UID Pool, list (low, high) UID ranges.

type IAllocatorParams = Container JSValueSource

The iallocator parameters type.

Cluster definitions

data Cluster Source

Constructors

Cluster 

Fields

clusterRsahostkeypub :: String
 
clusterDsahostkeypub :: Maybe String
 
clusterHighestUsedPort :: Int
 
clusterTcpudpPortPool :: [Int]
 
clusterMacPrefix :: String
 
clusterVolumeGroupName :: Maybe String
 
clusterReservedLvs :: [String]
 
clusterDrbdUsermodeHelper :: Maybe String
 
clusterMasterNode :: String
 
clusterMasterIp :: String
 
clusterMasterNetdev :: String
 
clusterMasterNetmask :: Int
 
clusterUseExternalMipScript :: Bool
 
clusterClusterName :: String
 
clusterFileStorageDir :: String
 
clusterSharedFileStorageDir :: String
 
clusterGlusterStorageDir :: String
 
clusterEnabledHypervisors :: [Hypervisor]
 
clusterHvparams :: ClusterHvParams
 
clusterOsHvp :: OsHvParams
 
clusterBeparams :: ClusterBeParams
 
clusterOsparams :: ClusterOsParams
 
clusterOsparamsPrivateCluster :: ClusterOsParamsPrivate
 
clusterNicparams :: ClusterNicParams
 
clusterNdparams :: FilledNDParams
 
clusterDiskparams :: GroupDiskParams
 
clusterCandidatePoolSize :: Int
 
clusterModifyEtcHosts :: Bool
 
clusterModifySshSetup :: Bool
 
clusterMaintainNodeHealth :: Bool
 
clusterUidPool :: UidPool
 
clusterDefaultIallocator :: String
 
clusterDefaultIallocatorParams :: IAllocatorParams
 
clusterHiddenOs :: [String]
 
clusterBlacklistedOs :: [String]
 
clusterPrimaryIpFamily :: IpFamily
 
clusterPreallocWipeDisks :: Bool
 
clusterIpolicy :: FilledIPolicy
 
clusterHvStateStatic :: HypervisorState
 
clusterDiskStateStatic :: DiskState
 
clusterEnabledDiskTemplates :: [DiskTemplate]
 
clusterCandidateCerts :: CandidateCertificates
 
clusterMaxRunningJobs :: Int
 
clusterMaxTrackedJobs :: Int
 
clusterInstallImage :: String
 
clusterInstanceCommunicationNetwork :: String
 
clusterZeroingImage :: String
 
clusterCompressionTools :: [String]
 
clusterEnabledUserShutdown :: Bool
 
clusterDataCollectors :: Container DataCollectorConfig
 
clusterCtime :: ClockTime
 
clusterMtime :: ClockTime
 
clusterUuid :: String
 
clusterSerial :: Int
 
clusterTags :: TagSet
 

loadCluster :: JSValue -> Result ClusterSource

ConfigData definitions

loadConfigData :: JSValue -> Result ConfigDataSource

Master network parameters