....based on the migration tags the respective nodes have.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 src/Ganeti/HTools/Node.hs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/Ganeti/HTools/Node.hs b/src/Ganeti/HTools/Node.hs
index 1e87980..f2a9701 100644
--- a/src/Ganeti/HTools/Node.hs
+++ b/src/Ganeti/HTools/Node.hs
@@ -70,6 +70,7 @@ module Ganeti.HTools.Node
   , addPriEx
   , addSec
   , addSecEx
+  , checkMigration
   -- * Stats
   , availDisk
   , availMem
@@ -645,6 +646,13 @@ addSecEx force t inst pdx =
                      }
            in Ok r
 
+-- | Predicate on whether migration is supported between two nodes.
+checkMigration :: Node -> Node -> T.OpResult ()
+checkMigration nsrc ntarget =
+  if migTags nsrc `Set.isSubsetOf` rmigTags ntarget
+    then Ok ()
+    else Bad T.FailMig
+
 -- * Stats functions
 
 -- | Computes the amount of available disk on a given node.
-- 
2.1.0.rc2.206.gedb03e5

Reply via email to