From fcd731d95e082c5e18f5f89e508b1b726e668081 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 13 Jun 2011 12:01:08 +0000
Subject: [PATCH] Check that the selected instances are known

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 htools/Ganeti/HTools/Loader.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/htools/Ganeti/HTools/Loader.hs b/htools/Ganeti/HTools/Loader.hs
index 9c6badf39..7f8f551b9 100644
--- a/htools/Ganeti/HTools/Loader.hs
+++ b/htools/Ganeti/HTools/Loader.hs
@@ -221,7 +221,10 @@ mergeData um extags selinsts exinsts cdata@(ClusterData _ nl il2 tags) =
   in if not $ all (`elem` all_inst_names) exinsts
      then Bad $ "Some of the excluded instances are unknown: " ++
           show (exinsts \\ all_inst_names)
-     else Ok cdata { cdNodes = snl, cdInstances = sil }
+     else if not $ all (`elem` all_inst_names) selinsts
+          then Bad $ "Some of the selected instances are unknown: " ++
+               show (selinsts \\ all_inst_names)
+          else Ok cdata { cdNodes = snl, cdInstances = sil }
 
 -- | Checks the cluster data for consistency.
 checkData :: Node.List -> Instance.List
-- 
GitLab