ganeti

Safe HaskellNone

Ganeti.Types

Contents

Description

Some common Ganeti types.

This holds types common to both core work, and to htools. Types that are very core specific (e.g. configuration objects) should go in Objects, while types that are specific to htools in-memory representation should go into Types.

Synopsis

Generic types

newtype NonNegative a Source

Type that holds a non-negative value.

Constructors

NonNegative 

Fields

fromNonNegative :: a
 

Instances

Eq a => Eq (NonNegative a) 
Show a => Show (NonNegative a) 
(Arbitrary a, Ord a, Num a, Show a) => Arbitrary (NonNegative a) 
(JSON a, Num a, Ord a, Show a) => JSON (NonNegative a) 
PyValue a => PyValue (NonNegative a) 

mkNonNegative :: (Monad m, Num a, Ord a, Show a) => a -> m (NonNegative a)Source

Smart constructor for NonNegative.

newtype Positive a Source

Type that holds a positive value.

Constructors

Positive 

Fields

fromPositive :: a
 

Instances

Eq a => Eq (Positive a) 
Show a => Show (Positive a) 
(Arbitrary a, Ord a, Num a, Show a) => Arbitrary (Positive a) 
(JSON a, Num a, Ord a, Show a) => JSON (Positive a) 

mkPositive :: (Monad m, Num a, Ord a, Show a) => a -> m (Positive a)Source

Smart constructor for Positive.

newtype Negative a Source

Type that holds a negative value.

Constructors

Negative 

Fields

fromNegative :: a
 

Instances

Eq a => Eq (Negative a) 
Show a => Show (Negative a) 
(Arbitrary a, Ord a, Num a, Show a) => Arbitrary (Negative a) 
(JSON a, Num a, Ord a, Show a) => JSON (Negative a) 

mkNegative :: (Monad m, Num a, Ord a, Show a) => a -> m (Negative a)Source

Smart constructor for Negative.

newtype NonEmpty a Source

Type that holds a non-null list.

Constructors

NonEmpty 

Fields

fromNonEmpty :: [a]
 

Instances

Eq a => Eq (NonEmpty a) 
(Eq a, Ord a) => Ord (NonEmpty a) 
Show a => Show (NonEmpty a) 
Arbitrary a => Arbitrary (NonEmpty a) 
JSON a => JSON (NonEmpty a) 
PyValue a => PyValue (NonEmpty a) 

mkNonEmpty :: Monad m => [a] -> m (NonEmpty a)Source

Smart constructor for NonEmpty.

type NonEmptyString = NonEmpty CharSource

A simple type alias for non-empty strings.

newtype IPv4Address Source

Constructors

IPv4Address 

Fields

fromIPv4Address :: String
 

Instances

mkIPv4Address :: Monad m => String -> m IPv4AddressSource

newtype IPv4Network Source

Constructors

IPv4Network 

Fields

fromIPv4Network :: String
 

Instances

mkIPv4Network :: Monad m => String -> m IPv4NetworkSource

newtype IPv6Address Source

Constructors

IPv6Address 

Fields

fromIPv6Address :: String
 

Instances

mkIPv6Address :: Monad m => String -> m IPv6AddressSource

newtype IPv6Network Source

Constructors

IPv6Network 

Fields

fromIPv6Network :: String
 

Instances

mkIPv6Network :: Monad m => String -> m IPv6NetworkSource

Ganeti types

data DiskTemplate Source

Instance disk template type.

Instances

Bounded DiskTemplate 
Enum DiskTemplate 
Eq DiskTemplate 
Ord DiskTemplate 
Show DiskTemplate 
Arbitrary DiskTemplate

Custom Arbitrary instance for DiskTemplate, which needs to handle the case of file storage being disabled at configure time.

JSON DiskTemplate 
HasStringRepr DiskTemplate 
PyValue DiskTemplate 

diskTemplateFromRaw :: forall m. Monad m => String -> m DiskTemplateSource

data TagKind Source

Data type representing what items the tag operations apply to.

Instances

Bounded TagKind 
Enum TagKind 
Eq TagKind 
Ord TagKind 
Show TagKind 
Arbitrary TagKind 
JSON TagKind 

tagKindFromRaw :: forall m. Monad m => String -> m TagKindSource

data AllocPolicy Source

The Group allocation policy type.

Note that the order of constructors is important as the automatic Ord instance will order them in the order they are defined, so when changing this data type be careful about the interaction with the desired sorting order.

Instances

Bounded AllocPolicy 
Enum AllocPolicy 
Eq AllocPolicy 
Ord AllocPolicy 
Show AllocPolicy 
Arbitrary AllocPolicy 
JSON AllocPolicy 

