.. by adding sections and moving functions into them.

Signed-off-by: Petr Pudlak <[email protected]>
---
 src/Ganeti/Config.hs | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/Ganeti/Config.hs b/src/Ganeti/Config.hs
index c60ce32..7311b89 100644
--- a/src/Ganeti/Config.hs
+++ b/src/Ganeti/Config.hs
@@ -81,9 +81,7 @@ import Ganeti.Types
 -- | Type alias for the link and ip map.
 type LinkIpMap = M.Map String (M.Map String String)
 
--- | Type class denoting objects which have node parameters.
-class NdParamObject a where
-  getNdParamsOf :: ConfigData -> a -> Maybe FilledNDParams
+-- * Operations on the whole configuration
 
 -- | Reads the config file.
 readConfig :: FilePath -> IO (Result String)
@@ -289,18 +287,6 @@ getGroupInstances cfg gname =
       ginsts = map (getNodeInstances cfg) gnodes in
   (concatMap fst ginsts, concatMap snd ginsts)
 
--- | Looks up a network. If looking up by uuid fails, we look up
--- by name.
-getNetwork :: ConfigData -> String -> ErrorResult Network
-getNetwork cfg name =
-  let networks = fromContainer (configNetworks cfg)
-  in case getItem "Network" name networks of
-       Ok net -> Ok net
-       Bad _ -> let by_name = M.mapKeys
-                              (fromNonEmpty . networkName . (M.!) networks)
-                              networks
-                in getItem "Network" name by_name
-
 -- | Retrieves the instance hypervisor params, missing values filled with
 -- cluster defaults.
 getFilledInstHvParams :: [String] -> ConfigData -> Instance -> HvParams
@@ -475,6 +461,26 @@ getNodeNdParams cfg node = do
   let gparams = getGroupNdParams cfg group
   return $ fillNDParams gparams (nodeNdparams node)
 
+-- * Network
+
+-- | Looks up a network. If looking up by uuid fails, we look up
+-- by name.
+getNetwork :: ConfigData -> String -> ErrorResult Network
+getNetwork cfg name =
+  let networks = fromContainer (configNetworks cfg)
+  in case getItem "Network" name networks of
+       Ok net -> Ok net
+       Bad _ -> let by_name = M.mapKeys
+                              (fromNonEmpty . networkName . (M.!) networks)
+                              networks
+                in getItem "Network" name by_name
+
+-- * ND params
+
+-- | Type class denoting objects which have node parameters.
+class NdParamObject a where
+  getNdParamsOf :: ConfigData -> a -> Maybe FilledNDParams
+
 instance NdParamObject Node where
   getNdParamsOf = getNodeNdParams
 
-- 
1.9.1.423.g4596e3a

Reply via email to