diff --git a/htools/Ganeti/HTools/ExtLoader.hs b/htools/Ganeti/HTools/ExtLoader.hs index 3374de6c92990ae6e67566b88c5b4402033dd363..0db8956c5a01f63bfe170f4ff2656c1e8ca0b8db 100644 --- a/htools/Ganeti/HTools/ExtLoader.hs +++ b/htools/Ganeti/HTools/ExtLoader.hs @@ -85,6 +85,7 @@ loadExternalData opts = do exTags = case optExTags opts of Nothing -> [] Just etl -> map (++ ":") etl + selInsts = optSelInst opts exInsts = optExInst opts when (length allSet > 1) $ @@ -111,7 +112,7 @@ loadExternalData opts = do | setFile -> wrapIO $ Text.loadData $ fromJust tfile | otherwise -> return $ Bad "No backend selected! Exiting." - let ldresult = input_data >>= mergeData util_data' exTags exInsts + let ldresult = input_data >>= mergeData util_data' exTags selInsts exInsts cdata <- (case ldresult of Ok x -> return x diff --git a/htools/Ganeti/HTools/IAlloc.hs b/htools/Ganeti/HTools/IAlloc.hs index f06d984a0d4ae753013a8d19dab22d7fabd25da9..f224f118874da5d59ad0513446637f18e7cc21fe 100644 --- a/htools/Ganeti/HTools/IAlloc.hs +++ b/htools/Ganeti/HTools/IAlloc.hs @@ -148,7 +148,7 @@ parseData body = do let (kti, il) = assignIndices iobj -- cluster tags ctags <- extrObj "cluster_tags" - cdata <- mergeData [] [] [] (ClusterData gl nl il ctags) + cdata <- mergeData [] [] [] [] (ClusterData gl nl il ctags) let map_n = cdNodes cdata map_i = cdInstances cdata map_g = cdGroups cdata diff --git a/htools/Ganeti/HTools/Loader.hs b/htools/Ganeti/HTools/Loader.hs index b53d79ced16e73912f5c98046f4ddf8b952c7b14..427287043cc7719ceb2db42bb261c16b32fe30a1 100644 --- a/htools/Ganeti/HTools/Loader.hs +++ b/htools/Ganeti/HTools/Loader.hs @@ -190,10 +190,11 @@ commonSuffix nl il = -- list and massages it into the correct format. mergeData :: [(String, DynUtil)] -- ^ Instance utilisation data -> [String] -- ^ Exclusion tags - -> [String] -- ^ Untouchable instances + -> [String] -- ^ Selected instances (if not empty) + -> [String] -- ^ Excluded instances -> ClusterData -- ^ Data from backends -> Result ClusterData -- ^ Fixed cluster data -mergeData um extags exinsts cdata@(ClusterData _ nl il2 tags) = +mergeData um extags selinsts exinsts cdata@(ClusterData _ nl il2 tags) = let il = Container.elems il2 il3 = foldl' (\im (name, n_util) -> case Container.findByName im name of diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs index 66cf22936af64d28137d06d07678ceeab4161dae..9b130bcebd057cd05e0a5ee0910a75d62a5cade1 100644 --- a/htools/Ganeti/HTools/QC.hs +++ b/htools/Ganeti/HTools/QC.hs @@ -906,7 +906,7 @@ prop_Loader_assignIndices nodes = -- is zero prop_Loader_mergeData ns = let na = Container.fromList $ map (\n -> (Node.idx n, n)) ns - in case Loader.mergeData [] [] [] + in case Loader.mergeData [] [] [] [] (Loader.emptyCluster {Loader.cdNodes = na}) of Types.Bad _ -> False Types.Ok (Loader.ClusterData _ nl il _) -> diff --git a/htools/hscan.hs b/htools/hscan.hs index 07ab65757e2f3c0c488e15954841911b2f3288ce..e057972d3749e6d548dccd98bfef4ee513a83331 100644 --- a/htools/hscan.hs +++ b/htools/hscan.hs @@ -87,7 +87,7 @@ fixSlash = map (\x -> if x == '/' then '_' else x) -- | Generates serialized data from loader input. processData :: ClusterData -> Result ClusterData processData input_data = do - cdata@(ClusterData _ nl il _) <- mergeData [] [] [] input_data + cdata@(ClusterData _ nl il _) <- mergeData [] [] [] [] input_data let (_, fix_nl) = checkData nl il return cdata { cdNodes = fix_nl }