On Wed, Apr 15, 2015 at 05:29:51PM +0200, 'Klaus Aehlig' via ganeti-devel wrote:
This predicate indicates whether a disk template allows
failover-to-any operations. The implementation is made
to break if the data type DiskTemplate is changed so that
it will hopefully stay up to date.
Signed-off-by: Klaus Aehlig <[email protected]>
---
src/Ganeti/Types.hs | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/Ganeti/Types.hs b/src/Ganeti/Types.hs
index 4d430cb..2313c5e 100644
--- a/src/Ganeti/Types.hs
+++ b/src/Ganeti/Types.hs
@@ -49,6 +49,7 @@ module Ganeti.Types
, DiskTemplate(..)
, diskTemplateToRaw
, diskTemplateFromRaw
+ , diskTemplateMovable
, TagKind(..)
, tagKindToRaw
, tagKindFromRaw
@@ -331,6 +332,21 @@ instance HasStringRepr DiskTemplate where
fromStringRepr = diskTemplateFromRaw
toStringRepr = diskTemplateToRaw
+-- | Predicate on disk templates indicating if instances based on this
+-- disk template can freely be moved (to any node in the node group).
+diskTemplateMovable :: DiskTemplate -> Bool
+-- Note: we deliberately do not use wildcard pattern to force an
+-- update of this function whenever a new disk template is added.
+diskTemplateMovable DTDiskless = True
+diskTemplateMovable DTFile = False
+diskTemplateMovable DTSharedFile = True
+diskTemplateMovable DTPlain = False
+diskTemplateMovable DTBlock = False
+diskTemplateMovable DTDrbd8 = False
+diskTemplateMovable DTRbd = True
+diskTemplateMovable DTExt = True
+diskTemplateMovable DTGluster = True
+
-- | Data type representing what items the tag operations apply to.
$(THH.declareLADT ''String "TagKind"
[ ("TagKindInstance", "instance")
--
2.2.0.rc0.207.ga3a616c
LGTM