From 9cf4267acb5ea5f94097bb68c5eac785a6b6bf95 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 27 May 2009 22:50:22 +0100 Subject: [PATCH] Finish removal of unused params from PeerMap This completes the removal started earlier byt removeing the need to pass the number of nodes to Node.buildPeers, which is now unused. --- Ganeti/HTools/Loader.hs | 2 +- Ganeti/HTools/Node.hs | 4 ++-- Ganeti/HTools/QC.hs | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Ganeti/HTools/Loader.hs b/Ganeti/HTools/Loader.hs index 03a1ac4bf..2d39cb801 100644 --- a/Ganeti/HTools/Loader.hs +++ b/Ganeti/HTools/Loader.hs @@ -96,7 +96,7 @@ mergeData (nl, il) = do nl2 = fixNodes nl il il3 = Container.fromAssocList il nl3 = Container.fromAssocList - (map (\ (k, v) -> (k, Node.buildPeers v il3 (length nl2))) nl2) + (map (\ (k, v) -> (k, Node.buildPeers v il3)) nl2) node_names = map Node.name $ Container.elems nl3 inst_names = map Instance.name $ Container.elems il3 common_suffix = longestDomain (node_names ++ inst_names) diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs index 05930cdf3..76052d858 100644 --- a/Ganeti/HTools/Node.hs +++ b/Ganeti/HTools/Node.hs @@ -148,8 +148,8 @@ computeMaxRes :: PeerMap.PeerMap -> PeerMap.Elem computeMaxRes new_peers = PeerMap.maxElem new_peers -- | Builds the peer map for a given node. -buildPeers :: Node -> Instance.List -> Int -> Node -buildPeers t il num_nodes = +buildPeers :: Node -> Instance.List -> Node +buildPeers t il = let mdata = map (\i_idx -> let inst = Container.find i_idx il in (Instance.pnode inst, Instance.mem inst)) diff --git a/Ganeti/HTools/QC.hs b/Ganeti/HTools/QC.hs index c861358f5..9909b95d4 100644 --- a/Ganeti/HTools/QC.hs +++ b/Ganeti/HTools/QC.hs @@ -41,10 +41,9 @@ instance Arbitrary Node.Node where dsk_t <- arbitrary dsk_f <- choose (0, dsk_t) offl <- arbitrary - npeers <- choose (0, 100) let n = Node.create name (fromIntegral mem_t) mem_n mem_f (fromIntegral dsk_t) dsk_f offl - n' = Node.buildPeers n Container.empty npeers + n' = Node.buildPeers n Container.empty return n' -- | Make sure add is idempotent -- GitLab