allocPolicyFromRaw :: forall m. Monad m => String -> m AllocPolicySource

data InstanceStatus Source

The Instance real state type. FIXME: this could be improved to just wrap a NormalState AdminStatus | ErrorState ErrorCondition.

instanceStatusFromRaw :: forall m. Monad m => String -> m InstanceStatusSource

data MigrationMode Source

Migration mode.

Instances

migrationModeFromRaw :: forall m. Monad m => String -> m MigrationModeSource

verifyOptionalChecksFromRaw :: forall m. Monad m => String -> m VerifyOptionalChecksSource

cVErrorCodeFromRaw :: forall m. Monad m => String -> m CVErrorCodeSource

data DdmSimple Source

Dynamic device modification, just add/remove version.

Instances

Bounded DdmSimple 
Enum DdmSimple 
Eq DdmSimple 
Ord DdmSimple 
Show DdmSimple 
Arbitrary DdmSimple 
JSON DdmSimple 

ddmSimpleFromRaw :: forall m. Monad m => String -> m DdmSimpleSource

data DdmFull Source

Dynamic device modification, all operations version.

TODO: DDM_SWAP, DDM_MOVE?

Instances

Bounded DdmFull 
Enum DdmFull 
Eq DdmFull 
Ord DdmFull 
Show DdmFull 
Arbitrary DdmFull 
JSON DdmFull 

ddmFullFromRaw :: forall m. Monad m => String -> m DdmFullSource

data Hypervisor Source

Hypervisor type definitions.

Constructors

Kvm 
XenPvm 
Chroot 
XenHvm 
Lxc 
Fake 

Instances

hypervisorFromRaw :: forall m. Monad m => String -> m HypervisorSource

data OobCommand Source

Oob command type.

Instances

Bounded OobCommand 
Enum OobCommand 
Eq OobCommand 
Ord OobCommand 
Show OobCommand 
Arbitrary OobCommand 
JSON OobCommand 

oobCommandFromRaw :: forall m. Monad m => String -> m OobCommandSource

data OobStatus Source

Oob command status

Instances

Bounded OobStatus 
Enum OobStatus 
Eq OobStatus 
Ord OobStatus 
Show OobStatus 
JSON OobStatus 

oobStatusFromRaw :: forall m. Monad m => String -> m OobStatusSource

data StorageType Source

Storage type.

Instances

Bounded StorageType 
Enum StorageType 
Eq StorageType 
Ord StorageType 
Show StorageType 
Arbitrary StorageType

Custom Arbitrary instance for StorageType, which needs to handle the case of file storage being disabled at configure time.

JSON StorageType 

storageTypeFromRaw :: forall m. Monad m => String -> m StorageTypeSource

type StorageKey = StringSource

Storage keys are identifiers for storage units. Their content varies depending on the storage type, for example a storage key for LVM storage is the volume group name.

data StorageUnitRaw Source

Storage units without storage-type-specific parameters

diskTemplateToStorageType :: DiskTemplate -> StorageTypeSource

Mapping from disk templates to storage types FIXME: This is semantically the same as the constant C.diskTemplatesStorageType, remove this when python constants are generated from haskell constants

addParamsToStorageUnit :: SPExclusiveStorage -> StorageUnitRaw -> StorageUnitSource

Equips a raw storage unit with its parameters

data EvacMode Source

Node evac modes.

This is part of the IAllocator interface and it is used, for example, in RqType. However, it must reside in this module, and not in Types, because it is also used by Constants.

Instances

Bounded EvacMode 
Enum EvacMode 
Eq EvacMode 
Ord EvacMode 
Show EvacMode 
Arbitrary EvacMode 
JSON EvacMode 

evacModeFromRaw :: forall m. Monad m => String -> m EvacModeSource

data FileDriver Source

The file driver type.

Instances

Bounded FileDriver 
Enum FileDriver 
Eq FileDriver 
Ord FileDriver 
Show FileDriver 
Arbitrary FileDriver 
JSON FileDriver 

fileDriverFromRaw :: forall m. Monad m => String -> m FileDriverSource

data InstCreateMode Source

The instance create mode.

instCreateModeFromRaw :: forall m. Monad m => String -> m InstCreateModeSource

data RebootType Source

Reboot type.

Instances

Bounded RebootType 
Enum RebootType 
Eq RebootType 
Ord RebootType 
Show RebootType 
Arbitrary RebootType 
JSON RebootType 

rebootTypeFromRaw :: forall m. Monad m => String -> m RebootTypeSource

data ExportMode Source

Export modes.

Instances

exportModeFromRaw :: forall m. Monad m => String -> m ExportModeSource

data IAllocatorTestDir Source

