diff --git a/Ganeti/HTools/IAlloc.hs b/Ganeti/HTools/IAlloc.hs index 0ead96fd155c5a41564d7a5d8b2da62e663a2360..674ef82543b66db1a4169c0302b2ce4678738abc 100644 --- a/Ganeti/HTools/IAlloc.hs +++ b/Ganeti/HTools/IAlloc.hs @@ -101,7 +101,7 @@ parseData body = do ridx <- lookupNode kti rname rname return $ Relocate ridx other -> fail $ ("Invalid request type '" ++ other ++ "'") - (map_n, map_i, csf) <- mergeData (ktn, nl, kti, il) + (map_n, map_i, csf) <- mergeData (nl, il) return $ Request rqtype map_n map_i csf formatResponse :: Bool -> String -> [String] -> String diff --git a/Ganeti/HTools/Loader.hs b/Ganeti/HTools/Loader.hs index b7dd606d3971d536504c461da7c5a04cc3a1d774..2245f7309196a47267683a6b76d7d2f700f52411 100644 --- a/Ganeti/HTools/Loader.hs +++ b/Ganeti/HTools/Loader.hs @@ -21,11 +21,6 @@ import qualified Ganeti.HTools.Node as Node import Ganeti.HTools.Types - --- | Swap a list of @(a, b)@ into @(b, a)@ -swapPairs :: [(a, b)] -> [(b, a)] -swapPairs = map (\ (a, b) -> (b, a)) - -- | Lookups a node into an assoc list lookupNode :: (Monad m) => NameAssoc -> String -> String -> m Int lookupNode ktn inst node = @@ -82,12 +77,11 @@ stripSuffix sflen name = take ((length name) - sflen) name {-| Initializer function that loads the data from a node and list file and massages it into the correct format. -} -mergeData :: ([(String, Int)], Node.AssocList, - [(String, Int)], Instance.AssocList) -- ^ Data from either - -- Text.loadData - -- or Rapi.loadData +mergeData :: (Node.AssocList, + Instance.AssocList) -- ^ Data from either Text.loadData + -- or Rapi.loadData -> Result (NodeList, InstanceList, String) -mergeData (ktn, nl, kti, il) = do +mergeData (nl, il) = do let nl2 = fixNodes nl il il3 = Container.fromAssocList il diff --git a/Ganeti/HTools/Rapi.hs b/Ganeti/HTools/Rapi.hs index ac0ff44fad9addf2ccf011954ed1da97922d12aa..4f3b89bece0c6eab6fdb59a656f38f1d387ecfb8 100644 --- a/Ganeti/HTools/Rapi.hs +++ b/Ganeti/HTools/Rapi.hs @@ -84,8 +84,7 @@ parseNode a = do return (name, node) loadData :: String -- ^ Cluster/URL to use as source - -> IO (Result (NameAssoc, Node.AssocList, - NameAssoc, Instance.AssocList)) + -> IO (Result (Node.AssocList, Instance.AssocList)) loadData master = do -- IO monad let url = formatHost master node_body <- getUrl $ printf "%s/2/nodes?bulk=1" url @@ -94,5 +93,5 @@ loadData master = do -- IO monad node_data <- node_body >>= getNodes let (node_names, node_idx) = assignIndices node_data inst_data <- inst_body >>= getInstances node_names - let (inst_names, inst_idx) = assignIndices inst_data - return (node_names, node_idx, inst_names, inst_idx) + let (_, inst_idx) = assignIndices inst_data + return (node_idx, inst_idx) diff --git a/Ganeti/HTools/Text.hs b/Ganeti/HTools/Text.hs index 7c85db3fe3402b0ce79e48f185f40a31997786f7..fdf1982601f30c840ba59678809f8cf7509831d5 100644 --- a/Ganeti/HTools/Text.hs +++ b/Ganeti/HTools/Text.hs @@ -75,8 +75,7 @@ loadTabular text_data convert_fn = do loadData :: String -- ^ Node data in string format -> String -- ^ Instance data in string format - -> IO (Result (NameAssoc, Node.AssocList, - NameAssoc, Instance.AssocList)) + -> IO (Result (Node.AssocList, Instance.AssocList)) loadData nfile ifile = do -- IO monad ndata <- readFile nfile idata <- readFile ifile @@ -84,5 +83,5 @@ loadData nfile ifile = do -- IO monad {- node file: name t_mem n_mem f_mem t_disk f_disk -} (ktn, nl) <- loadTabular ndata loadNode {- instance file: name mem disk status pnode snode -} - (kti, il) <- loadTabular idata (loadInst ktn) - return (ktn, nl, kti, il) + (_, il) <- loadTabular idata (loadInst ktn) + return (nl, il)