From c0e31451c263a373dedbcbff6d0a94aea1b6d353 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 21 Dec 2010 11:37:50 +0100 Subject: [PATCH] Convert Text.serializeCluster to ClusterData Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Balazs Lecz <leczb@google.com> --- Ganeti/HTools/Loader.hs | 2 +- Ganeti/HTools/Text.hs | 5 ++--- hbal.hs | 2 +- hscan.hs | 4 ++-- hspace.hs | 5 +++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Ganeti/HTools/Loader.hs b/Ganeti/HTools/Loader.hs index 42092c2ce..887a693ba 100644 --- a/Ganeti/HTools/Loader.hs +++ b/Ganeti/HTools/Loader.hs @@ -184,7 +184,7 @@ mergeData :: [(String, DynUtil)] -- ^ Instance utilisation data -> [String] -- ^ Exclusion tags -> [String] -- ^ Untouchable instances -> ClusterData -- ^ Data from backends - -> Result ClusterData + -> Result ClusterData -- ^ Fixed cluster data mergeData um extags exinsts cdata@(ClusterData _ nl il2 tags) = let il = Container.elems il2 il3 = foldl' (\im (name, n_util) -> diff --git a/Ganeti/HTools/Text.hs b/Ganeti/HTools/Text.hs index 11ce84f68..1f446ac89 100644 --- a/Ganeti/HTools/Text.hs +++ b/Ganeti/HTools/Text.hs @@ -97,9 +97,8 @@ serializeInstances nl = unlines . map (serializeInstance nl) . Container.elems -- | Generate complete cluster data from node and instance lists -serializeCluster :: Group.List -> Node.List -> Instance.List -> [String] - -> String -serializeCluster gl nl il ctags = +serializeCluster :: ClusterData -> String +serializeCluster (ClusterData gl nl il ctags) = let gdata = serializeGroups gl ndata = serializeNodes gl nl idata = serializeInstances nl il diff --git a/hbal.hs b/hbal.hs index 7db7b601f..ddbb6bcd9 100644 --- a/hbal.hs +++ b/hbal.hs @@ -400,7 +400,7 @@ main = do when (isJust $ optSaveCluster opts) $ do let out_path = fromJust $ optSaveCluster opts - adata = serializeCluster gl fin_nl fin_il ctags + adata = serializeCluster (ClusterData gl fin_nl fin_il ctags) writeFile out_path adata printf "The cluster state has been written to file '%s'\n" out_path diff --git a/hscan.hs b/hscan.hs index ccea18812..631c06157 100644 --- a/hscan.hs +++ b/hscan.hs @@ -93,9 +93,9 @@ fixSlash = map (\x -> if x == '/' then '_' else x) processData :: Result ClusterData -> Result (Group.List, Node.List, Instance.List, String) processData input_data = do - (ClusterData gl nl il ctags) <- input_data >>= mergeData [] [] [] + cdata@(ClusterData gl nl il _) <- input_data >>= mergeData [] [] [] let (_, fix_nl) = checkData nl il - adata = serializeCluster gl nl il ctags + adata = serializeCluster cdata return (gl, fix_nl, il, adata) -- | Writes cluster data out diff --git a/hspace.hs b/hspace.hs index 434a77c5a..76c454ef8 100644 --- a/hspace.hs +++ b/hspace.hs @@ -305,7 +305,8 @@ main = do when (isJust $ optSaveCluster opts) $ do let out_path = (fromJust $ optSaveCluster opts) <.> "tiered" - adata = serializeCluster gl trl_nl trl_il ctags + adata = serializeCluster + (ClusterData gl trl_nl trl_il ctags) writeFile out_path adata hPrintf stderr "The cluster state after tiered allocation\ \ has been written to file '%s'\n" @@ -339,7 +340,7 @@ main = do when (isJust $ optSaveCluster opts) $ do let out_path = (fromJust $ optSaveCluster opts) <.> "alloc" - adata = serializeCluster gl fin_nl fin_il ctags + adata = serializeCluster (ClusterData gl fin_nl fin_il ctags) writeFile out_path adata hPrintf stderr "The cluster state after standard allocation\ \ has been written to file '%s'\n" -- GitLab