+-- | Check if instance is down.
+instanceDown :: Instance -> Bool
+instanceDown inst | isRunning inst = False
+instanceDown inst | isOffline inst = False
+instanceDown _ = True
+
+-- | Apply the function if the instance is online. Otherwise use
+-- the initial value
+applyIfOnline :: Instance -> (a -> a) -> a -> a
+applyIfOnline = applyIf . notOffline
+
+-- | Helper for determining whether an instance's memory needs to be
+-- taken into account for secondary memory reservation.
+usesSecMem :: Instance -> Bool
+usesSecMem inst = notOffline inst && autoBalance inst
+
+-- | Constant holding the local storage templates.
+--
+-- /Note:/ Currently Ganeti only exports node total/free disk space
+-- for LVM-based storage; file-based storage is ignored in this model,
+-- so even though file-based storage uses in reality disk space on the
+-- node, in our model it won't affect it and we can't compute whether
+-- there is enough disk space for a file-based instance. Therefore we
+-- will treat this template as \'foreign\' storage.
+localStorageTemplates :: [T.DiskTemplate]
+localStorageTemplates = [ T.DTDrbd8, T.DTPlain ]
+
+-- | Constant holding the movable disk templates.
+--
+-- This only determines the initial 'movable' state of the
+-- instance. Further the movable state can be restricted more due to
+-- user choices, etc.
+movableDiskTemplates :: [T.DiskTemplate]
+movableDiskTemplates =
+ [ T.DTDrbd8
+ , T.DTBlock
+ , T.DTSharedFile
+ , T.DTRbd
+ ]