IAllocator run types (OpTestIAllocator).

iAllocatorTestDirFromRaw :: forall m. Monad m => String -> m IAllocatorTestDirSource

iAllocatorModeFromRaw :: forall m. Monad m => String -> m IAllocatorModeSource

data NICMode Source

Network mode.

Constructors

NMBridged 
NMRouted 
NMOvs 
NMPool 

Instances

Bounded NICMode 
Enum NICMode 
Eq NICMode 
Ord NICMode 
Show NICMode 
Arbitrary NICMode 
JSON NICMode 

nICModeFromRaw :: forall m. Monad m => String -> m NICModeSource

data JobStatus Source

The JobStatus data type. Note that this is ordered especially such that greater/lesser comparison on values of this type makes sense.

Instances

Bounded JobStatus 
Enum JobStatus 
Eq JobStatus 
Ord JobStatus 
Show JobStatus 
Arbitrary JobStatus 
JSON JobStatus 

jobStatusFromRaw :: forall m. Monad m => String -> m JobStatusSource

finalizedJobStatusFromRaw :: forall m. Monad m => String -> m FinalizedJobStatusSource

newtype JobId Source

The Ganeti job type.

Constructors

JobId 

Fields

fromJobId :: Int
 

Instances

Eq JobId 
Show JobId 
Arbitrary JobId 
JSON JobId 

makeJobId :: Monad m => Int -> m JobIdSource

Builds a job ID.

makeJobIdS :: Monad m => String -> m JobIdSource

Builds a job ID from a string.

parseJobId :: Monad m => JSValue -> m JobIdSource

type RelativeJobId = Negative IntSource

Relative job ID type alias.

data JobIdDep Source

Job ID dependency.

Instances

Eq JobIdDep 
Show JobIdDep 
Arbitrary JobIdDep 
JSON JobIdDep 

data JobDependency Source

Job Dependency type.

Instances

data OpSubmitPriority Source

Valid opcode priorities for submit.

opSubmitPriorityFromRaw :: forall m. Monad m => Int -> m OpSubmitPrioritySource

parseSubmitPriority :: Monad m => String -> m OpSubmitPrioritySource

Parse submit priorities from a string.

fmtSubmitPriority :: OpSubmitPriority -> StringSource

Format a submit priority as string.

data OpStatus Source

Our ADT for the OpCode status at runtime (while in a job).

Instances

Bounded OpStatus 
Enum OpStatus 
Eq OpStatus 
Ord OpStatus 
Show OpStatus 
Arbitrary OpStatus 
JSON OpStatus 

opStatusFromRaw :: forall m. Monad m => String -> m OpStatusSource

data ELogType Source

Type for the job message type.

Instances

Bounded ELogType 
Enum ELogType 
Eq ELogType 
Ord ELogType 
Show ELogType 
Arbitrary ELogType 
JSON ELogType 

eLogTypeFromRaw :: forall m. Monad m => String -> m ELogTypeSource

type ReasonElem = (String, String, Integer)Source

Type of one element of a reason trail.

type ReasonTrail = [ReasonElem]Source

Type representing a reason trail.

data VType Source

The VTYPES, a mini-type system in Python.

Instances

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

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

vTypeToRaw :: VType -> StringSource

Node role type

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.

Disk types

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

Instance types

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

Storage field type

storageFieldFromRaw :: forall m. Monad m => String -> m StorageFieldSource

Disk access protocol

diskAccessModeFromRaw :: forall m. Monad m => String -> m DiskAccessModeSource

data LocalDiskStatus Source

Local disk status

Python code depends on: DiskStatusOk < DiskStatusUnknown < DiskStatusFaulty

localDiskStatusFromRaw :: forall m. Monad m => Int -> m LocalDiskStatusSource

replaceDisksModeFromRaw :: forall m. Monad m => String -> m ReplaceDisksModeSource

data RpcTimeout Source

Basic timeouts for RPC calls.

Constructors

Urgent 
Fast 
Normal 
Slow 
FourHours 
OneDay 

Instances

Bounded RpcTimeout 
Enum RpcTimeout 
Eq RpcTimeout 
Ord RpcTimeout 
Show RpcTimeout 

rpcTimeoutFromRaw :: forall m. Monad m => Int -> m RpcTimeoutSource

data HotplugAction Source

Hotplug action.

Constructors

HAAdd 
HARemove 
HAMod 

hotplugActionFromRaw :: forall m. Monad m => String -> m HotplugActionSource

data HotplugTarget Source

Hotplug Device Target.

Constructors

HTDisk 
HTNic 

hotplugTargetFromRaw :: forall m. Monad m => String -> m HotplugTargetSource