Commit 669d7e3d authored by Iustin Pop's avatar Iustin Pop
Browse files

Introduce a namespace for the modules

The modules are moved from the ‘top’ namespace to ‘Ganeti.HTools’, in
compliance with standard practices.
parent 9857c181
......@@ -5,7 +5,7 @@ goes into the "Main" module.
-}
module Cluster
module Ganeti.HTools.Cluster
(
-- * Types
NodeList
......@@ -38,10 +38,10 @@ import Data.Maybe (isNothing, fromJust)
import Text.Printf (printf)
import Data.Function
import qualified Container
import qualified Instance
import qualified Node
import Utils
import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.HTools.Instance as Instance
import qualified Ganeti.HTools.Node as Node
import Ganeti.HTools.Utils
type NodeList = Container.Container Node.Node
type InstanceList = Container.Container Instance.Instance
......@@ -224,10 +224,10 @@ checkRemoval nl victims =
-- | Computes the removals list for a given depth
computeRemovals :: Cluster.NodeList
computeRemovals :: NodeList
-> [Instance.Instance]
-> Int
-> [Maybe Cluster.Removal]
-> [Maybe Removal]
computeRemovals nl bad_instances depth =
map (checkRemoval nl) $ genNames depth bad_instances
......
......@@ -5,7 +5,7 @@ give the best performance for our workload.
-}
module Container
module Ganeti.HTools.Container
(
-- * Types
Container
......
......@@ -4,7 +4,7 @@ The instance data type holds very few fields, the algorithm
intelligence is in the "Node" and "Cluster" modules.
-}
module Instance where
module Ganeti.HTools.Instance where
data Instance = Instance { mem :: Int -- ^ memory of the instance
, dsk :: Int -- ^ disk size of instance
......
......@@ -4,7 +4,7 @@
updated value.
-}
module Node
module Ganeti.HTools.Node
(
Node(failN1, idx, f_mem, f_dsk, p_mem, p_dsk, slist, plist, p_rem)
-- * Constructor
......@@ -26,11 +26,11 @@ module Node
import Data.List
import Text.Printf (printf)
import qualified Container
import qualified Instance
import qualified PeerMap
import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.HTools.Instance as Instance
import qualified Ganeti.HTools.PeerMap as PeerMap
import Utils
import Ganeti.HTools.Utils
data Node = Node { t_mem :: Double -- ^ total memory (Mib)
, f_mem :: Int -- ^ free memory (MiB)
......
......@@ -7,19 +7,19 @@ implementation should be easy in case it's needed.
-}
module PeerMap (
PeerMap,
Key,
Elem,
empty,
create,
accumArray,
PeerMap.find,
add,
remove,
maxElem
)
where
module Ganeti.HTools.PeerMap
(
PeerMap,
Key,
Elem,
empty,
create,
accumArray,
Ganeti.HTools.PeerMap.find,
add,
remove,
maxElem
) where
import Data.Maybe (fromMaybe)
import Data.List
......
......@@ -2,7 +2,7 @@
-}
module Rapi
module Ganeti.HTools.Rapi
(
getNodes
, getInstances
......@@ -16,7 +16,7 @@ import Data.Maybe
import Control.Monad
import Text.JSON
import Text.Printf (printf)
import Utils ()
import Ganeti.HTools.Utils ()
{-- Our cheap monad-like stuff.
......
{-| Utility functions -}
module Utils where
module Ganeti.HTools.Utils where
import Data.Either
import Data.List
......@@ -10,7 +10,7 @@ import System
import System.IO
import System.Info
import Text.Printf
import qualified Version
import qualified Ganeti.HTools.Version as Version
import Debug.Trace
......
module Version
module Ganeti.HTools.Version
(
version -- ^ the version of the tree
) where
......
......@@ -4,8 +4,10 @@ HDDIR = apidoc
# Haskell rules
all: version
$(MAKE) -C src
all: hbal hn1
hn1 hbal: Ganeti/HTools/Version.hs
ghc --make -O2 -W $@
README.html: README
rst2html $< $@
......@@ -25,16 +27,24 @@ doc: README.html
$(HSRCS)
clean:
rm -f *.o *.cmi *.cmo *.cmx *.old hn1 zn1 *.prof *.ps *.stat *.aux \
gmon.out *.hi README.html TAGS version
rm -f *.o hn1 zn1 *.prof *.ps *.stat *.aux \
gmon.out *.hi README.html TAGS Ganeti/HTools/Version.hs
git describe >/dev/null && rm -f version
version:
git describe > $@
Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
sed -e "s/%ver%/$$(cat ../version)/" < $< > $@
dist: version
VN=$$(cat version|sed 's/^v//') ; \
ANAME="htools-$$VN.tar" ; \
git archive --format=tar --prefix=htools-$$VN/ HEAD > $$ANAME ; \
tar -r -f $$ANAME --transform="s,^,htools-$$VN/," version
rm -f $$ANAME $$ANAME.gz ; \
git archive --format=tar --prefix=htools-$$VN/ HEAD > $$ANAME ; \
tar -r -f $$ANAME --owner root --group root \
--transform="s,^,htools-$$VN/," version ; \
gzip -v9 $$ANAME ; \
tar tzvf $$ANAME.gz
.PHONY : all doc clean hn1 dist
......@@ -14,11 +14,11 @@ import qualified System
import Text.Printf (printf)
import qualified Container
import qualified Cluster
import qualified Version
import Rapi
import Utils
import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.HTools.Cluster as Cluster
import qualified Ganeti.HTools.Version as Version
import Ganeti.HTools.Rapi
import Ganeti.HTools.Utils
-- | Command line options structure.
data Options = Options
......
......@@ -14,12 +14,12 @@ import qualified System
import Text.Printf (printf)
import qualified Container
import qualified Instance
import qualified Cluster
import qualified Version
import Utils
import Rapi
import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.HTools.Instance as Instance
import qualified Ganeti.HTools.Cluster as Cluster
import qualified Ganeti.HTools.Version as Version
import Ganeti.HTools.Rapi
import Ganeti.HTools.Utils
-- | Command line options structure.
data Options = Options
......
all: hn1 hbal
hn1: Version.hs
ghc --make -O2 -W hn1
hbal: Version.hs
ghc --make -O2 -W hbal
clean:
rm -f *.o *.old hn1 hbal *.prof *.ps *.stat *.aux \
*.hi README.html TAGS Version.hs
Version.hs: Version.hs.in ../version
sed -e "s/%ver%/$$(cat ../version)/" < $< > $@
.PHONY : all clean hn1 hbal
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment