Commit b906d7c1 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add a helper type and function for the mirror type



Currently we track the mirroring type as simply yes/no, with "yes"
meaning DRBD. This is not enough for handling shared storage, so we
need to add a type that gives the exact mirroring type (none,
internal, external), and a function that ties the disk template type
to the mirroring type.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 73d12eab
......@@ -58,6 +58,8 @@ module Ganeti.HTools.Types
, DiskTemplate(..)
, diskTemplateToRaw
, diskTemplateFromRaw
, MirrorType(..)
, templateMirrorType
, MoveJob
, JobSet
, Result(..)
......@@ -124,6 +126,22 @@ $(THH.declareSADT "DiskTemplate"
])
$(THH.makeJSONInstance ''DiskTemplate)
-- | Mirroring type.
data MirrorType = MirrorNone -- ^ No mirroring/movability
| MirrorInternal -- ^ DRBD-type mirroring
| MirrorExternal -- ^ Shared-storage type mirroring
deriving (Eq, Show, Read)
-- | Correspondence between disk template and mirror type.
templateMirrorType :: DiskTemplate -> MirrorType
templateMirrorType DTDiskless = MirrorExternal
templateMirrorType DTFile = MirrorNone
templateMirrorType DTSharedFile = MirrorExternal
templateMirrorType DTPlain = MirrorNone
templateMirrorType DTBlock = MirrorExternal
templateMirrorType DTDrbd8 = MirrorInternal
templateMirrorType DTRbd = MirrorExternal
-- | The Group allocation policy type.
--
-- Note that the order of constructors is important as the automatic
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment